From bfd7067c1a34bace4397d621a4e3c648adc04fe1 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Fri, 12 May 2023 09:38:22 +0000 Subject: [PATCH] fix: create global and constant surface as lockable resource Signed-off-by: Mateusz Jablonski --- shared/source/os_interface/windows/wddm_memory_manager.cpp | 2 ++ shared/test/unit_test/program/program_initialization_tests.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/shared/source/os_interface/windows/wddm_memory_manager.cpp b/shared/source/os_interface/windows/wddm_memory_manager.cpp index 83d2c0dfab..cf8ddebb84 100644 --- a/shared/source/os_interface/windows/wddm_memory_manager.cpp +++ b/shared/source/os_interface/windows/wddm_memory_manager.cpp @@ -98,6 +98,7 @@ GraphicsAllocation *WddmMemoryManager::allocatePhysicalDeviceMemory(const Alloca auto &productHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHelper(); StorageInfo systemMemoryStorageInfo = {}; + systemMemoryStorageInfo.isLockable = allocationData.storageInfo.isLockable; auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), nullptr, allocationData.size, 0u, CacheSettingsHelper::getGmmUsageType(allocationData.type, !!allocationData.flags.uncacheable, productHelper), false, systemMemoryStorageInfo, true); auto allocation = std::make_unique(allocationData.rootDeviceIndex, @@ -121,6 +122,7 @@ GraphicsAllocation *WddmMemoryManager::allocateMemoryByKMD(const AllocationData auto &productHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHelper(); StorageInfo systemMemoryStorageInfo = {}; + systemMemoryStorageInfo.isLockable = allocationData.storageInfo.isLockable; auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), allocationData.hostPtr, allocationData.size, 0u, CacheSettingsHelper::getGmmUsageType(allocationData.type, !!allocationData.flags.uncacheable, productHelper), false, systemMemoryStorageInfo, true); auto allocation = std::make_unique(allocationData.rootDeviceIndex, diff --git a/shared/test/unit_test/program/program_initialization_tests.cpp b/shared/test/unit_test/program/program_initialization_tests.cpp index cb1634c6ab..486745b89c 100644 --- a/shared/test/unit_test/program/program_initialization_tests.cpp +++ b/shared/test/unit_test/program/program_initialization_tests.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/compiler_interface/external_functions.h" +#include "shared/source/gmm_helper/gmm.h" #include "shared/source/helpers/blit_helper.h" #include "shared/source/helpers/local_memory_access_modes.h" #include "shared/source/program/program_initialization.h" @@ -86,6 +87,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreExportedThenM EXPECT_TRUE(alloc->isMemObjectsAllocationWithWritableFlags()); EXPECT_EQ(DEVICE_UNIFIED_MEMORY, svmAllocsManager.getSVMAlloc(reinterpret_cast(alloc->getGpuAddress()))->memoryType); EXPECT_EQ(AllocationType::CONSTANT_SURFACE, alloc->getAllocationType()); + EXPECT_FALSE(alloc->getDefaultGmm()->resourceParams.Flags.Info.NotLockable); svmAllocsManager.freeSVMAlloc(reinterpret_cast(static_cast(alloc->getGpuAddress()))); alloc = allocateGlobalsSurface(&svmAllocsManager, device, initData.size(), 0u, true /* constant */, &linkerInputExportGlobalVariables, initData.data()); @@ -112,6 +114,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreExportedThenM EXPECT_TRUE(alloc->isMemObjectsAllocationWithWritableFlags()); EXPECT_EQ(DEVICE_UNIFIED_MEMORY, svmAllocsManager.getSVMAlloc(reinterpret_cast(alloc->getGpuAddress()))->memoryType); EXPECT_EQ(AllocationType::GLOBAL_SURFACE, alloc->getAllocationType()); + EXPECT_FALSE(alloc->getDefaultGmm()->resourceParams.Flags.Info.NotLockable); svmAllocsManager.freeSVMAlloc(reinterpret_cast(static_cast(alloc->getGpuAddress()))); }