diff --git a/shared/source/execution_environment/root_device_environment.cpp b/shared/source/execution_environment/root_device_environment.cpp index d6abe92d50..a43689f729 100644 --- a/shared/source/execution_environment/root_device_environment.cpp +++ b/shared/source/execution_environment/root_device_environment.cpp @@ -239,15 +239,8 @@ void RootDeviceEnvironment::initDummyAllocation() { } void RootDeviceEnvironment::setDummyBlitProperties(uint32_t rootDeviceIndex) { - size_t size = 4 * 4096u; - this->dummyBlitProperties = std::make_unique( - rootDeviceIndex, - true, - size, - NEO::AllocationType::buffer, - false, - false, - systemMemoryBitfield); + size_t size = 32 * MemoryConstants::kiloByte; + this->dummyBlitProperties = std::make_unique(rootDeviceIndex, size, NEO::AllocationType::buffer, systemMemoryBitfield); } GraphicsAllocation *RootDeviceEnvironment::getDummyAllocation() const { diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 5f76194207..ed0b26a2b7 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -400,6 +400,10 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo auto &helper = rootDeviceEnvironment.getHelper(); auto &productHelper = rootDeviceEnvironment.getProductHelper(); + if (storageInfo.getMemoryBanks() == 0) { + allocationData.flags.useSystemMemory = true; + } + bool allow64KbPages = false; bool allow32Bit = false; bool forcePin = properties.flags.forcePin; @@ -1054,7 +1058,7 @@ bool MemoryManager::isLocalMemoryUsedForIsa(uint32_t rootDeviceIndex) { std::call_once(checkIsaPlacementOnceFlags[rootDeviceIndex], [&] { AllocationProperties properties = {rootDeviceIndex, 0x1000, AllocationType::kernelIsa, 1}; AllocationData data; - getAllocationData(data, properties, nullptr, StorageInfo()); + getAllocationData(data, properties, nullptr, createStorageInfoFromProperties(properties)); isaInLocalMemory[rootDeviceIndex] = !data.flags.useSystemMemory; }); diff --git a/shared/test/unit_test/memory_manager/memory_manager_tests.cpp b/shared/test/unit_test/memory_manager/memory_manager_tests.cpp index 12c51f0c94..95c7f37bc7 100644 --- a/shared/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/shared/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -2514,6 +2514,16 @@ TEST(MemoryManagerTest, givenAllocationTypesThatMayNeedL3FlushWhenCallingGetAllo } } +TEST(MemoryManagerTest, givenSystemMemoryBitfieldInAllocationPropertiesWhenGetAllocationDataThenUseSystemMemoryIsSet) { + AllocationData allocData{}; + AllocationProperties properties(mockRootDeviceIndex, 1, AllocationType::buffer, systemMemoryBitfield); + + MockMemoryManager mockMemoryManager; + mockMemoryManager.getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties)); + + EXPECT_TRUE(allocData.flags.useSystemMemory); +} + TEST(MemoryManagerTest, givenNullHostPtrWhenIsCopyRequiredIsCalledThenFalseIsReturned) { ImageInfo imgInfo{}; EXPECT_FALSE(MockMemoryManager::isCopyRequired(imgInfo, nullptr)); @@ -3098,7 +3108,8 @@ TEST(MemoryManagerTest, givenMemoryManagerWithLocalMemoryWhenCreatingMultiGraphi executionEnvironment.initGmm(); MockMemoryManager memoryManager(true, true, executionEnvironment); - AllocationProperties allocationProperties{mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::svmGpu, systemMemoryBitfield}; + DeviceBitfield localMemoryBitfield{1}; + AllocationProperties allocationProperties{mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::svmGpu, localMemoryBitfield}; auto localMemoryAllocation = memoryManager.allocateGraphicsMemoryWithProperties(allocationProperties); diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_manager_bindless_heap_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_manager_bindless_heap_tests.cpp index f15c8b3b8d..e78edbd750 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_manager_bindless_heap_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_manager_bindless_heap_tests.cpp @@ -71,10 +71,6 @@ TEST_F(DrmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAllocat TEST_F(DrmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSpecialSshHeapCreatedInDevicePoolThenGpuAddressIsSetToBindlessBaseAddress) { debugManager.flags.ForceLocalMemoryAccessMode.set(0); - AllocationData allocData = {}; - allocData.type = AllocationType::linearStream; - allocData.size = MemoryConstants::pageSize64k; - executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->createBindlessHeapsHelper(device.get(), false); auto gmmHelper = memoryManager->getGmmHelper(rootDeviceIndex); @@ -88,13 +84,10 @@ TEST_F(DrmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSpecialSshHeapCreate } TEST_F(DrmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAllocationCreatedInPreferredPoolThenGpuBaseAddressIsSetToCorrectBaseAddress) { - AllocationData allocData = {}; - allocData.type = AllocationType::linearStream; - allocData.size = MemoryConstants::pageSize64k; - executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(device.get(), false); - AllocationProperties properties = {rootDeviceIndex, MemoryConstants::pageSize64k, AllocationType::linearStream, {}}; + DeviceBitfield localMemoryBitfield{1}; + AllocationProperties properties = {rootDeviceIndex, MemoryConstants::pageSize64k, AllocationType::linearStream, localMemoryBitfield}; auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(properties, nullptr); ASSERT_NE(nullptr, allocation); auto gmmHelper = memoryManager->getGmmHelper(rootDeviceIndex); diff --git a/shared/test/unit_test/os_interface/windows/wddm_special_heap_test.cpp b/shared/test/unit_test/os_interface/windows/wddm_special_heap_test.cpp index cddc362b5b..e767c4b72d 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_special_heap_test.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_special_heap_test.cpp @@ -127,10 +127,6 @@ TEST_F(WddmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAlloca TEST_F(WddmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSpecialSshHeapCreatedInDevicePoolThenGpuAddressIsSetToBindlessBaseAddress) { debugManager.flags.ForceLocalMemoryAccessMode.set(0); - AllocationData allocData = {}; - allocData.type = AllocationType::linearStream; - allocData.size = MemoryConstants::pageSize64k; - auto wddm = static_cast(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as()); wddm->callBaseMapGpuVa = true; @@ -150,16 +146,13 @@ TEST_F(WddmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSpecialSshHeapCreat } TEST_F(WddmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAllocationCreatedInPreferredPoolThenGpuBaseAddressIsSetToCorrectBaseAddress) { - AllocationData allocData = {}; - allocData.type = AllocationType::linearStream; - allocData.size = MemoryConstants::pageSize64k; - memManager = new FrontWindowMemManagerMock(true, true, *executionEnvironment); executionEnvironment->memoryManager.reset(memManager); executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(device.get(), false); - AllocationProperties properties = {0, MemoryConstants::pageSize64k, AllocationType::linearStream, {}}; + DeviceBitfield localMemoryBitfield{1}; + AllocationProperties properties = {0, MemoryConstants::pageSize64k, AllocationType::linearStream, localMemoryBitfield}; auto allocation = memManager->allocateGraphicsMemoryInPreferredPool(properties, nullptr); ASSERT_NE(nullptr, allocation); auto gmmHelper = memManager->getGmmHelper(0);