diff --git a/runtime/command_stream/command_stream_receiver_simulated_common_hw_base.inl b/runtime/command_stream/command_stream_receiver_simulated_common_hw_base.inl index cddb947b77..ed6a012b0b 100644 --- a/runtime/command_stream/command_stream_receiver_simulated_common_hw_base.inl +++ b/runtime/command_stream/command_stream_receiver_simulated_common_hw_base.inl @@ -47,7 +47,7 @@ void CommandStreamReceiverSimulatedCommonHw::setupContext(OsContext & template bool CommandStreamReceiverSimulatedCommonHw::getParametersForWriteMemory(GraphicsAllocation &graphicsAllocation, uint64_t &gpuAddress, void *&cpuAddress, size_t &size) const { - cpuAddress = ptrOffset(graphicsAllocation.getUnderlyingBuffer(), static_cast(graphicsAllocation.getAllocationOffset())); + cpuAddress = graphicsAllocation.getUnderlyingBuffer(); gpuAddress = GmmHelper::decanonize(graphicsAllocation.getGpuAddress()); size = graphicsAllocation.getUnderlyingBufferSize(); auto gmm = graphicsAllocation.getDefaultGmm(); diff --git a/runtime/helpers/cache_policy.cpp b/runtime/helpers/cache_policy.cpp index 98c87e96c0..0c53cab45e 100644 --- a/runtime/helpers/cache_policy.cpp +++ b/runtime/helpers/cache_policy.cpp @@ -18,8 +18,7 @@ bool isL3Capable(void *ptr, size_t size) { } bool isL3Capable(const NEO::GraphicsAllocation &graphicsAllocation) { - auto ptr = ptrOffset(graphicsAllocation.getUnderlyingBuffer(), static_cast(graphicsAllocation.getAllocationOffset())); - return isL3Capable(ptr, graphicsAllocation.getUnderlyingBufferSize()); + return isL3Capable(graphicsAllocation.getUnderlyingBuffer(), graphicsAllocation.getUnderlyingBufferSize()); } } // namespace NEO diff --git a/runtime/memory_manager/os_agnostic_memory_manager.h b/runtime/memory_manager/os_agnostic_memory_manager.h index 189bc54a75..82d60ae757 100644 --- a/runtime/memory_manager/os_agnostic_memory_manager.h +++ b/runtime/memory_manager/os_agnostic_memory_manager.h @@ -74,7 +74,7 @@ class OsAgnosticMemoryManager : public MemoryManager { GraphicsAllocation *allocateGraphicsMemory64kb(const AllocationData &allocationData) override; GraphicsAllocation *allocateGraphicsMemoryForImageImpl(const AllocationData &allocationData, std::unique_ptr gmm) override; - void *lockResourceImpl(GraphicsAllocation &graphicsAllocation) override { return ptrOffset(graphicsAllocation.getUnderlyingBuffer(), static_cast(graphicsAllocation.getAllocationOffset())); } + void *lockResourceImpl(GraphicsAllocation &graphicsAllocation) override { return graphicsAllocation.getUnderlyingBuffer(); } void unlockResourceImpl(GraphicsAllocation &graphicsAllocation) override {} GraphicsAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData) override; GraphicsAllocation *allocateGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) override; diff --git a/runtime/os_interface/linux/drm_memory_manager.cpp b/runtime/os_interface/linux/drm_memory_manager.cpp index f4a2a7cbc7..f3dd07dfcb 100644 --- a/runtime/os_interface/linux/drm_memory_manager.cpp +++ b/runtime/os_interface/linux/drm_memory_manager.cpp @@ -249,7 +249,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(const Al bo->gpuAddress = gpuVirtualAddress; - auto allocation = new DrmAllocation(allocationData.type, bo, const_cast(alignedPtr), gpuVirtualAddress, + auto allocation = new DrmAllocation(allocationData.type, bo, const_cast(allocationData.hostPtr), gpuVirtualAddress, allocationData.size, MemoryPool::System4KBPages, false); allocation->setAllocationOffset(offsetInPage); diff --git a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp index b40bfc8974..804b3fc6f5 100644 --- a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp @@ -2633,7 +2633,7 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor auto allocation = memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData); EXPECT_NE(nullptr, allocation); - EXPECT_EQ(0x5001u, reinterpret_cast(allocation->getUnderlyingBuffer()) + allocation->getAllocationOffset()); + EXPECT_EQ(0x5001u, reinterpret_cast(allocation->getUnderlyingBuffer())); EXPECT_EQ(13u, allocation->getUnderlyingBufferSize()); EXPECT_EQ(1u, allocation->getAllocationOffset()); @@ -2908,7 +2908,7 @@ TEST_F(DrmMemoryManagerBasic, givenDisabledHostPtrTrackingWhenAllocateGraphicsMe auto allocation = memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData); EXPECT_NE(nullptr, allocation); - EXPECT_EQ(0x5001u, reinterpret_cast(allocation->getUnderlyingBuffer()) + allocation->getAllocationOffset()); + EXPECT_EQ(0x5001u, reinterpret_cast(allocation->getUnderlyingBuffer())); EXPECT_EQ(13u, allocation->getUnderlyingBufferSize()); EXPECT_EQ(1u, allocation->getAllocationOffset());