From f5e37e725cc47cae174cafb29a82c57b7f8fa657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Zwoli=C5=84ski?= Date: Mon, 10 Mar 2025 09:58:21 +0000 Subject: [PATCH] Revert "fix: configure ISA Pool params based on productHelper" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit bf20ae7ae82a468801a921f4d2e01b9d4b92eb0b. Signed-off-by: Fabian ZwoliƄski --- level_zero/core/source/module/module_imp.cpp | 18 +----- level_zero/core/source/module/module_imp.h | 1 - .../core/test/unit_tests/mocks/mock_module.h | 2 - .../unit_tests/sources/module/test_module.cpp | 40 ++----------- .../mem_obj/buffer_pool_alloc_tests.cpp | 6 +- .../unit_test/program/kernel_info_tests.cpp | 57 ------------------- .../os_interface/linux/drm_memory_manager.cpp | 18 +++--- shared/source/program/kernel_info.cpp | 3 +- .../source/utilities/isa_pool_allocator.cpp | 24 +------- shared/source/utilities/isa_pool_allocator.h | 4 +- .../test/common/mocks/mock_memory_manager.cpp | 5 +- .../test/common/mocks/mock_memory_manager.h | 2 - .../linux/drm_memory_manager_tests.cpp | 33 ----------- .../utilities/isa_pool_allocator_tests.cpp | 35 ------------ 14 files changed, 22 insertions(+), 226 deletions(-) diff --git a/level_zero/core/source/module/module_imp.cpp b/level_zero/core/source/module/module_imp.cpp index 75dfe5dee5..f09378421b 100644 --- a/level_zero/core/source/module/module_imp.cpp +++ b/level_zero/core/source/module/module_imp.cpp @@ -503,9 +503,10 @@ void ModuleTranslationUnit::processDebugData() { ModuleImp::ModuleImp(Device *device, ModuleBuildLog *moduleBuildLog, ModuleType type) : device(device), translationUnit(std::make_unique(device)), moduleBuildLog(moduleBuildLog), type(type) { + auto &gfxCoreHelper = device->getGfxCoreHelper(); auto &hwInfo = device->getHwInfo(); + this->isaAllocationPageSize = gfxCoreHelper.useSystemMemoryPlacementForISA(hwInfo) ? MemoryConstants::pageSize : MemoryConstants::pageSize64k; this->productFamily = hwInfo.platform.eProductFamily; - this->isaAllocationPageSize = getIsaAllocationPageSize(); } ModuleImp::~ModuleImp() { @@ -1720,19 +1721,4 @@ NEO::GraphicsAllocation *ModuleImp::getKernelsIsaParentAllocation() const { return sharedIsaAllocation->getGraphicsAllocation(); } -size_t ModuleImp::getIsaAllocationPageSize() const { - auto &gfxCoreHelper = device->getGfxCoreHelper(); - auto &hwInfo = device->getHwInfo(); - - if (gfxCoreHelper.useSystemMemoryPlacementForISA(hwInfo)) { - return MemoryConstants::pageSize; - } - - if (device->getProductHelper().is2MBLocalMemAlignmentEnabled()) { - return MemoryConstants::pageSize2M; - } else { - return MemoryConstants::pageSize64k; - } -} - } // namespace L0 diff --git a/level_zero/core/source/module/module_imp.h b/level_zero/core/source/module/module_imp.h index 19b313b169..84e973ca9b 100644 --- a/level_zero/core/source/module/module_imp.h +++ b/level_zero/core/source/module/module_imp.h @@ -190,7 +190,6 @@ struct ModuleImp : public Module { MOCKABLE_VIRTUAL size_t computeKernelIsaAllocationAlignedSizeWithPadding(size_t isaSize, bool lastKernel); MOCKABLE_VIRTUAL NEO::GraphicsAllocation *allocateKernelsIsaMemory(size_t size); StackVec getModuleAllocations(); - size_t getIsaAllocationPageSize() const; Device *device = nullptr; PRODUCT_FAMILY productFamily{}; diff --git a/level_zero/core/test/unit_tests/mocks/mock_module.h b/level_zero/core/test/unit_tests/mocks/mock_module.h index ba838b54c7..5ef04fc817 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_module.h +++ b/level_zero/core/test/unit_tests/mocks/mock_module.h @@ -58,7 +58,6 @@ struct WhiteBox<::L0::Module> : public ::L0::ModuleImp { using BaseClass::copyPatchedSegments; using BaseClass::device; using BaseClass::exportedFunctionsSurface; - using BaseClass::getIsaAllocationPageSize; using BaseClass::importedSymbolAllocations; using BaseClass::isaSegmentsForPatching; using BaseClass::isFullyLinked; @@ -112,7 +111,6 @@ struct MockModule : public L0::ModuleImp { using ModuleImp::allocateKernelsIsaMemory; using ModuleImp::computeKernelIsaAllocationAlignedSizeWithPadding; using ModuleImp::debugModuleHandle; - using ModuleImp::getIsaAllocationPageSize; using ModuleImp::getModuleAllocations; using ModuleImp::initializeKernelImmutableDatas; using ModuleImp::isaAllocationPageSize; diff --git a/level_zero/core/test/unit_tests/sources/module/test_module.cpp b/level_zero/core/test/unit_tests/sources/module/test_module.cpp index 14142a6deb..626ddb9580 100644 --- a/level_zero/core/test/unit_tests/sources/module/test_module.cpp +++ b/level_zero/core/test/unit_tests/sources/module/test_module.cpp @@ -34,7 +34,6 @@ #include "shared/test/common/mocks/mock_l0_debugger.h" #include "shared/test/common/mocks/mock_memory_operations_handler.h" #include "shared/test/common/mocks/mock_modules_zebin.h" -#include "shared/test/common/mocks/mock_product_helper.h" #include "shared/test/common/test_macros/hw_test.h" #include "level_zero/core/source/kernel/kernel_imp.h" @@ -175,6 +174,7 @@ HWTEST_F(ModuleTest, givenUserModuleWhenCreatedThenCorrectAllocationTypeIsUsedFo template struct ModuleKernelIsaAllocationsFixture : public ModuleFixture { + static constexpr size_t isaAllocationPageSize = (localMemEnabled ? MemoryConstants::pageSize64k : MemoryConstants::pageSize); using Module = WhiteBox<::L0::Module>; void setUp() { @@ -209,7 +209,7 @@ struct ModuleKernelIsaAllocationsFixture : public ModuleFixture { void givenSeparateIsaMemoryRegionPerKernelWhenGraphicsAllocationFailsThenProperErrorReturned() { mockModule->allocateKernelsIsaMemoryCallBase = false; mockModule->computeKernelIsaAllocationAlignedSizeWithPaddingCallBase = false; - mockModule->computeKernelIsaAllocationAlignedSizeWithPaddingResult = this->mockModule->getIsaAllocationPageSize(); + mockModule->computeKernelIsaAllocationAlignedSizeWithPaddingResult = isaAllocationPageSize; auto result = module->initialize(&this->moduleDesc, device->getNEODevice()); EXPECT_EQ(result, ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY); @@ -793,35 +793,6 @@ HWTEST_F(ModuleTest, whenMultipleModulesCreatedThenModulesShareIsaAllocation) { } }; -TEST_F(ModuleTest, GivenLocalMemoryEnabledOrDisabledAnd2MBAlignmentEnabledOrDisabledWhenGettingIsaAllocationPageSizeThenCorrectValueIsReturned) { - DebugManagerStateRestore restorer; - auto mockProductHelper = new MockProductHelper; - - device->getNEODevice()->getRootDeviceEnvironmentRef().productHelper.reset(mockProductHelper); - - MockModule mockModule{device, nullptr, ModuleType::user}; - EXPECT_EQ(mockModule.getIsaAllocationPageSize(), mockModule.isaAllocationPageSize); - - { - debugManager.flags.EnableLocalMemory.set(0); - mockProductHelper->is2MBLocalMemAlignmentEnabledResult = true; - - EXPECT_EQ(MemoryConstants::pageSize, mockModule.getIsaAllocationPageSize()); - } - { - debugManager.flags.EnableLocalMemory.set(1); - mockProductHelper->is2MBLocalMemAlignmentEnabledResult = true; - - EXPECT_EQ(MemoryConstants::pageSize2M, mockModule.getIsaAllocationPageSize()); - } - { - debugManager.flags.EnableLocalMemory.set(1); - mockProductHelper->is2MBLocalMemAlignmentEnabledResult = false; - - EXPECT_EQ(MemoryConstants::pageSize64k, mockModule.getIsaAllocationPageSize()); - } -} - template struct ModuleSpecConstantsFixture : public DeviceFixture { void setUp() { @@ -4077,6 +4048,7 @@ TEST_F(ModuleTest, whenContainsStatefulAccessIsCalledThenResultIsCorrect) { template struct ModuleIsaAllocationsFixture : public DeviceFixture { + static constexpr size_t isaAllocationPageSize = (localMemEnabled ? MemoryConstants::pageSize64k : MemoryConstants::pageSize); static constexpr NEO::MemoryPool isaAllocationMemoryPool = (localMemEnabled ? NEO::MemoryPool::localMemory : NEO::MemoryPool::system4KBPagesWith32BitGpuAddressing); void setUp() { @@ -4092,7 +4064,6 @@ struct ModuleIsaAllocationsFixture : public DeviceFixture { this->mockMemoryManager->localMemorySupported[this->neoDevice->getRootDeviceIndex()] = true; this->mockModule.reset(new MockModule{this->device, nullptr, ModuleType::user}); this->mockModule->translationUnit.reset(new MockModuleTranslationUnit{this->device}); - this->isaAllocationPageSize = this->mockModule->getIsaAllocationPageSize(); } void tearDown() { @@ -4148,8 +4119,8 @@ struct ModuleIsaAllocationsFixture : public DeviceFixture { EXPECT_EQ(kernelImmDatas[1]->getIsaOffsetInParentAllocation(), 0lu); EXPECT_EQ(kernelImmDatas[1]->getIsaSubAllocationSize(), 0lu); if constexpr (localMemEnabled) { - EXPECT_EQ(alignUp(maxAllocationSizeInPage, MemoryConstants::pageSize64k), kernelImmDatas[0]->getIsaSize()); - EXPECT_EQ(alignUp(tinyAllocationSize, MemoryConstants::pageSize64k), kernelImmDatas[1]->getIsaSize()); + EXPECT_EQ(isaAllocationPageSize, kernelImmDatas[0]->getIsaSize()); + EXPECT_EQ(isaAllocationPageSize, kernelImmDatas[1]->getIsaSize()); } else { EXPECT_EQ(this->computeKernelIsaAllocationSizeWithPadding(maxAllocationSizeInPage), kernelImmDatas[0]->getIsaSize()); EXPECT_EQ(this->computeKernelIsaAllocationSizeWithPadding(tinyAllocationSize), kernelImmDatas[1]->getIsaSize()); @@ -4196,7 +4167,6 @@ struct ModuleIsaAllocationsFixture : public DeviceFixture { size_t isaPadding; size_t kernelStartPointerAlignment; - size_t isaAllocationPageSize; NEO::Device *neoDevice = nullptr; MockMemoryManager *mockMemoryManager = nullptr; std::unique_ptr mockModule = nullptr; diff --git a/opencl/test/unit_test/mem_obj/buffer_pool_alloc_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_pool_alloc_tests.cpp index 5d55bedfc2..5153f4bac3 100644 --- a/opencl/test/unit_test/mem_obj/buffer_pool_alloc_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_pool_alloc_tests.cpp @@ -200,9 +200,9 @@ TEST_F(AggregatedSmallBuffersEnabledTest, givenAggregatedSmallBuffersEnabledWhen EXPECT_TRUE(poolAllocator->isAggregatedSmallBuffersEnabled(context.get())); EXPECT_EQ(1u, poolAllocator->bufferPools.size()); EXPECT_NE(nullptr, poolAllocator->bufferPools[0].mainStorage.get()); - EXPECT_NE(nullptr, mockMemoryManager->lastAllocationPropertiesWithPtr); - EXPECT_TRUE(mockMemoryManager->lastAllocationPropertiesWithPtr->makeDeviceBufferLockable); - EXPECT_FALSE(mockMemoryManager->lastAllocationPropertiesWithPtr->flags.preferCompressed); + EXPECT_NE(nullptr, mockMemoryManager->lastAllocationProperties); + EXPECT_TRUE(mockMemoryManager->lastAllocationProperties->makeDeviceBufferLockable); + EXPECT_FALSE(mockMemoryManager->lastAllocationProperties->flags.preferCompressed); } TEST_F(AggregatedSmallBuffersEnabledTest, givenAggregatedSmallBuffersEnabledAndSizeLargerThanThresholdWhenBufferCreateCalledThenDoNotUsePool) { diff --git a/opencl/test/unit_test/program/kernel_info_tests.cpp b/opencl/test/unit_test/program/kernel_info_tests.cpp index 704e4bedc7..ac0e10a87d 100644 --- a/opencl/test/unit_test/program/kernel_info_tests.cpp +++ b/opencl/test/unit_test/program/kernel_info_tests.cpp @@ -10,7 +10,6 @@ #include "shared/source/program/kernel_info.h" #include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/mocks/mock_graphics_allocation.h" -#include "shared/test/common/mocks/mock_product_helper.h" #include "shared/test/common/mocks/mock_sip.h" #include "shared/test/common/mocks/ult_device_factory.h" @@ -85,62 +84,6 @@ TEST(KernelInfoTest, givenKernelInfoWhenCreatingKernelAllocationWithInternalIsaT device->getMemoryManager()->checkGpuUsageAndDestroyGraphicsAllocations(allocation); } -TEST(KernelInfoTest, Given2MBAlignmentEnabledByProductHelperWhenCreatingKernelAllocationThenAllocationPropertiesAlignmentIsSetTo2M) { - DebugManagerStateRestore restorer; - - KernelInfo kernelInfo; - auto factory = UltDeviceFactory{1, 0}; - auto device = factory.rootDevices[0]; - const size_t heapSize = 0x40; - char heap[heapSize]; - kernelInfo.heapInfo.kernelHeapSize = heapSize; - kernelInfo.heapInfo.pKernelHeap = &heap; - - auto mockProductHelper = new MockProductHelper; - device->getRootDeviceEnvironmentRef().productHelper.reset(mockProductHelper); - mockProductHelper->is2MBLocalMemAlignmentEnabledResult = true; - debugManager.flags.AlignLocalMemoryVaTo2MB.set(0); - - auto mockMemoryManager = static_cast(device->getMemoryManager()); - mockMemoryManager->shouldStoreLastAllocationProperties = true; - - auto retVal = kernelInfo.createKernelAllocation(*device, false); - EXPECT_TRUE(retVal); - - ASSERT_NE(nullptr, mockMemoryManager->lastAllocationProperties); - EXPECT_EQ(MemoryConstants::pageSize2M, mockMemoryManager->lastAllocationProperties->alignment); - - device->getMemoryManager()->checkGpuUsageAndDestroyGraphicsAllocations(kernelInfo.kernelAllocation); -} - -TEST(KernelInfoTest, Given2MBAlignmentForcedByDebugFlagWhenCreatingKernelAllocationThenAllocationPropertiesAlignmentIsSetTo2M) { - DebugManagerStateRestore restorer; - - KernelInfo kernelInfo; - auto factory = UltDeviceFactory{1, 0}; - auto device = factory.rootDevices[0]; - const size_t heapSize = 0x40; - char heap[heapSize]; - kernelInfo.heapInfo.kernelHeapSize = heapSize; - kernelInfo.heapInfo.pKernelHeap = &heap; - - auto mockProductHelper = new MockProductHelper; - device->getRootDeviceEnvironmentRef().productHelper.reset(mockProductHelper); - mockProductHelper->is2MBLocalMemAlignmentEnabledResult = false; - debugManager.flags.AlignLocalMemoryVaTo2MB.set(1); - - auto mockMemoryManager = static_cast(device->getMemoryManager()); - mockMemoryManager->shouldStoreLastAllocationProperties = true; - - auto retVal = kernelInfo.createKernelAllocation(*device, false); - EXPECT_TRUE(retVal); - - ASSERT_NE(nullptr, mockMemoryManager->lastAllocationProperties); - EXPECT_EQ(MemoryConstants::pageSize2M, mockMemoryManager->lastAllocationProperties->alignment); - - device->getMemoryManager()->checkGpuUsageAndDestroyGraphicsAllocations(kernelInfo.kernelAllocation); -} - class MyMemoryManager : public OsAgnosticMemoryManager { public: using OsAgnosticMemoryManager::OsAgnosticMemoryManager; diff --git a/shared/source/os_interface/linux/drm_memory_manager.cpp b/shared/source/os_interface/linux/drm_memory_manager.cpp index 2273ed559f..4949c0fa56 100644 --- a/shared/source/os_interface/linux/drm_memory_manager.cpp +++ b/shared/source/os_interface/linux/drm_memory_manager.cpp @@ -1881,10 +1881,11 @@ void fillGmmsInAllocation(GmmHelper *gmmHelper, DrmAllocation *allocation) { } } -inline uint64_t getCanonizedHeapAllocationAddress(HeapIndex heap, GmmHelper *gmmHelper, GfxPartition *gfxPartition, size_t &sizeAllocated, size_t alignment, bool packed) { - if (const size_t customAlignment = static_cast(debugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.get()); - customAlignment > 0) { - alignment = customAlignment; +inline uint64_t getCanonizedHeapAllocationAddress(HeapIndex heap, GmmHelper *gmmHelper, GfxPartition *gfxPartition, size_t &sizeAllocated, bool packed) { + size_t alignment = 0; + + if (debugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.get() != -1) { + alignment = static_cast(debugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.get()); } auto address = gfxPartition->heapAllocateWithCustomAlignment(heap, sizeAllocated, alignment); return gmmHelper->canonize(address); @@ -1904,15 +1905,10 @@ AllocationStatus getGpuAddress(const AlignmentSelector &alignmentSelector, HeapA case AllocationType::kernelIsa: case AllocationType::kernelIsaInternal: case AllocationType::internalHeap: - case AllocationType::debugModuleArea: { - size_t alignment = 0; - if (gmmHelper->getRootDeviceEnvironment().getHelper().is2MBLocalMemAlignmentEnabled()) { - alignment = MemoryConstants::pageSize2M; - } + case AllocationType::debugModuleArea: gpuAddress = getCanonizedHeapAllocationAddress(heapAssigner.get32BitHeapIndex(allocType, true, hwInfo, allocationData.flags.use32BitFrontWindow), - gmmHelper, gfxPartition, sizeAllocated, alignment, false); + gmmHelper, gfxPartition, sizeAllocated, false); break; - } case AllocationType::writeCombined: sizeAllocated = 0; break; diff --git a/shared/source/program/kernel_info.cpp b/shared/source/program/kernel_info.cpp index e69f4bb760..2593afb067 100644 --- a/shared/source/program/kernel_info.cpp +++ b/shared/source/program/kernel_info.cpp @@ -62,8 +62,7 @@ bool KernelInfo::createKernelAllocation(const Device &device, bool internalIsa) AllocationProperties properties = {device.getRootDeviceIndex(), kernelIsaSize, allocType, device.getDeviceBitfield()}; - if (device.getProductHelper().is2MBLocalMemAlignmentEnabled() || - debugManager.flags.AlignLocalMemoryVaTo2MB.get() == 1) { + if (debugManager.flags.AlignLocalMemoryVaTo2MB.get() == 1) { properties.alignment = MemoryConstants::pageSize2M; } diff --git a/shared/source/utilities/isa_pool_allocator.cpp b/shared/source/utilities/isa_pool_allocator.cpp index 57d5749814..4f699afa62 100644 --- a/shared/source/utilities/isa_pool_allocator.cpp +++ b/shared/source/utilities/isa_pool_allocator.cpp @@ -8,7 +8,6 @@ #include "shared/source/utilities/isa_pool_allocator.h" #include "shared/source/device/device.h" -#include "shared/source/helpers/aligned_memory.h" #include "shared/source/memory_manager/allocation_properties.h" #include "shared/source/memory_manager/memory_manager.h" #include "shared/source/utilities/buffer_pool_allocator.inl" @@ -17,9 +16,6 @@ namespace NEO { ISAPool::ISAPool(Device *device, bool isBuiltin, size_t storageSize) : BaseType(device->getMemoryManager(), nullptr), device(device), isBuiltin(isBuiltin) { - DEBUG_BREAK_IF(device->getProductHelper().is2MBLocalMemAlignmentEnabled() && - !isAligned(storageSize, MemoryConstants::pageSize2M)); - this->chunkAllocator.reset(new NEO::HeapAllocator(params.startingOffset, storageSize, MemoryConstants::pageSize, 0u)); auto allocationType = isBuiltin ? NEO::AllocationType::kernelIsaInternal : NEO::AllocationType::kernelIsa; @@ -59,7 +55,6 @@ const StackVec &ISAPool::getAllocationsVector() { } ISAPoolAllocator::ISAPoolAllocator(Device *device) : device(device) { - initAllocParams(); } /** @@ -81,7 +76,7 @@ SharedIsaAllocation *ISAPoolAllocator::requestGraphicsAllocationForIsa(bool isBu auto maxAllocationSize = getAllocationSize(isBuiltin); if (size > maxAllocationSize) { - addNewBufferPool(ISAPool(device, isBuiltin, alignToPoolSize(size))); + addNewBufferPool(ISAPool(device, isBuiltin, size)); } auto sharedIsaAllocation = tryAllocateISA(isBuiltin, size); @@ -96,7 +91,7 @@ SharedIsaAllocation *ISAPoolAllocator::requestGraphicsAllocationForIsa(bool isBu return sharedIsaAllocation; } - addNewBufferPool(ISAPool(device, isBuiltin, alignToPoolSize(getAllocationSize(isBuiltin)))); + addNewBufferPool(ISAPool(device, isBuiltin, getAllocationSize(isBuiltin))); return tryAllocateISA(isBuiltin, size); } @@ -135,19 +130,4 @@ SharedIsaAllocation *ISAPoolAllocator::tryAllocateISA(bool isBuiltin, size_t siz return nullptr; } -void ISAPoolAllocator::initAllocParams() { - if (device->getProductHelper().is2MBLocalMemAlignmentEnabled()) { - userAllocationSize = MemoryConstants::pageSize2M * 2; - buitinAllocationSize = MemoryConstants::pageSize2M; - poolAlignment = MemoryConstants::pageSize2M; - } else { - userAllocationSize = MemoryConstants::pageSize2M * 2; - buitinAllocationSize = MemoryConstants::pageSize64k; - } -} - -size_t ISAPoolAllocator::alignToPoolSize(size_t size) const { - return alignUp(size, poolAlignment); -} - } // namespace NEO diff --git a/shared/source/utilities/isa_pool_allocator.h b/shared/source/utilities/isa_pool_allocator.h index a6b382d20c..fc42360cff 100644 --- a/shared/source/utilities/isa_pool_allocator.h +++ b/shared/source/utilities/isa_pool_allocator.h @@ -73,17 +73,15 @@ class ISAPoolAllocator : public AbstractBuffersAllocator(ptr), dummyAddress, properties.size, 0, MemoryPool::system4KBPages, maxOsContextCount); } diff --git a/shared/test/common/mocks/mock_memory_manager.h b/shared/test/common/mocks/mock_memory_manager.h index ddabf819d3..28b497d4b8 100644 --- a/shared/test/common/mocks/mock_memory_manager.h +++ b/shared/test/common/mocks/mock_memory_manager.h @@ -346,7 +346,6 @@ class MockMemoryManager : public MemoryManagerCreate { bool failMapPhysicalToVirtualMemory = false; bool returnMockGAFromDevicePool = false; bool returnMockGAFromHostPool = false; - bool shouldStoreLastAllocationProperties = false; std::unique_ptr mockExecutionEnvironment; DeviceBitfield recentlyPassedDeviceBitfield{}; std::unique_ptr waitAllocations = nullptr; @@ -355,7 +354,6 @@ class MockMemoryManager : public MemoryManagerCreate { MemoryManager::AllocationStatus populateOsHandlesResult = MemoryManager::AllocationStatus::Success; GraphicsAllocation *allocateGraphicsMemoryForNonSvmHostPtrResult = nullptr; std::unique_ptr lastAllocationProperties = nullptr; - std::unique_ptr lastAllocationPropertiesWithPtr = nullptr; std::function validateAllocateProperties = [](const AllocationProperties &) -> void {}; AddressRange reserveGpuAddressOnHeapResult = AddressRange{0u, 0u}; }; 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 5928aaab21..09978536e8 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 @@ -7423,39 +7423,6 @@ TEST_F(DrmMemoryManagerLocalMemoryAlignmentTest, givenEnabled2MBSizeAlignmentWhe memoryManager->freeGraphicsMemory(allocation); } -TEST_F(DrmMemoryManagerLocalMemoryAlignmentTest, givenEnabled2MBSizeAlignmentWhenAllocatingLargeKernelIsaThenAllocationIsAlignedTo2MB) { - auto mockProductHelper = new MockProductHelper; - executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->productHelper.reset(mockProductHelper); - mockProductHelper->is2MBLocalMemAlignmentEnabledResult = true; - - ASSERT_TRUE(executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->productHelper->is2MBLocalMemAlignmentEnabled()); - - MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success; - AllocationData allocData; - allocData.allFlags = 0; - allocData.size = MemoryConstants::pageSize2M + 1; - allocData.flags.allocateMemory = true; - allocData.type = AllocationType::kernelIsa; - allocData.rootDeviceIndex = rootDeviceIndex; - - auto memoryManager = createMemoryManager(); - auto allocation = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status); - ASSERT_NE(nullptr, allocation); - EXPECT_EQ(MemoryManager::AllocationStatus::Success, status); - EXPECT_EQ(MemoryPool::localMemory, allocation->getMemoryPool()); - EXPECT_TRUE(isAligned(allocation->getGpuAddress(), MemoryConstants::pageSize2M)); - EXPECT_TRUE(isAligned(allocation->getUnderlyingBufferSize(), MemoryConstants::pageSize2M)); - - auto drmAllocation = static_cast(allocation); - auto bo = drmAllocation->getBO(); - EXPECT_NE(nullptr, bo); - EXPECT_EQ(allocation->getGpuAddress(), bo->peekAddress()); - EXPECT_TRUE(isAligned(bo->peekAddress(), MemoryConstants::pageSize2M)); - EXPECT_TRUE(isAligned(bo->peekSize(), MemoryConstants::pageSize2M)); - - memoryManager->freeGraphicsMemory(allocation); -} - TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenNotSetUseSystemMemoryWhenGraphicsAllocationInDevicePoolIsAllocatedForBufferThenLocalMemoryAllocationIsReturnedFromStandard64KbHeap) { MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success; AllocationData allocData; diff --git a/shared/test/unit_test/utilities/isa_pool_allocator_tests.cpp b/shared/test/unit_test/utilities/isa_pool_allocator_tests.cpp index 9d98907fb3..51212bfff7 100644 --- a/shared/test/unit_test/utilities/isa_pool_allocator_tests.cpp +++ b/shared/test/unit_test/utilities/isa_pool_allocator_tests.cpp @@ -5,28 +5,14 @@ * */ -#include "shared/source/utilities/heap_allocator.h" #include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/mocks/mock_device.h" -#include "shared/test/common/mocks/mock_product_helper.h" #include "shared/test/common/test_macros/test.h" #include "gtest/gtest.h" using namespace NEO; -class MockISAPool : public ISAPool { - public: - using ISAPool::chunkAllocator; -}; - -class MockISAPoolAllocator : public ISAPoolAllocator { - public: - using ISAPoolAllocator::bufferPools; - - MockISAPoolAllocator(Device *device) : ISAPoolAllocator(device) {} -}; - using IsaPoolAllocatorTest = Test; void verifySharedIsaAllocation(const SharedIsaAllocation *sharedAllocation, size_t expectedOffset, size_t expectedSize) { @@ -113,24 +99,3 @@ TEST_F(IsaPoolAllocatorTest, givenIsaPoolAllocatorWhenRequestForLargeAllocationT verifySharedIsaAllocation(allocation, 0, requestAllocationSize); isaAllocator.freeSharedIsaAllocation(allocation); } - -TEST_F(IsaPoolAllocatorTest, Given2MBLocalMemAlignmentEnabledWhenAllocatingIsaThenISAPoolSizeIsAlignedTo2MB) { - auto mockProductHelper = new MockProductHelper; - pDevice->getRootDeviceEnvironmentRef().productHelper.reset(mockProductHelper); - mockProductHelper->is2MBLocalMemAlignmentEnabledResult = true; - - MockISAPoolAllocator mockIsaAllocator(pDevice); - - constexpr size_t requestAllocationSize = MemoryConstants::pageSize + 1; - auto allocation = mockIsaAllocator.requestGraphicsAllocationForIsa(true, requestAllocationSize); - - EXPECT_NE(nullptr, allocation); - ASSERT_GE(mockIsaAllocator.bufferPools.size(), 1u); - - auto *bufferPool = static_cast(&mockIsaAllocator.bufferPools[0]); - auto chunkAllocatorSize = bufferPool->chunkAllocator->getLeftSize() + bufferPool->chunkAllocator->getUsedSize(); - - EXPECT_TRUE(isAligned(chunkAllocatorSize, MemoryConstants::pageSize2M)); - - mockIsaAllocator.freeSharedIsaAllocation(allocation); -} \ No newline at end of file