diff --git a/shared/source/memory_manager/unified_memory_manager.cpp b/shared/source/memory_manager/unified_memory_manager.cpp index e13e697441..47bb342cf7 100644 --- a/shared/source/memory_manager/unified_memory_manager.cpp +++ b/shared/source/memory_manager/unified_memory_manager.cpp @@ -162,6 +162,7 @@ void *SVMAllocsManager::SvmAllocationCache::get(size_t size, const UnifiedMemory allocationIter->svmData->size = size; allocationIter->svmData->isSavedForReuse = false; allocationIter->svmData->gpuAllocations.getDefaultGraphicsAllocation()->setAubWritable(true, std::numeric_limits::max()); + allocationIter->svmData->gpuAllocations.getDefaultGraphicsAllocation()->setTbxWritable(true, std::numeric_limits::max()); allocations.erase(allocationIter); return allocationPtr; } 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 a36b9bffbd..b199a424d9 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 @@ -1542,7 +1542,7 @@ TEST_F(SvmHostAllocationCacheTest, givenAllocationCacheEnabledAndMultipleSVMMana } } -TEST_F(SvmHostAllocationCacheTest, givenAllocationsWithDifferentSizesWhenAllocatingAfterFreeThenReturnCorrectCachedAllocation) { +TEST_F(SvmHostAllocationCacheTest, givenAllocationsWithDifferentSizesWhenAllocatingAfterFreeThenReturnCorrectCachedAllocationAndSetAubTbxWritable) { auto deviceFactory = std::make_unique(1, 1); RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; std::map deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}}; @@ -1582,10 +1582,20 @@ TEST_F(SvmHostAllocationCacheTest, givenAllocationsWithDifferentSizesWhenAllocat std::vector allocationsToFree; + constexpr auto allBanks = std::numeric_limits::max(); + for (auto allocInfo : svmManager->usmHostAllocationsCache->allocations) { + allocInfo.svmData->gpuAllocations.getDefaultGraphicsAllocation()->setAubWritable(false, allBanks); + allocInfo.svmData->gpuAllocations.getDefaultGraphicsAllocation()->setTbxWritable(false, allBanks); + } + for (auto &testData : testDataset) { auto secondAllocation = svmManager->createHostUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties); EXPECT_EQ(svmManager->usmHostAllocationsCache->allocations.size(), testDataset.size() - 1); EXPECT_EQ(secondAllocation, testData.allocation); + auto allocData = svmManager->getSVMAlloc(secondAllocation); + EXPECT_NE(nullptr, allocData); + EXPECT_TRUE(allocData->gpuAllocations.getDefaultGraphicsAllocation()->isAubWritable(allBanks)); + EXPECT_TRUE(allocData->gpuAllocations.getDefaultGraphicsAllocation()->isTbxWritable(allBanks)); svmManager->freeSVMAlloc(secondAllocation); EXPECT_EQ(svmManager->usmHostAllocationsCache->allocations.size(), testDataset.size()); }