From 7dfe57e982ab703326aa63313ef9b32d4c75a0d9 Mon Sep 17 00:00:00 2001 From: "Venevtsev, Igor" Date: Thu, 18 Jul 2019 15:33:20 +0200 Subject: [PATCH] Always initialize SVM heap for Windows 32-bit build Related-To: NEO-2877 Change-Id: If576f57f8d69dc4ed4da11ede16fbdb2d0fcd286 Signed-off-by: Venevtsev, Igor --- runtime/os_interface/windows/wddm/wddm.cpp | 2 ++ runtime/os_interface/windows/wddm_memory_manager.cpp | 2 +- .../os_interface/windows/wddm_memory_manager_tests.cpp | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/os_interface/windows/wddm/wddm.cpp b/runtime/os_interface/windows/wddm/wddm.cpp index cfc17643a2..8dfa20a30c 100644 --- a/runtime/os_interface/windows/wddm/wddm.cpp +++ b/runtime/os_interface/windows/wddm/wddm.cpp @@ -793,6 +793,8 @@ bool Wddm::waitFromCpu(uint64_t lastFenceValue, const MonitoredFence &monitoredF void Wddm::initGfxPartition(GfxPartition &outGfxPartition) const { if (gfxPartition.SVM.Limit != 0) { outGfxPartition.heapInit(HeapIndex::HEAP_SVM, gfxPartition.SVM.Base, gfxPartition.SVM.Limit - gfxPartition.SVM.Base + 1); + } else if (is32bit) { + outGfxPartition.heapInit(HeapIndex::HEAP_SVM, 0x0ull, 4 * MemoryConstants::gigaByte); } outGfxPartition.heapInit(HeapIndex::HEAP_STANDARD, gfxPartition.Standard.Base, gfxPartition.Standard.Limit - gfxPartition.Standard.Base + 1); diff --git a/runtime/os_interface/windows/wddm_memory_manager.cpp b/runtime/os_interface/windows/wddm_memory_manager.cpp index d98f96ad29..333aab3763 100644 --- a/runtime/os_interface/windows/wddm_memory_manager.cpp +++ b/runtime/os_interface/windows/wddm_memory_manager.cpp @@ -496,7 +496,7 @@ bool WddmMemoryManager::createWddmAllocation(WddmAllocation *allocation, void *r bool WddmMemoryManager::mapGpuVaForOneHandleAllocation(WddmAllocation *allocation, const void *preferredGpuVirtualAddress) { D3DGPU_VIRTUAL_ADDRESS addressToMap = reinterpret_cast(preferredGpuVirtualAddress); - auto heapIndex = selectHeap(allocation, preferredGpuVirtualAddress != nullptr, executionEnvironment.isFullRangeSvm()); + auto heapIndex = selectHeap(allocation, preferredGpuVirtualAddress != nullptr, is32bit || executionEnvironment.isFullRangeSvm()); if (!executionEnvironment.isFullRangeSvm()) { addressToMap = 0u; } diff --git a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp index 74369f6236..0173bab9d7 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp @@ -1384,6 +1384,12 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithNoRegisteredOsContextsWh EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted()); } +TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerAnd32bitBuildThenSvmPartitionIsAlwaysInitialized) { + if (is32bit) { + EXPECT_EQ(memoryManager->gfxPartition.getHeapLimit(HeapIndex::HEAP_SVM), MemoryConstants::max32BitAddress); + } +} + TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenCallingIsMemoryBudgetExhaustedThenReturnFalse) { memoryManager->createAndRegisterOsContext(nullptr, aub_stream::ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); memoryManager->createAndRegisterOsContext(nullptr, aub_stream::ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);