diff --git a/shared/source/memory_manager/unified_memory_manager.cpp b/shared/source/memory_manager/unified_memory_manager.cpp index b36e55e37a..20b1152bf5 100644 --- a/shared/source/memory_manager/unified_memory_manager.cpp +++ b/shared/source/memory_manager/unified_memory_manager.cpp @@ -652,7 +652,7 @@ bool SVMAllocsManager::freeSVMAlloc(void *ptr, bool blocking) { } if (InternalMemoryType::hostUnifiedMemory == svmData->memoryType && this->usmHostAllocationsCache) { - if (this->usmHostAllocationsCache->insert(svmData->size, ptr, svmData)) { + if (this->usmHostAllocationsCache->insert(svmData->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize(), ptr, svmData)) { return true; } } @@ -676,13 +676,13 @@ bool SVMAllocsManager::freeSVMAllocDefer(void *ptr) { if (svmData) { if (InternalMemoryType::deviceUnifiedMemory == svmData->memoryType && this->usmDeviceAllocationsCache) { - if (this->usmDeviceAllocationsCache->insert(svmData->size, ptr, svmData)) { + if (this->usmDeviceAllocationsCache->insert(svmData->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize(), ptr, svmData)) { return true; } } if (InternalMemoryType::hostUnifiedMemory == svmData->memoryType && this->usmHostAllocationsCache) { - if (this->usmHostAllocationsCache->insert(svmData->size, ptr, svmData)) { + if (this->usmHostAllocationsCache->insert(svmData->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize(), ptr, svmData)) { return true; } } diff --git a/shared/test/unit_test/memory_manager/unified_memory_manager_cache_tests.cpp b/shared/test/unit_test/memory_manager/unified_memory_manager_cache_tests.cpp index 37873b65bb..c8a8bfc18a 100644 --- a/shared/test/unit_test/memory_manager/unified_memory_manager_cache_tests.cpp +++ b/shared/test/unit_test/memory_manager/unified_memory_manager_cache_tests.cpp @@ -307,6 +307,8 @@ TEST_F(SvmDeviceAllocationCacheTest, givenAllocationCacheEnabledWhenFreeingDevic auto svmData = svmManager->getSVMAlloc(testData.allocation); EXPECT_NE(nullptr, svmData); EXPECT_EQ(svmData, svmManager->usmDeviceAllocationsCache->allocations[i].svmData); + EXPECT_EQ(svmData->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize(), + svmManager->usmDeviceAllocationsCache->allocations[i].allocationSize); break; } } @@ -1159,6 +1161,8 @@ TEST_F(SvmHostAllocationCacheTest, givenAllocationCacheEnabledWhenFreeingHostAll auto svmData = svmManager->getSVMAlloc(testData.allocation); EXPECT_NE(nullptr, svmData); EXPECT_EQ(svmData, svmManager->usmHostAllocationsCache->allocations[i].svmData); + EXPECT_EQ(svmData->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize(), + svmManager->usmHostAllocationsCache->allocations[i].allocationSize); break; } }