From 81822e3716c7df9c0e61d0df1a129cc2840f631f Mon Sep 17 00:00:00 2001 From: Young Jin Yoon Date: Mon, 10 Jul 2023 18:22:39 +0000 Subject: [PATCH] refactor: rename pageSize2Mb to pageSize2M The previous name "pageSize2Mb" defined in shared/source/helpers/constant.h is inconsistent to other variable, i.e. pageSize64k. Furthermore, it's a bit misleading because the page size is defined in Megabytes (MB), not in Megabits (Mb). Related-to: NEO-7695 Signed-off-by: Young Jin Yoon --- .../sources/context/test_context.cpp | 8 ++-- ..._manager_allocate_in_device_pool_tests.cpp | 10 ++--- .../windows/wddm_memory_manager_tests.cpp | 10 ++--- shared/source/helpers/constants.h | 2 +- .../os_agnostic_memory_manager.cpp | 6 +-- .../os_interface/linux/drm_memory_manager.cpp | 10 ++--- shared/source/os_interface/linux/drm_neo.cpp | 2 +- shared/source/os_interface/linux/drm_neo.h | 2 +- shared/source/os_interface/product_helper.inl | 2 +- .../windows/wddm_memory_manager.cpp | 2 +- ..._manager_allocate_in_device_pool_tests.cpp | 2 +- .../memory_manager/storage_info_tests.cpp | 12 +++--- ...m_memory_manager_localmem_prelim_tests.cpp | 8 ++-- .../linux/drm_memory_manager_tests.cpp | 38 +++++++++---------- .../dg2/product_config_helper_tests_dg2.cpp | 2 +- 15 files changed, 58 insertions(+), 58 deletions(-) diff --git a/level_zero/core/test/unit_tests/sources/context/test_context.cpp b/level_zero/core/test/unit_tests/sources/context/test_context.cpp index d70740be3d..96894c748c 100644 --- a/level_zero/core/test/unit_tests/sources/context/test_context.cpp +++ b/level_zero/core/test/unit_tests/sources/context/test_context.cpp @@ -986,17 +986,17 @@ TEST_F(ContextTest, whenCallingQueryVirtualMemPageSizeCorrectAlignmentIsReturned EXPECT_EQ(ZE_RESULT_SUCCESS, res); EXPECT_EQ(pagesize, MemoryConstants::pageSize64k); - size = MemoryConstants::pageSize2Mb - 1000; + size = MemoryConstants::pageSize2M - 1000; pagesize = 0u; res = contextImp->queryVirtualMemPageSize(device, size, &pagesize); EXPECT_EQ(ZE_RESULT_SUCCESS, res); - EXPECT_EQ(pagesize, MemoryConstants::pageSize2Mb / 2); + EXPECT_EQ(pagesize, MemoryConstants::pageSize2M / 2); - size = MemoryConstants::pageSize2Mb + 1000; + size = MemoryConstants::pageSize2M + 1000; pagesize = 0u; res = contextImp->queryVirtualMemPageSize(device, size, &pagesize); EXPECT_EQ(ZE_RESULT_SUCCESS, res); - EXPECT_EQ(pagesize, MemoryConstants::pageSize2Mb); + EXPECT_EQ(pagesize, MemoryConstants::pageSize2M); res = contextImp->destroy(); EXPECT_EQ(ZE_RESULT_SUCCESS, res); diff --git a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_allocate_in_device_pool_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_allocate_in_device_pool_tests.cpp index d7e5986994..5c22071a5a 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_allocate_in_device_pool_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_allocate_in_device_pool_tests.cpp @@ -186,23 +186,23 @@ TEST_F(WddmMemoryManagerDevicePoolAlignmentTests, givenTooMuchMemoryWastedOn2MbA { const uint32_t alignedSize = 4 * MemoryConstants::megaByte; const uint32_t maxAmountOfWastedMemory = static_cast(alignedSize * threshold); - testAlignment(alignedSize, MemoryConstants::pageSize2Mb); - testAlignment(alignedSize - maxAmountOfWastedMemory + 1, MemoryConstants::pageSize2Mb); + testAlignment(alignedSize, MemoryConstants::pageSize2M); + testAlignment(alignedSize - maxAmountOfWastedMemory + 1, MemoryConstants::pageSize2M); testAlignment(alignedSize - maxAmountOfWastedMemory - 1, MemoryConstants::pageSize64k); } { const uint32_t alignedSize = 8 * MemoryConstants::megaByte; const uint32_t maxAmountOfWastedMemory = static_cast(alignedSize * threshold); - testAlignment(alignedSize, MemoryConstants::pageSize2Mb); - testAlignment(alignedSize - maxAmountOfWastedMemory + 1, MemoryConstants::pageSize2Mb); + testAlignment(alignedSize, MemoryConstants::pageSize2M); + testAlignment(alignedSize - maxAmountOfWastedMemory + 1, MemoryConstants::pageSize2M); testAlignment(alignedSize - maxAmountOfWastedMemory - 1, MemoryConstants::pageSize64k); } } TEST_F(WddmMemoryManagerDevicePoolAlignmentTests, givenBigAllocationWastingMaximumPossibleAmountOfMemorytWhenAllocationInDevicePoolIsCreatedThenStillUse2MbAlignment) { const uint32_t size = 200 * MemoryConstants::megaByte + 1; // almost entire 2MB page will be wasted - testAlignment(size, MemoryConstants::pageSize2Mb); + testAlignment(size, MemoryConstants::pageSize2M); } TEST_F(WddmMemoryManagerDevicePoolAlignmentTests, givenAtLeast2MbAllocationWhenAllocationInDevicePoolIsCreatedThenUse2MbAlignment) { diff --git a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp index 137025b6bc..fac112a199 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp @@ -2693,7 +2693,7 @@ TEST(WddmMemoryManager, givenLocalPointerPassedToIsCpuCopyRequiredThenFalseIsRet TEST_F(WddmMemoryManagerSimpleTest, whenWddmMemoryManagerIsCreatedThenAlignmentSelectorHasExpectedAlignments) { std::vector expectedAlignments = { - {MemoryConstants::pageSize2Mb, false, 0.1f, HeapIndex::TOTAL_HEAPS}, + {MemoryConstants::pageSize2M, false, 0.1f, HeapIndex::TOTAL_HEAPS}, {MemoryConstants::pageSize64k, true, AlignmentSelector::anyWastage, HeapIndex::TOTAL_HEAPS}, }; @@ -2719,7 +2719,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenCustomAlignmentWhenWddmMemoryManagerIsC { DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.set(MemoryConstants::megaByte); std::vector expectedAlignments = { - {MemoryConstants::pageSize2Mb, false, 0.1f, HeapIndex::TOTAL_HEAPS}, + {MemoryConstants::pageSize2M, false, 0.1f, HeapIndex::TOTAL_HEAPS}, {MemoryConstants::megaByte, false, AlignmentSelector::anyWastage, HeapIndex::TOTAL_HEAPS}, {MemoryConstants::pageSize64k, true, AlignmentSelector::anyWastage, HeapIndex::TOTAL_HEAPS}, }; @@ -2728,10 +2728,10 @@ TEST_F(WddmMemoryManagerSimpleTest, givenCustomAlignmentWhenWddmMemoryManagerIsC } { - DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.set(2 * MemoryConstants::pageSize2Mb); + DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.set(2 * MemoryConstants::pageSize2M); std::vector expectedAlignments = { - {2 * MemoryConstants::pageSize2Mb, false, AlignmentSelector::anyWastage, HeapIndex::TOTAL_HEAPS}, - {MemoryConstants::pageSize2Mb, false, 0.1f, HeapIndex::TOTAL_HEAPS}, + {2 * MemoryConstants::pageSize2M, false, AlignmentSelector::anyWastage, HeapIndex::TOTAL_HEAPS}, + {MemoryConstants::pageSize2M, false, 0.1f, HeapIndex::TOTAL_HEAPS}, {MemoryConstants::pageSize64k, true, AlignmentSelector::anyWastage, HeapIndex::TOTAL_HEAPS}, }; MockWddmMemoryManager memoryManager(true, true, executionEnvironment); diff --git a/shared/source/helpers/constants.h b/shared/source/helpers/constants.h index 1adcba82f3..0aedee99e5 100644 --- a/shared/source/helpers/constants.h +++ b/shared/source/helpers/constants.h @@ -37,7 +37,7 @@ inline constexpr size_t minBufferAlignment = 4; inline constexpr size_t cacheLineSize = 64; inline constexpr size_t pageSize = 4 * kiloByte; inline constexpr size_t pageSize64k = 64 * kiloByte; -inline constexpr size_t pageSize2Mb = 2 * megaByte; +inline constexpr size_t pageSize2M = 2 * megaByte; inline constexpr size_t preferredAlignment = pageSize; // alignment preferred for performance reasons, i.e. internal allocations inline constexpr size_t allocationAlignment = pageSize; // alignment required to gratify incoming pointer, i.e. passed host_ptr inline constexpr size_t slmWindowAlignment = 128 * kiloByte; diff --git a/shared/source/memory_manager/os_agnostic_memory_manager.cpp b/shared/source/memory_manager/os_agnostic_memory_manager.cpp index a9ae4e856f..919eb71e18 100644 --- a/shared/source/memory_manager/os_agnostic_memory_manager.cpp +++ b/shared/source/memory_manager/os_agnostic_memory_manager.cpp @@ -73,8 +73,8 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment auto alignment = allocationData.alignment; if (allocationData.type == AllocationType::SVM_CPU) { - alignment = MemoryConstants::pageSize2Mb; - sizeAligned = alignUp(allocationData.size, MemoryConstants::pageSize2Mb); + alignment = MemoryConstants::pageSize2M; + sizeAligned = alignUp(allocationData.size, MemoryConstants::pageSize2M); } if (GraphicsAllocation::isDebugSurfaceAllocationType(allocationData.type)) { @@ -577,7 +577,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool( adjustedAllocationData.alignment = MemoryConstants::pageSize64k; allocation = static_cast(allocate32BitGraphicsMemoryImpl(adjustedAllocationData, true)); } else if (allocationData.type == AllocationType::SVM_GPU) { - auto storage = allocateSystemMemory(allocationData.size, MemoryConstants::pageSize2Mb); + auto storage = allocateSystemMemory(allocationData.size, MemoryConstants::pageSize2M); auto canonizedGpuAddress = gmmHelper->canonize(reinterpret_cast(allocationData.hostPtr)); allocation = new MemoryAllocation(allocationData.rootDeviceIndex, numHandles, allocationData.type, storage, storage, canonizedGpuAddress, allocationData.size, counter, MemoryPool::LocalMemory, false, allocationData.flags.flushL3, maxOsContextCount); diff --git a/shared/source/os_interface/linux/drm_memory_manager.cpp b/shared/source/os_interface/linux/drm_memory_manager.cpp index 86d3583f8e..aa41e86599 100644 --- a/shared/source/os_interface/linux/drm_memory_manager.cpp +++ b/shared/source/os_interface/linux/drm_memory_manager.cpp @@ -61,11 +61,11 @@ DrmMemoryManager::DrmMemoryManager(gemCloseWorkerMode mode, alignmentSelector.addCandidateAlignment(MemoryConstants::pageSize64k, true, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD64KB); if (DebugManager.flags.AlignLocalMemoryVaTo2MB.get() != 0) { - alignmentSelector.addCandidateAlignment(MemoryConstants::pageSize2Mb, false, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB); + alignmentSelector.addCandidateAlignment(MemoryConstants::pageSize2M, false, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB); } const size_t customAlignment = static_cast(DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.get()); if (customAlignment > 0) { - const auto heapIndex = customAlignment >= MemoryConstants::pageSize2Mb ? HeapIndex::HEAP_STANDARD2MB : HeapIndex::HEAP_STANDARD64KB; + const auto heapIndex = customAlignment >= MemoryConstants::pageSize2M ? HeapIndex::HEAP_STANDARD2MB : HeapIndex::HEAP_STANDARD64KB; alignmentSelector.addCandidateAlignment(customAlignment, true, AlignmentSelector::anyWastage, heapIndex); } @@ -359,7 +359,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryWithAlignmentImpl(const A auto mmapAlignment = cAlignment; if (alignedStorageSize >= 2 * MemoryConstants::megaByte) { - mmapAlignment = MemoryConstants::pageSize2Mb; + mmapAlignment = MemoryConstants::pageSize2M; } auto drmAllocation = createAllocWithAlignment(allocationData, cSize, mmapAlignment, alignedStorageSize, alignedGpuAddress); @@ -511,8 +511,8 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(con auto offsetInPage = ptrDiff(allocationData.hostPtr, alignedPtr); auto rootDeviceIndex = allocationData.rootDeviceIndex; - alignedSize = alignUp(alignedSize, MemoryConstants::pageSize2Mb); - auto gpuVirtualAddress = acquireGpuRangeWithCustomAlignment(alignedSize, rootDeviceIndex, HeapIndex::HEAP_STANDARD, MemoryConstants::pageSize2Mb); + alignedSize = alignUp(alignedSize, MemoryConstants::pageSize2M); + auto gpuVirtualAddress = acquireGpuRangeWithCustomAlignment(alignedSize, rootDeviceIndex, HeapIndex::HEAP_STANDARD, MemoryConstants::pageSize2M); if (!gpuVirtualAddress) { return nullptr; } diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index fe5cbb01d7..1098f8ff8b 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -669,7 +669,7 @@ uint32_t Drm::getVirtualMemoryAddressSpace(uint32_t vmId) const { } void Drm::setNewResourceBoundToVM(BufferObject *bo, uint32_t vmHandleId) { - if (!this->rootDeviceEnvironment.getProductHelper().isTlbFlushRequired() && isAligned(bo->peekAddress(), MemoryConstants::pageSize2Mb)) { + if (!this->rootDeviceEnvironment.getProductHelper().isTlbFlushRequired() && isAligned(bo->peekAddress(), MemoryConstants::pageSize2M)) { return; } const auto &engines = this->rootDeviceEnvironment.executionEnvironment.memoryManager->getRegisteredEngines(bo->getRootDeviceIndex()); diff --git a/shared/source/os_interface/linux/drm_neo.h b/shared/source/os_interface/linux/drm_neo.h index e956ef57fc..0086aa7dcd 100644 --- a/shared/source/os_interface/linux/drm_neo.h +++ b/shared/source/os_interface/linux/drm_neo.h @@ -338,7 +338,7 @@ class Drm : public DriverModel { bool setPairAvailable = false; bool chunkingAvailable = false; uint32_t chunkingMode = 0; - uint32_t minimalChunkingSize = MemoryConstants::pageSize2Mb; + uint32_t minimalChunkingSize = MemoryConstants::pageSize2M; bool contextDebugSupported = false; bool pageFaultSupported = false; bool completionFenceSupported = false; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index ff356f3401..7db3eaef54 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -419,7 +419,7 @@ uint32_t ProductHelperHw::getThreadEuRatioForScratch(const HardwareI template size_t ProductHelperHw::getSvmCpuAlignment() const { - return MemoryConstants::pageSize2Mb; + return MemoryConstants::pageSize2M; } template diff --git a/shared/source/os_interface/windows/wddm_memory_manager.cpp b/shared/source/os_interface/windows/wddm_memory_manager.cpp index 2569775a64..ff7be8a254 100644 --- a/shared/source/os_interface/windows/wddm_memory_manager.cpp +++ b/shared/source/os_interface/windows/wddm_memory_manager.cpp @@ -62,7 +62,7 @@ WddmMemoryManager::WddmMemoryManager(ExecutionEnvironment &executionEnvironment) alignmentSelector.addCandidateAlignment(MemoryConstants::pageSize64k, true, AlignmentSelector::anyWastage); if (DebugManager.flags.AlignLocalMemoryVaTo2MB.get() != 0) { constexpr static float maxWastage2Mb = 0.1f; - alignmentSelector.addCandidateAlignment(MemoryConstants::pageSize2Mb, false, maxWastage2Mb); + alignmentSelector.addCandidateAlignment(MemoryConstants::pageSize2M, false, maxWastage2Mb); } const size_t customAlignment = static_cast(DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.get()); if (customAlignment > 0) { diff --git a/shared/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp b/shared/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp index 8b6560e732..7df3d1370e 100644 --- a/shared/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp +++ b/shared/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp @@ -778,7 +778,7 @@ struct MemoryManagerDirectSubmissionImplicitScalingTest : public ::testing::Test constexpr auto enableLocalMemory = true; memoryManager = std::make_unique(false, enableLocalMemory, *executionEnvironment); - memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(1u, MemoryConstants::pageSize2Mb); + memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(1u, MemoryConstants::pageSize2M); EXPECT_NE(0u, memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->getLeastOccupiedBank(allTilesMask)); } diff --git a/shared/test/unit_test/memory_manager/storage_info_tests.cpp b/shared/test/unit_test/memory_manager/storage_info_tests.cpp index 70d08f0d2a..3349ded2d6 100644 --- a/shared/test/unit_test/memory_manager/storage_info_tests.cpp +++ b/shared/test/unit_test/memory_manager/storage_info_tests.cpp @@ -567,7 +567,7 @@ TEST_F(MultiDeviceStorageInfoTest, givenSingleTileWhenCreatingStorageInfoForRing TEST_F(MultiDeviceStorageInfoTest, givenMultiTileWhenCreatingStorageInfoForSemaphoreBufferThenFirstBankIsSelectedEvenIfOtherTileIsLessOccupied) { constexpr uint32_t firstAvailableTileMask = 2u; - memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2Mb); + memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2M); EXPECT_NE(1u, memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->getLeastOccupiedBank(allTilesMask)); AffinityMaskHelper affinityMaskHelper{false}; @@ -586,7 +586,7 @@ TEST_F(MultiDeviceStorageInfoTest, givenMultiTileWhenCreatingStorageInfoForSemap TEST_F(MultiDeviceStorageInfoTest, givenMultiTileWhenCreatingStorageInfoForCommandBufferThenFirstBankIsSelectedEvenIfOtherTileIsLessOccupied) { constexpr uint32_t firstAvailableTileMask = 2u; - memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2Mb); + memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2M); EXPECT_NE(1u, memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->getLeastOccupiedBank(allTilesMask)); AffinityMaskHelper affinityMaskHelper{false}; @@ -605,7 +605,7 @@ TEST_F(MultiDeviceStorageInfoTest, givenMultiTileWhenCreatingStorageInfoForComma TEST_F(MultiDeviceStorageInfoTest, givenMultiTileWhenCreatingStorageInfoForRingBufferThenFirstBankIsSelectedEvenIfOtherTileIsLessOccupied) { constexpr uint32_t firstAvailableTileMask = 2u; - memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2Mb); + memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2M); EXPECT_NE(1u, memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->getLeastOccupiedBank(allTilesMask)); AffinityMaskHelper affinityMaskHelper{false}; @@ -627,7 +627,7 @@ TEST_F(MultiDeviceStorageInfoTest, givenDirectSubmissionForceLocalMemoryStorageD DebugManager.flags.DirectSubmissionForceLocalMemoryStorageMode.set(0); constexpr uint32_t firstAvailableTileMask = 2u; - memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2Mb); + memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2M); EXPECT_NE(1u, memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->getLeastOccupiedBank(allTilesMask)); AffinityMaskHelper affinityMaskHelper{false}; @@ -652,7 +652,7 @@ TEST_F(MultiDeviceStorageInfoTest, givenDirectSubmissionForceLocalMemoryStorageE DebugManager.flags.DirectSubmissionForceLocalMemoryStorageMode.set(1); constexpr uint32_t firstAvailableTileMask = 2u; - memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2Mb); + memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2M); EXPECT_NE(1u, memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->getLeastOccupiedBank(allTilesMask)); AffinityMaskHelper affinityMaskHelper{false}; @@ -682,7 +682,7 @@ TEST_F(MultiDeviceStorageInfoTest, givenDirectSubmissionForceLocalMemoryStorageE constexpr uint32_t firstAvailableTileMask = 2u; constexpr uint32_t leastOccupiedTileMask = 4u; - memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2Mb); + memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(firstAvailableTileMask, MemoryConstants::pageSize2M); EXPECT_NE(1u, memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->getLeastOccupiedBank(allTilesMask)); AffinityMaskHelper affinityMaskHelper{false}; diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_manager_localmem_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_manager_localmem_prelim_tests.cpp index cd7004edd5..fc6068b52a 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_manager_localmem_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_manager_localmem_prelim_tests.cpp @@ -1247,8 +1247,8 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS EXPECT_NE(allocation, nullptr); auto drmAllocation = static_cast(allocation); - EXPECT_EQ(ptr, alignUp(drmAllocation->getMmapPtr(), MemoryConstants::pageSize2Mb)); - EXPECT_EQ(size, drmAllocation->getMmapSize() - MemoryConstants::pageSize2Mb); + EXPECT_EQ(ptr, alignUp(drmAllocation->getMmapPtr(), MemoryConstants::pageSize2M)); + EXPECT_EQ(size, drmAllocation->getMmapSize() - MemoryConstants::pageSize2M); auto &bos = drmAllocation->getBOs(); EXPECT_EQ(2u, bos.size()); @@ -1294,8 +1294,8 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCreateKmdMigratedSharedAlloca EXPECT_NE(allocation, nullptr); auto drmAllocation = static_cast(allocation); - EXPECT_EQ(ptr, alignUp(drmAllocation->getMmapPtr(), MemoryConstants::pageSize2Mb)); - EXPECT_EQ(size, drmAllocation->getMmapSize() - MemoryConstants::pageSize2Mb); + EXPECT_EQ(ptr, alignUp(drmAllocation->getMmapPtr(), MemoryConstants::pageSize2M)); + EXPECT_EQ(size, drmAllocation->getMmapSize() - MemoryConstants::pageSize2M); auto &bos = drmAllocation->getBOs(); EXPECT_EQ(1u, bos.size()); diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index 073077351f..0efc2a889c 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -3057,8 +3057,8 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor auto allocation = static_cast(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData)); EXPECT_EQ(static_cast(allocation)->getBO()->peekAddress(), castToUint64(allocation->getReservedAddressPtr())); - EXPECT_TRUE(isAligned(static_cast(allocation)->getBO()->peekAddress())); - EXPECT_TRUE(isAligned(allocation->getReservedAddressSize())); + EXPECT_TRUE(isAligned(static_cast(allocation)->getBO()->peekAddress())); + EXPECT_TRUE(isAligned(allocation->getReservedAddressSize())); memoryManager->freeGraphicsMemory(allocation); } @@ -4490,7 +4490,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenAffinityMaskDeviceWith TEST_F(DrmMemoryManagerTest, whenWddmMemoryManagerIsCreatedThenAlignmentSelectorHasExpectedAlignments) { std::vector expectedAlignments = { - {MemoryConstants::pageSize2Mb, false, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB}, + {MemoryConstants::pageSize2M, false, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB}, {MemoryConstants::pageSize64k, true, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD64KB}, }; @@ -4526,7 +4526,7 @@ TEST_F(DrmMemoryManagerTest, givenCustomAlignmentWhenWddmMemoryManagerIsCreatedT { DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.set(MemoryConstants::megaByte); std::vector expectedAlignments = { - {MemoryConstants::pageSize2Mb, false, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB}, + {MemoryConstants::pageSize2M, false, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB}, {MemoryConstants::megaByte, true, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD64KB}, {MemoryConstants::pageSize64k, true, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD64KB}, }; @@ -4535,10 +4535,10 @@ TEST_F(DrmMemoryManagerTest, givenCustomAlignmentWhenWddmMemoryManagerIsCreatedT } { - DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.set(2 * MemoryConstants::pageSize2Mb); + DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.set(2 * MemoryConstants::pageSize2M); std::vector expectedAlignments = { - {2 * MemoryConstants::pageSize2Mb, true, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB}, - {MemoryConstants::pageSize2Mb, false, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB}, + {2 * MemoryConstants::pageSize2M, true, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB}, + {MemoryConstants::pageSize2M, false, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD2MB}, {MemoryConstants::pageSize64k, true, AlignmentSelector::anyWastage, HeapIndex::HEAP_STANDARD64KB}, }; TestedDrmMemoryManager memoryManager(false, false, false, *executionEnvironment); @@ -5291,7 +5291,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success; AllocationData allocData; allocData.allFlags = 0; - allocData.size = MemoryConstants::pageSize2Mb; + allocData.size = MemoryConstants::pageSize2M; allocData.type = AllocationType::BUFFER; allocData.rootDeviceIndex = rootDeviceIndex; allocData.storageInfo.memoryBanks = 0b11; @@ -5315,7 +5315,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success; AllocationData allocData; allocData.allFlags = 0; - allocData.size = MemoryConstants::pageSize2Mb; + allocData.size = MemoryConstants::pageSize2M; allocData.type = AllocationType::BUFFER; allocData.rootDeviceIndex = rootDeviceIndex; allocData.storageInfo.memoryBanks = 0b11; @@ -5337,7 +5337,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success; AllocationData allocData; allocData.allFlags = 0; - allocData.size = MemoryConstants::pageSize2Mb; + allocData.size = MemoryConstants::pageSize2M; allocData.type = AllocationType::BUFFER; allocData.rootDeviceIndex = rootDeviceIndex; allocData.storageInfo.memoryBanks = 0b11; @@ -5362,7 +5362,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success; AllocationData allocData; allocData.allFlags = 0; - allocData.size = MemoryConstants::pageSize2Mb; + allocData.size = MemoryConstants::pageSize2M; allocData.type = AllocationType::BUFFER; allocData.rootDeviceIndex = rootDeviceIndex; allocData.storageInfo.memoryBanks = 0b11; @@ -5406,7 +5406,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success; AllocationData allocData; allocData.allFlags = 0; - allocData.size = MemoryConstants::pageSize2Mb; + allocData.size = MemoryConstants::pageSize2M; allocData.type = AllocationType::BUFFER; allocData.rootDeviceIndex = rootDeviceIndex; allocData.storageInfo.memoryBanks = 0b11; @@ -5859,7 +5859,7 @@ TEST_F(DrmMemoryManagerLocalMemoryAlignmentTest, given2MbAlignmentAllowedWhenAll ASSERT_NE(nullptr, allocation); EXPECT_EQ(MemoryManager::AllocationStatus::Success, allocationStatus); EXPECT_TRUE(isAllocationWithinHeap(*memoryManager, *allocation, HeapIndex::HEAP_STANDARD2MB)); - EXPECT_TRUE(isAligned(allocation->getGpuAddress(), MemoryConstants::pageSize2Mb)); + EXPECT_TRUE(isAligned(allocation->getGpuAddress(), MemoryConstants::pageSize2M)); memoryManager->freeGraphicsMemory(allocation); } } @@ -5884,7 +5884,7 @@ TEST_F(DrmMemoryManagerLocalMemoryAlignmentTest, givenExtendedHeapPreferredAnd2M auto allocation = memoryManager->allocateGraphicsMemoryInDevicePool(allocationData, allocationStatus); ASSERT_NE(nullptr, allocation); EXPECT_EQ(MemoryManager::AllocationStatus::Success, allocationStatus); - EXPECT_TRUE(isAligned(allocation->getGpuAddress(), MemoryConstants::pageSize2Mb)); + EXPECT_TRUE(isAligned(allocation->getGpuAddress(), MemoryConstants::pageSize2M)); EXPECT_TRUE(isAllocationWithinHeap(*memoryManager, *allocation, HeapIndex::HEAP_EXTENDED)); memoryManager->freeGraphicsMemory(allocation); } @@ -5904,7 +5904,7 @@ TEST_F(DrmMemoryManagerLocalMemoryAlignmentTest, givenExtendedHeapPreferredAnd2M ASSERT_NE(nullptr, allocation); EXPECT_EQ(MemoryManager::AllocationStatus::Success, allocationStatus); EXPECT_TRUE(isAllocationWithinHeap(*memoryManager, *allocation, HeapIndex::HEAP_EXTENDED)); - EXPECT_TRUE(isAligned(allocation->getGpuAddress(), MemoryConstants::pageSize2Mb)); + EXPECT_TRUE(isAligned(allocation->getGpuAddress(), MemoryConstants::pageSize2M)); memoryManager->freeGraphicsMemory(allocation); } } @@ -6244,7 +6244,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenOversize } auto largerSize = 6 * MemoryConstants::megaByte; - auto gpuAddress0 = memoryManager->getGfxPartition(rootDeviceIndex)->heapAllocateWithCustomAlignment(heap, largerSize, MemoryConstants::pageSize2Mb); + auto gpuAddress0 = memoryManager->getGfxPartition(rootDeviceIndex)->heapAllocateWithCustomAlignment(heap, largerSize, MemoryConstants::pageSize2M); EXPECT_NE(0u, gpuAddress0); EXPECT_EQ(6 * MemoryConstants::megaByte, largerSize); auto gpuAddress1 = memoryManager->getGfxPartition(rootDeviceIndex)->heapAllocate(heap, largerSize); @@ -6296,7 +6296,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenAllocati ASSERT_NE(nullptr, allocation2); EXPECT_EQ(allocData.size, allocation2->getUnderlyingBufferSize()); EXPECT_EQ(allocData.size, static_cast(allocation2)->getBO()->peekSize()); - EXPECT_TRUE(allocation2->getGpuAddress() % MemoryConstants::pageSize2Mb == 0u); + EXPECT_TRUE(allocation2->getGpuAddress() % MemoryConstants::pageSize2M == 0u); memoryManager->freeGraphicsMemory(allocation); memoryManager->freeGraphicsMemory(allocation2); @@ -6321,7 +6321,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenDebugVar ASSERT_NE(nullptr, allocation); EXPECT_EQ(allocData.size, allocation->getUnderlyingBufferSize()); EXPECT_EQ(allocData.size, static_cast(allocation)->getBO()->peekSize()); - EXPECT_TRUE(allocation->getGpuAddress() % MemoryConstants::pageSize2Mb == 0u); + EXPECT_TRUE(allocation->getGpuAddress() % MemoryConstants::pageSize2M == 0u); size = 32 * MemoryConstants::megaByte; allocData.size = size; @@ -6330,7 +6330,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenDebugVar ASSERT_NE(nullptr, allocation2); EXPECT_EQ(allocData.size, allocation2->getUnderlyingBufferSize()); EXPECT_EQ(allocData.size, static_cast(allocation2)->getBO()->peekSize()); - EXPECT_TRUE(allocation2->getGpuAddress() % MemoryConstants::pageSize2Mb == 0u); + EXPECT_TRUE(allocation2->getGpuAddress() % MemoryConstants::pageSize2M == 0u); memoryManager->freeGraphicsMemory(allocation); memoryManager->freeGraphicsMemory(allocation2); diff --git a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp index d1b35f5fb6..04f5b5df77 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp @@ -507,7 +507,7 @@ DG2TEST_F(ProductHelperTestDg2, givenDg2WhenIsBlitterForImagesSupportedIsCalledT DG2TEST_F(ProductHelperTestDg2, WhenGetSvmCpuAlignmentThenProperValueIsReturned) { - EXPECT_EQ(MemoryConstants::pageSize2Mb, productHelper->getSvmCpuAlignment()); + EXPECT_EQ(MemoryConstants::pageSize2M, productHelper->getSvmCpuAlignment()); } DG2TEST_F(ProductHelperTestDg2, givenB0rCSteppingWhenAskingIfTile64With3DSurfaceOnBCSIsSupportedThenReturnTrue) {