Revert "Fix offseted ptr in bliter memory copy"

This reverts commit 3afeb00d3a.

Change-Id: I6987eb0663a735043d02103c444cca2e109a62e5
This commit is contained in:
Plewka, Maciej
2020-07-13 23:54:09 -07:00
committed by sys_ocldev
parent f70882c684
commit 63721561f3
3 changed files with 15 additions and 62 deletions

View File

@@ -130,12 +130,10 @@ struct CommandListCoreFamily : CommandListImp {
uint64_t srcOffset, uint32_t size,
uint32_t elementSize, Builtin builtin);
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlit(uintptr_t dstPtr,
NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset, uintptr_t srcPtr,
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlit(NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset,
NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset,
uint32_t size,
uint64_t srcOffset, uint32_t size,
ze_event_handle_t hSignalEvent);
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlitRegion(NEO::GraphicsAllocation *srcAlloc,

View File

@@ -631,15 +631,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernelWithGA(v
}
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyBlit(uintptr_t dstPtr,
NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset, uintptr_t srcPtr,
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyBlit(NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset,
NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset,
uint32_t size,
ze_event_handle_t hSignalEvent) {
dstOffset += ptrDiff<uintptr_t>(dstPtr, dstPtrAlloc->getGpuAddress());
srcOffset += ptrDiff<uintptr_t>(srcPtr, srcPtrAlloc->getGpuAddress());
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
auto blitProperties = NEO::BlitProperties::constructPropertiesForCopyBuffer(dstPtrAlloc, srcPtrAlloc, {dstOffset, 0, 0}, {srcOffset, 0, 0}, {size, 0, 0}, 0, 0, 0, 0);
commandContainer.addToResidencyContainer(dstPtrAlloc);
@@ -785,10 +782,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
ze_result_t ret = ZE_RESULT_SUCCESS;
appendEventForProfiling(hSignalEvent, true);
if (ret == ZE_RESULT_SUCCESS && leftSize) {
ret = isCopyOnlyCmdList ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
dstAllocationStruct.alloc, dstAllocationStruct.offset,
srcAllocationStruct.alignedAllocationPtr,
ret = isCopyOnlyCmdList ? appendMemoryCopyBlit(dstAllocationStruct.alloc, dstAllocationStruct.offset,
srcAllocationStruct.alloc, srcAllocationStruct.offset, static_cast<uint32_t>(leftSize), hSignalEvent)
: appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr),
dstAllocationStruct.alloc, dstAllocationStruct.offset,
@@ -799,9 +795,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
}
if (ret == ZE_RESULT_SUCCESS && middleSizeBytes) {
ret = isCopyOnlyCmdList ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
dstAllocationStruct.alloc, leftSize + dstAllocationStruct.offset,
srcAllocationStruct.alignedAllocationPtr,
ret = isCopyOnlyCmdList ? appendMemoryCopyBlit(dstAllocationStruct.alloc, leftSize + dstAllocationStruct.offset,
srcAllocationStruct.alloc, leftSize + srcAllocationStruct.offset, static_cast<uint32_t>(middleSizeBytes), hSignalEvent)
: appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr),
dstAllocationStruct.alloc, leftSize + dstAllocationStruct.offset,
@@ -813,9 +807,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
}
if (ret == ZE_RESULT_SUCCESS && rightSize) {
ret = isCopyOnlyCmdList ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
dstAllocationStruct.alloc, leftSize + middleSizeBytes + dstAllocationStruct.offset,
srcAllocationStruct.alignedAllocationPtr,
ret = isCopyOnlyCmdList ? appendMemoryCopyBlit(dstAllocationStruct.alloc, leftSize + middleSizeBytes + dstAllocationStruct.offset,
srcAllocationStruct.alloc, leftSize + middleSizeBytes + srcAllocationStruct.offset, static_cast<uint32_t>(rightSize), hSignalEvent)
: appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr),
dstAllocationStruct.alloc, leftSize + middleSizeBytes + dstAllocationStruct.offset,

View File

@@ -265,13 +265,10 @@ class MockCommandList : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamil
appendMemoryCopyKernelWithGACalledTimes++;
return ZE_RESULT_SUCCESS;
}
ze_result_t appendMemoryCopyBlit(uintptr_t dstPtr,
NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset, uintptr_t srcPtr,
ze_result_t appendMemoryCopyBlit(NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset,
NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset,
uint32_t size,
ze_event_handle_t hSignalEvent) override {
uint64_t srcOffset, uint32_t size, ze_event_handle_t hSignalEvent) override {
appendMemoryCopyBlitCalledTimes++;
return ZE_RESULT_SUCCESS;
}
@@ -689,13 +686,10 @@ class MockCommandListForMemFill : public WhiteBox<::L0::CommandListCoreFamily<gf
AlignedAllocationData getAlignedAllocation(L0::Device *device, const void *buffer, uint64_t bufferSize) override {
return {0, 0, nullptr, true};
}
ze_result_t appendMemoryCopyBlit(uintptr_t dstPtr,
NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset, uintptr_t srcPtr,
ze_result_t appendMemoryCopyBlit(NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset,
NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset,
uint32_t size,
ze_event_handle_t hSignalEvent) override {
uint64_t srcOffset, uint32_t size, ze_event_handle_t hSignalEvent) override {
appendMemoryCopyBlitCalledTimes++;
return ZE_RESULT_SUCCESS;
}
@@ -1560,36 +1554,5 @@ HWTEST2_F(CommandListCreate, givenPitchAndSlicePitchWhenMemoryCopyRegionCalledSi
EXPECT_EQ(cmdList.srcSize.x, pitch);
EXPECT_EQ(cmdList.srcSize.y, slicePitch / pitch);
}
HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListWhenWithDcFlushAddedIsNotAddedAfterBlitCopy, Platforms) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using XY_COPY_BLT = typename GfxFamily::XY_COPY_BLT;
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, true);
uintptr_t srcPtr = 0x5001;
uintptr_t dstPtr = 0x7001;
uint64_t srcOffset = 0x101;
uint64_t dstOffset = 0x201;
uint32_t copySize = 0x301;
NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(srcPtr), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(dstPtr), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
commandList->appendMemoryCopyBlit(ptrOffset(dstPtr, dstOffset), &mockAllocationDst, 0, ptrOffset(srcPtr, srcOffset), &mockAllocationSrc, 0, copySize, nullptr);
auto &commandContainer = commandList->commandContainer;
GenCmdList genCmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
genCmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed()));
auto itor = find<XY_COPY_BLT *>(genCmdList.begin(), genCmdList.end());
ASSERT_NE(genCmdList.end(), itor);
auto cmd = genCmdCast<XY_COPY_BLT *>(*itor);
EXPECT_EQ(cmd->getDestinationBaseAddress(), ptrOffset(dstPtr, dstOffset));
EXPECT_EQ(cmd->getSourceBaseAddress(), ptrOffset(srcPtr, srcOffset));
}
} // namespace ult
} // namespace L0