From 9a1133615e88f2a4f477c4dbedb96cbc268112b6 Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Thu, 12 Dec 2019 10:47:28 +0100 Subject: [PATCH] Pass VA while constructing BlitProperties instead of allocation + offset Change-Id: Id6f88ff5252cab650ecf103e1e465bf454e6ba4c Signed-off-by: Dunajski, Bartosz --- runtime/helpers/blit_commands_helper.cpp | 108 +++++++++++++----- runtime/helpers/blit_commands_helper.h | 11 +- runtime/helpers/blit_commands_helper_base.inl | 4 +- .../command_queue/blit_enqueue_tests.cpp | 6 +- .../command_stream_receiver_hw_tests.cpp | 90 ++++++++++----- unit_tests/mem_obj/buffer_tests.cpp | 6 +- 6 files changed, 157 insertions(+), 68 deletions(-) diff --git a/runtime/helpers/blit_commands_helper.cpp b/runtime/helpers/blit_commands_helper.cpp index b14fa7deb3..6207e7dca1 100644 --- a/runtime/helpers/blit_commands_helper.cpp +++ b/runtime/helpers/blit_commands_helper.cpp @@ -17,30 +17,51 @@ namespace NEO { BlitProperties BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection blitDirection, CommandStreamReceiver &commandStreamReceiver, - GraphicsAllocation *memObjAllocation, size_t memObjOffset, - GraphicsAllocation *mapAllocation, - void *hostPtr, size_t hostPtrOffset, + GraphicsAllocation *memObjAllocation, + GraphicsAllocation *preallocatedHostAllocation, + void *hostPtr, uint64_t memObjGpuVa, + uint64_t hostAllocGpuVa, size_t hostPtrOffset, size_t copyOffset, uint64_t copySize) { GraphicsAllocation *hostAllocation = nullptr; - if (mapAllocation) { - hostAllocation = mapAllocation; - if (hostPtr) { - hostPtrOffset += ptrDiff(hostPtr, mapAllocation->getGpuAddress()); - } + if (preallocatedHostAllocation) { + hostAllocation = preallocatedHostAllocation; + UNRECOVERABLE_IF(hostAllocGpuVa == 0); } else { HostPtrSurface hostPtrSurface(hostPtr, static_cast(copySize), true); bool success = commandStreamReceiver.createAllocationForHostSurface(hostPtrSurface, false); UNRECOVERABLE_IF(!success); hostAllocation = hostPtrSurface.getAllocation(); + hostAllocGpuVa = hostAllocation->getGpuAddress(); } - auto offset = copyOffset + memObjOffset; if (BlitterConstants::BlitDirection::HostPtrToBuffer == blitDirection) { - return {nullptr, blitDirection, {}, AuxTranslationDirection::None, memObjAllocation, hostAllocation, offset, hostPtrOffset, copySize}; + return { + nullptr, // outputTimestampPacket + blitDirection, // blitDirection + {}, // csrDependencies + AuxTranslationDirection::None, // auxTranslationDirection + memObjAllocation, // dstAllocation + hostAllocation, // srcAllocation + memObjGpuVa, // dstGpuAddress + hostAllocGpuVa, // srcGpuAddress + copySize, // copySize + copyOffset, // dstOffset + hostPtrOffset}; // srcOffset } else { - return {nullptr, blitDirection, {}, AuxTranslationDirection::None, hostAllocation, memObjAllocation, hostPtrOffset, offset, copySize}; + return { + nullptr, // outputTimestampPacket + blitDirection, // blitDirection + {}, // csrDependencies + AuxTranslationDirection::None, // auxTranslationDirection + hostAllocation, // dstAllocation + memObjAllocation, // srcAllocation + hostAllocGpuVa, // dstGpuAddress + memObjGpuVa, // srcGpuAddress + copySize, // copySize + hostPtrOffset, // dstOffset + copyOffset}; // srcOffset } } @@ -59,61 +80,94 @@ BlitProperties BlitProperties::constructProperties(BlitterConstants::BlitDirecti GraphicsAllocation *gpuAllocation = nullptr; size_t copyOffset = 0; - size_t memObjOffset = 0; void *hostPtr = nullptr; size_t hostPtrOffset = 0; + uint64_t memObjGpuVa = 0; + uint64_t hostAllocGpuVa = 0; + GraphicsAllocation *hostAllocation = builtinOpParams.transferAllocation; if (BlitterConstants::BlitDirection::HostPtrToBuffer == blitDirection) { // write buffer + hostPtr = builtinOpParams.srcPtr; + hostPtrOffset = builtinOpParams.srcOffset.x; + copyOffset = builtinOpParams.dstOffset.x; + + memObjGpuVa = castToUint64(builtinOpParams.dstPtr); + hostAllocGpuVa = castToUint64(builtinOpParams.srcPtr); + if (builtinOpParams.dstSvmAlloc) { gpuAllocation = builtinOpParams.dstSvmAlloc; hostAllocation = builtinOpParams.srcSvmAlloc; } else { gpuAllocation = builtinOpParams.dstMemObj->getGraphicsAllocation(); - memObjOffset = builtinOpParams.dstMemObj->getOffset(); - hostPtr = builtinOpParams.srcPtr; + memObjGpuVa = (gpuAllocation->getGpuAddress() + builtinOpParams.dstMemObj->getOffset()); } - - hostPtrOffset = builtinOpParams.srcOffset.x; - copyOffset = builtinOpParams.dstOffset.x; } if (BlitterConstants::BlitDirection::BufferToHostPtr == blitDirection) { // read buffer + hostPtr = builtinOpParams.dstPtr; + + hostPtrOffset = builtinOpParams.dstOffset.x; + copyOffset = builtinOpParams.srcOffset.x; + + memObjGpuVa = castToUint64(builtinOpParams.srcPtr); + hostAllocGpuVa = castToUint64(builtinOpParams.dstPtr); + if (builtinOpParams.srcSvmAlloc) { gpuAllocation = builtinOpParams.srcSvmAlloc; hostAllocation = builtinOpParams.dstSvmAlloc; } else { gpuAllocation = builtinOpParams.srcMemObj->getGraphicsAllocation(); - memObjOffset = builtinOpParams.srcMemObj->getOffset(); - hostPtr = builtinOpParams.dstPtr; + memObjGpuVa = (gpuAllocation->getGpuAddress() + builtinOpParams.srcMemObj->getOffset()); } - - hostPtrOffset = builtinOpParams.dstOffset.x; - copyOffset = builtinOpParams.srcOffset.x; } UNRECOVERABLE_IF(BlitterConstants::BlitDirection::HostPtrToBuffer != blitDirection && BlitterConstants::BlitDirection::BufferToHostPtr != blitDirection); - return constructPropertiesForReadWriteBuffer(blitDirection, commandStreamReceiver, gpuAllocation, memObjOffset, - hostAllocation, hostPtr, hostPtrOffset, copyOffset, - builtinOpParams.size.x); + return constructPropertiesForReadWriteBuffer(blitDirection, commandStreamReceiver, gpuAllocation, + hostAllocation, hostPtr, memObjGpuVa, hostAllocGpuVa, + hostPtrOffset, copyOffset, builtinOpParams.size.x); } BlitProperties BlitProperties::constructPropertiesForCopyBuffer(GraphicsAllocation *dstAllocation, GraphicsAllocation *srcAllocation, size_t dstOffset, size_t srcOffset, uint64_t copySize) { - return {nullptr, BlitterConstants::BlitDirection::BufferToBuffer, {}, AuxTranslationDirection::None, dstAllocation, srcAllocation, dstOffset, srcOffset, copySize}; + return { + nullptr, // outputTimestampPacket + BlitterConstants::BlitDirection::BufferToBuffer, // blitDirection + {}, // csrDependencies + AuxTranslationDirection::None, // auxTranslationDirection + dstAllocation, // dstAllocation + srcAllocation, // srcAllocation + dstAllocation->getGpuAddress(), // dstGpuAddress + srcAllocation->getGpuAddress(), // srcGpuAddress + copySize, // copySize + dstOffset, // dstOffset + srcOffset}; // srcOffset } BlitProperties BlitProperties::constructPropertiesForAuxTranslation(AuxTranslationDirection auxTranslationDirection, GraphicsAllocation *allocation) { + auto allocationSize = allocation->getUnderlyingBufferSize(); - return {nullptr, BlitterConstants::BlitDirection::BufferToBuffer, {}, auxTranslationDirection, allocation, allocation, 0, 0, allocationSize}; + return { + nullptr, // outputTimestampPacket + BlitterConstants::BlitDirection::BufferToBuffer, // blitDirection + {}, // csrDependencies + auxTranslationDirection, // auxTranslationDirection + allocation, // dstAllocation + allocation, // srcAllocation + allocation->getGpuAddress(), // dstGpuAddress + allocation->getGpuAddress(), // srcGpuAddress + allocationSize, // copySize + 0, // dstOffset + 0 // srcOffset + }; } BlitterConstants::BlitDirection BlitProperties::obtainBlitDirection(uint32_t commandType) { diff --git a/runtime/helpers/blit_commands_helper.h b/runtime/helpers/blit_commands_helper.h index 0415795280..2e85f8c6d7 100644 --- a/runtime/helpers/blit_commands_helper.h +++ b/runtime/helpers/blit_commands_helper.h @@ -31,9 +31,10 @@ using BlitPropertiesContainer = StackVec; struct BlitProperties { static BlitProperties constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection blitDirection, CommandStreamReceiver &commandStreamReceiver, - GraphicsAllocation *memObjAllocation, size_t memObjOFfset, - GraphicsAllocation *mapAllocation, - void *hostPtr, size_t hostPtrOffset, + GraphicsAllocation *memObjAllocation, + GraphicsAllocation *preallocatedHostAllocation, + void *hostPtr, uint64_t memObjGpuVa, + uint64_t hostAllocGpuVa, size_t hostPtrOffset, size_t copyOffset, uint64_t copySize); static BlitProperties constructProperties(BlitterConstants::BlitDirection blitDirection, @@ -59,9 +60,11 @@ struct BlitProperties { GraphicsAllocation *dstAllocation = nullptr; GraphicsAllocation *srcAllocation = nullptr; + uint64_t dstGpuAddress = 0; + uint64_t srcGpuAddress = 0; + uint64_t copySize = 0; size_t dstOffset = 0; size_t srcOffset = 0; - uint64_t copySize = 0; }; template diff --git a/runtime/helpers/blit_commands_helper_base.inl b/runtime/helpers/blit_commands_helper_base.inl index 58ff6b8b84..279c6839b4 100644 --- a/runtime/helpers/blit_commands_helper_base.inl +++ b/runtime/helpers/blit_commands_helper_base.inl @@ -74,8 +74,8 @@ void BlitCommandsHelper::dispatchBlitCommandsForBuffer(const BlitProp bltCmd->setDestinationPitch(static_cast(width)); bltCmd->setSourcePitch(static_cast(width)); - bltCmd->setDestinationBaseAddress(blitProperties.dstAllocation->getGpuAddress() + blitProperties.dstOffset + offset); - bltCmd->setSourceBaseAddress(blitProperties.srcAllocation->getGpuAddress() + blitProperties.srcOffset + offset); + bltCmd->setDestinationBaseAddress(blitProperties.dstGpuAddress + blitProperties.dstOffset + offset); + bltCmd->setSourceBaseAddress(blitProperties.srcGpuAddress + blitProperties.srcOffset + offset); appendBlitCommandsForBuffer(blitProperties, *bltCmd); diff --git a/unit_tests/command_queue/blit_enqueue_tests.cpp b/unit_tests/command_queue/blit_enqueue_tests.cpp index e76247a691..5161c6dd05 100644 --- a/unit_tests/command_queue/blit_enqueue_tests.cpp +++ b/unit_tests/command_queue/blit_enqueue_tests.cpp @@ -32,8 +32,10 @@ struct BlitAuxTranslationTests : public ::testing::Test { } BlitOperationResult blitMemoryToAllocation(MemObj &memObj, GraphicsAllocation *memory, void *hostPtr, size_t size) const override { auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - *bcsCsr, memory, 0, nullptr, - hostPtr, 0, 0, size); + *bcsCsr, memory, nullptr, + hostPtr, + memory->getGpuAddress(), 0, + 0, 0, size); BlitPropertiesContainer container; container.push_back(blitProperties); diff --git a/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp b/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp index 09de353367..87305df2c0 100644 --- a/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp @@ -428,7 +428,8 @@ HWTEST_F(BcsTests, givenBltSizeWithLeftoverWhenDispatchedThenProgramAllRequiredC csr.taskCount = newTaskCount - 1; EXPECT_EQ(0u, csr.recursiveLockCounter.load()); auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, buffer->getGraphicsAllocation(), 0, nullptr, hostPtr, + csr, buffer->getGraphicsAllocation(), nullptr, hostPtr, + buffer->getGraphicsAllocation()->getGpuAddress(), 0, 0, 0, bltSize); blitBuffer(&csr, blitProperties, true); @@ -484,7 +485,8 @@ HWTEST_F(BcsTests, givenCsrDependenciesWhenProgrammingCommandStreamThenAddSemaph size_t numberNodesPerContainer = 5; auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, buffer->getGraphicsAllocation(), 0, nullptr, hostPtr, + csr, buffer->getGraphicsAllocation(), nullptr, hostPtr, + buffer->getGraphicsAllocation()->getGpuAddress(), 0, 0, 0, 1); MockTimestampPacketContainer timestamp0(*csr.getTimestampPacketAllocator(), numberNodesPerContainer); @@ -532,10 +534,12 @@ HWTEST_F(BcsTests, givenMultipleBlitPropertiesWhenDispatchingThenProgramCommands void *hostPtr2 = reinterpret_cast(0x12340000); auto blitProperties1 = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, buffer1->getGraphicsAllocation(), 0, nullptr, hostPtr1, + csr, buffer1->getGraphicsAllocation(), nullptr, hostPtr1, + buffer1->getGraphicsAllocation()->getGpuAddress(), 0, 0, 0, 1); auto blitProperties2 = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, buffer2->getGraphicsAllocation(), 0, nullptr, hostPtr2, + csr, buffer2->getGraphicsAllocation(), nullptr, hostPtr2, + buffer2->getGraphicsAllocation()->getGpuAddress(), 0, 0, 0, 1); MockTimestampPacketContainer timestamp1(*csr.getTimestampPacketAllocator(), 1); @@ -586,11 +590,13 @@ HWTEST_F(BcsTests, givenInputAllocationsWhenBlitDispatchedThenMakeAllAllocations EXPECT_EQ(0u, csr.makeSurfacePackNonResidentCalled); auto blitProperties1 = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, buffer1->getGraphicsAllocation(), 0, nullptr, hostPtr1, + csr, buffer1->getGraphicsAllocation(), nullptr, hostPtr1, + buffer1->getGraphicsAllocation()->getGpuAddress(), 0, 0, 0, 1); auto blitProperties2 = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, buffer2->getGraphicsAllocation(), 0, nullptr, hostPtr2, + csr, buffer2->getGraphicsAllocation(), nullptr, hostPtr2, + buffer2->getGraphicsAllocation()->getGpuAddress(), 0, 0, 0, 1); BlitPropertiesContainer blitPropertiesContainer; @@ -623,7 +629,8 @@ HWTEST_F(BcsTests, givenBufferWhenBlitCalledThenFlushCommandBuffer) { csr.taskCount = newTaskCount - 1; auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, buffer->getGraphicsAllocation(), 0, nullptr, hostPtr, + csr, buffer->getGraphicsAllocation(), nullptr, hostPtr, + buffer->getGraphicsAllocation()->getGpuAddress(), 0, 0, 0, 1); blitBuffer(&csr, blitProperties, true); @@ -672,8 +679,10 @@ HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCallWaitWithKmdFallback) { void *hostPtr = reinterpret_cast(0x12340000); auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - *myMockCsr, buffer->getGraphicsAllocation(), 0, nullptr, - hostPtr, 0, 0, 1); + *myMockCsr, buffer->getGraphicsAllocation(), nullptr, + hostPtr, + buffer->getGraphicsAllocation()->getGpuAddress(), 0, + 0, 0, 1); blitBuffer(myMockCsr.get(), blitProperties, false); @@ -702,7 +711,8 @@ HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCleanTemporaryAllocations) { EXPECT_EQ(0u, mockInternalAllocationsStorage->cleanAllocationsCalled); auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - bcsCsr, buffer->getGraphicsAllocation(), 0, nullptr, hostPtr, + bcsCsr, buffer->getGraphicsAllocation(), nullptr, hostPtr, + buffer->getGraphicsAllocation()->getGpuAddress(), 0, 0, 0, 1); blitBuffer(&bcsCsr, blitProperties, false); @@ -734,8 +744,11 @@ HWTEST_F(BcsTests, givenBufferWhenBlitOperationCalledThenProgramCorrectGpuAddres // from hostPtr HardwareParse hwParser; auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, subBuffer1->getGraphicsAllocation(), subBuffer1Offset, - nullptr, hostPtr, hostPtrOffset, 0, 1); + csr, subBuffer1->getGraphicsAllocation(), + nullptr, hostPtr, + subBuffer1->getGraphicsAllocation()->getGpuAddress() + + subBuffer1->getOffset(), + 0, hostPtrOffset, 0, 1); blitBuffer(&csr, blitProperties, true); @@ -753,8 +766,11 @@ HWTEST_F(BcsTests, givenBufferWhenBlitOperationCalledThenProgramCorrectGpuAddres HardwareParse hwParser; auto offset = csr.commandStream.getUsed(); auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::BufferToHostPtr, - csr, subBuffer1->getGraphicsAllocation(), subBuffer1Offset, - nullptr, hostPtr, hostPtrOffset, 0, 1); + csr, subBuffer1->getGraphicsAllocation(), + nullptr, hostPtr, + subBuffer1->getGraphicsAllocation()->getGpuAddress() + + subBuffer1->getOffset(), + 0, hostPtrOffset, 0, 1); blitBuffer(&csr, blitProperties, true); @@ -829,8 +845,11 @@ HWTEST_F(BcsTests, givenMapAllocationWhenDispatchReadWriteOperationThenSetValidG // from hostPtr HardwareParse hwParser; auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, buffer->getGraphicsAllocation(), 0, - mapAllocation, mapPtr, hostPtrOffset, 0, 1); + csr, buffer->getGraphicsAllocation(), + mapAllocation, mapPtr, + buffer->getGraphicsAllocation()->getGpuAddress(), + castToUint64(mapPtr), + hostPtrOffset, 0, 1); blitBuffer(&csr, blitProperties, true); @@ -849,8 +868,10 @@ HWTEST_F(BcsTests, givenMapAllocationWhenDispatchReadWriteOperationThenSetValidG HardwareParse hwParser; auto offset = csr.commandStream.getUsed(); auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::BufferToHostPtr, - csr, buffer->getGraphicsAllocation(), 0, - mapAllocation, mapPtr, hostPtrOffset, 0, 1); + csr, buffer->getGraphicsAllocation(), + mapAllocation, mapPtr, + buffer->getGraphicsAllocation()->getGpuAddress(), + castToUint64(mapPtr), hostPtrOffset, 0, 1); blitBuffer(&csr, blitProperties, true); @@ -951,7 +972,7 @@ HWTEST_F(BcsTests, givenNonZeroCopySvmAllocationWhenConstructingBlitPropertiesFo svmAllocsManager.freeSVMAlloc(svmAlloc); } -HWTEST_F(BcsTests, givenSvmAllocationWhenBlitCalledThenUseOnlySvmAllocationsWithoutHostPtr) { +HWTEST_F(BcsTests, givenSvmAllocationWhenBlitCalledThenUsePassedPointers) { auto &csr = pDevice->getUltCommandStreamReceiver(); MockMemoryManager mockMemoryManager(true, true); SVMAllocsManager svmAllocsManager(&mockMemoryManager); @@ -964,13 +985,16 @@ HWTEST_F(BcsTests, givenSvmAllocationWhenBlitCalledThenUseOnlySvmAllocationsWith EXPECT_NE(nullptr, svmData->cpuAllocation); EXPECT_NE(svmData->gpuAllocation, svmData->cpuAllocation); + uint64_t srcOffset = 2; + uint64_t dstOffset = 3; + { // from hostPtr BuiltinOpParams builtinOpParams = {}; builtinOpParams.dstSvmAlloc = svmData->cpuAllocation; builtinOpParams.srcSvmAlloc = svmData->gpuAllocation; - builtinOpParams.srcPtr = reinterpret_cast(0x1234567); - builtinOpParams.dstPtr = reinterpret_cast(0x7654321); + builtinOpParams.srcPtr = reinterpret_cast(svmData->cpuAllocation->getGpuAddress() + srcOffset); + builtinOpParams.dstPtr = reinterpret_cast(svmData->cpuAllocation->getGpuAddress() + dstOffset); builtinOpParams.size.x = 1; auto blitProperties = BlitProperties::constructProperties(BlitterConstants::BlitDirection::HostPtrToBuffer, @@ -985,16 +1009,16 @@ HWTEST_F(BcsTests, givenSvmAllocationWhenBlitCalledThenUseOnlySvmAllocationsWith auto bltCmd = genCmdCast(*hwParser.cmdList.begin()); - EXPECT_EQ(builtinOpParams.dstSvmAlloc->getGpuAddress(), bltCmd->getDestinationBaseAddress()); - EXPECT_EQ(builtinOpParams.srcSvmAlloc->getGpuAddress(), bltCmd->getSourceBaseAddress()); + EXPECT_EQ(castToUint64(builtinOpParams.dstPtr), bltCmd->getDestinationBaseAddress()); + EXPECT_EQ(castToUint64(builtinOpParams.srcPtr), bltCmd->getSourceBaseAddress()); } { // to hostPtr BuiltinOpParams builtinOpParams = {}; builtinOpParams.srcSvmAlloc = svmData->gpuAllocation; builtinOpParams.dstSvmAlloc = svmData->cpuAllocation; - builtinOpParams.dstPtr = reinterpret_cast(0x1234567); - builtinOpParams.srcPtr = reinterpret_cast(0x7654321); + builtinOpParams.dstPtr = reinterpret_cast(svmData->cpuAllocation + dstOffset); + builtinOpParams.srcPtr = reinterpret_cast(svmData->gpuAllocation + srcOffset); builtinOpParams.size.x = 1; auto blitProperties = BlitProperties::constructProperties(BlitterConstants::BlitDirection::BufferToHostPtr, @@ -1008,8 +1032,8 @@ HWTEST_F(BcsTests, givenSvmAllocationWhenBlitCalledThenUseOnlySvmAllocationsWith auto bltCmd = genCmdCast(*hwParser.cmdList.begin()); - EXPECT_EQ(builtinOpParams.dstSvmAlloc->getGpuAddress(), bltCmd->getDestinationBaseAddress()); - EXPECT_EQ(builtinOpParams.srcSvmAlloc->getGpuAddress(), bltCmd->getSourceBaseAddress()); + EXPECT_EQ(castToUint64(builtinOpParams.dstPtr), bltCmd->getDestinationBaseAddress()); + EXPECT_EQ(castToUint64(builtinOpParams.srcPtr), bltCmd->getSourceBaseAddress()); } svmAllocsManager.freeSVMAlloc(svmAlloc); @@ -1031,8 +1055,10 @@ HWTEST_F(BcsTests, givenBufferWithOffsetWhenBlitOperationCalledThenProgramCorrec HardwareParse hwParser; auto offset = csr.commandStream.getUsed(); auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - csr, buffer1->getGraphicsAllocation(), 0, nullptr, - hostPtr, 0, buffer1Offset, 1); + csr, buffer1->getGraphicsAllocation(), + nullptr, hostPtr, + buffer1->getGraphicsAllocation()->getGpuAddress(), + 0, 0, buffer1Offset, 1); blitBuffer(&csr, blitProperties, true); @@ -1050,8 +1076,10 @@ HWTEST_F(BcsTests, givenBufferWithOffsetWhenBlitOperationCalledThenProgramCorrec HardwareParse hwParser; auto offset = csr.commandStream.getUsed(); auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::BufferToHostPtr, - csr, buffer1->getGraphicsAllocation(), 0, nullptr, - hostPtr, 0, buffer1Offset, 1); + csr, buffer1->getGraphicsAllocation(), nullptr, + hostPtr, + buffer1->getGraphicsAllocation()->getGpuAddress(), + 0, 0, buffer1Offset, 1); blitBuffer(&csr, blitProperties, true); diff --git a/unit_tests/mem_obj/buffer_tests.cpp b/unit_tests/mem_obj/buffer_tests.cpp index 041d8bd321..dbf268b559 100644 --- a/unit_tests/mem_obj/buffer_tests.cpp +++ b/unit_tests/mem_obj/buffer_tests.cpp @@ -658,8 +658,10 @@ struct BcsBufferTests : public ::testing::Test { } BlitOperationResult blitMemoryToAllocation(MemObj &memObj, GraphicsAllocation *memory, void *hostPtr, size_t size) const override { auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, - *bcsCsr, memory, 0, nullptr, - hostPtr, 0, 0, size); + *bcsCsr, memory, nullptr, + hostPtr, + memory->getGpuAddress(), 0, + 0, 0, size); BlitPropertiesContainer container; container.push_back(blitProperties);