From 681eac2f13fa819791e68ebeb5b864a9acba442d Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Sat, 18 Oct 2025 04:18:42 +0200 Subject: [PATCH] Revert "performance: increase cl buffer pool size" This reverts commit 6e67271454d6c239ef4f3ba609845a752e37d016. Signed-off-by: Compute-Runtime-Validation --- opencl/source/cl_device/cl_device_caps.cpp | 2 +- opencl/source/context/context.cpp | 4 +- opencl/test/unit_test/linux/CMakeLists.txt | 1 - .../test/unit_test/linux/main_linux_dll.cpp | 9 ---- .../mem_obj/buffer_pool_alloc_tests.cpp | 46 ++++++++++++++----- opencl/test/unit_test/windows/CMakeLists.txt | 1 - shared/source/dll/CMakeLists.txt | 1 - shared/source/dll/buffer_pool_size.cpp | 18 -------- .../source/utilities/buffer_pool_allocator.h | 26 ++++++++++- .../utilities/buffer_pool_allocator.inl | 4 ++ shared/source/utilities/buffer_pool_params.h | 22 --------- shared/test/common/libult/CMakeLists.txt | 2 - .../common/mocks/mock_buffer_pool_size.cpp | 18 -------- .../utilities/buffer_pool_allocator_tests.cpp | 35 ++++++++++++++ 14 files changed, 102 insertions(+), 87 deletions(-) delete mode 100644 shared/source/dll/buffer_pool_size.cpp delete mode 100644 shared/source/utilities/buffer_pool_params.h delete mode 100644 shared/test/common/mocks/mock_buffer_pool_size.cpp diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index 889623b052..0c287f8174 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -615,7 +615,7 @@ void ClDevice::initializeMaxPoolCount() { auto &device = getDevice(); const auto bitfield = device.getDeviceBitfield(); const auto deviceMemory = device.getGlobalMemorySize(static_cast(bitfield.to_ulong())); - const auto preferredBufferPoolParams = SmallBuffersParams::getDefaultParams(); + const auto preferredBufferPoolParams = SmallBuffersParams::getPreferredBufferPoolParams(device.getProductHelper()); const auto maxPoolCount = Context::BufferPoolAllocator::calculateMaxPoolCount(preferredBufferPoolParams, deviceMemory, 2); device.updateMaxPoolCount(maxPoolCount); } diff --git a/opencl/source/context/context.cpp b/opencl/source/context/context.cpp index ee84d85da9..6b66fc2bb9 100644 --- a/opencl/source/context/context.cpp +++ b/opencl/source/context/context.cpp @@ -301,7 +301,7 @@ bool Context::createImpl(const cl_context_properties *properties, setupContextType(); initializeManagers(); - smallBufferPoolAllocator.setParams(SmallBuffersParams::getDefaultParams()); + smallBufferPoolAllocator.setParams(SmallBuffersParams::getPreferredBufferPoolParams(device->getProductHelper())); } return true; @@ -553,7 +553,7 @@ bool Context::BufferPoolAllocator::isAggregatedSmallBuffersEnabled(Context *cont Context::BufferPool::BufferPool(Context *context) : BaseType(context->memoryManager, nullptr, - SmallBuffersParams::getDefaultParams()) { + SmallBuffersParams::getPreferredBufferPoolParams(context->getDevice(0)->getDevice().getProductHelper())) { static constexpr cl_mem_flags flags = CL_MEM_UNCOMPRESSED_HINT_INTEL; [[maybe_unused]] cl_int errcodeRet{}; Buffer::AdditionalBufferCreateArgs bufferCreateArgs{}; diff --git a/opencl/test/unit_test/linux/CMakeLists.txt b/opencl/test/unit_test/linux/CMakeLists.txt index 10b9f752b0..4ac1d15b8b 100644 --- a/opencl/test/unit_test/linux/CMakeLists.txt +++ b/opencl/test/unit_test/linux/CMakeLists.txt @@ -28,7 +28,6 @@ add_executable(igdrcl_${target_name} ${NEO_SHARED_DIRECTORY}/dll/direct_submission_controller_enabled.cpp ${NEO_SHARED_DIRECTORY}/dll/unified_memory_reuse_cleaner_enabled.cpp ${NEO_SHARED_DIRECTORY}/dll/usm_pool_size.cpp - ${NEO_SHARED_DIRECTORY}/dll/buffer_pool_size.cpp ${NEO_SHARED_DIRECTORY}/dll/pool_info.cpp ${NEO_SHARED_DIRECTORY}/dll/linux/drm_neo_create.cpp ${NEO_SHARED_DIRECTORY}/dll/linux${BRANCH_DIR_SUFFIX}/options_linux.cpp diff --git a/opencl/test/unit_test/linux/main_linux_dll.cpp b/opencl/test/unit_test/linux/main_linux_dll.cpp index d32335f770..6a9a3d46a0 100644 --- a/opencl/test/unit_test/linux/main_linux_dll.cpp +++ b/opencl/test/unit_test/linux/main_linux_dll.cpp @@ -649,15 +649,6 @@ TEST(UsmPoolTest, whenGetUsmPoolSizeCalledThenReturnCorrectSize) { EXPECT_EQ(usmPoolSize, NEO::UsmPoolParams::getUsmPoolSize(gfxCoreHelper)); } -TEST(SmallBuffersParamsTest, WhenGettingDefaultParamsThenReturnCorrectValues) { - auto defaultParams = NEO::SmallBuffersParams::getDefaultParams(); - - EXPECT_EQ(16 * MemoryConstants::megaByte, defaultParams.aggregatedSmallBuffersPoolSize); - EXPECT_EQ(2 * MemoryConstants::megaByte, defaultParams.smallBufferThreshold); - EXPECT_EQ(MemoryConstants::pageSize64k, defaultParams.chunkAlignment); - EXPECT_EQ(MemoryConstants::pageSize64k, defaultParams.startingOffset); -} - TEST(UnifiedMemoryPoolingManagerTest, whenGetPoolInfosCalledThenCorrectInfoIsReturned) { auto poolInfo0To4Kb = PoolInfo::getPoolInfos()[0]; auto poolInfo4KbTo64Kb = PoolInfo::getPoolInfos()[1]; 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 f53cabbc74..7135acfcdf 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 @@ -67,7 +67,7 @@ class AggregatedSmallBuffersTestTemplate : public ::testing::Test { this->mockNeoDevice = static_cast(&this->device->getDevice()); const auto bitfield = mockNeoDevice->getDeviceBitfield(); const auto deviceMemory = mockNeoDevice->getGlobalMemorySize(static_cast(bitfield.to_ulong())); - const auto expectedMaxPoolCount = Context::BufferPoolAllocator::calculateMaxPoolCount(SmallBuffersParams::getDefaultParams(), deviceMemory, 2); + const auto expectedMaxPoolCount = Context::BufferPoolAllocator::calculateMaxPoolCount(SmallBuffersParams::getPreferredBufferPoolParams(this->device->getProductHelper()), deviceMemory, 2); EXPECT_EQ(expectedMaxPoolCount, mockNeoDevice->maxBufferPoolCount); this->mockMemoryManager = static_cast(device->getMemoryManager()); this->mockMemoryManager->localMemorySupported[rootDeviceIndex] = true; @@ -185,11 +185,17 @@ TEST_F(AggregatedSmallBuffersDisabledTest, givenAggregatedSmallBuffersDisabledWh using AggregatedSmallBuffersEnabledTest = AggregatedSmallBuffersTestTemplate<1>; TEST_F(AggregatedSmallBuffersEnabledTest, givenAggregatedSmallBuffersEnabledWhenCalculateMaxPoolCountCalledThenCorrectValueIsReturned) { - auto size = this->poolAllocator->getParams().aggregatedSmallBuffersPoolSize; - EXPECT_EQ(8u * MemoryConstants::gigaByte / (50 * size), MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 8 * MemoryConstants::gigaByte, 2)); - EXPECT_EQ(8u * MemoryConstants::gigaByte / (20 * size), MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 8 * MemoryConstants::gigaByte, 5)); - EXPECT_EQ(128u * MemoryConstants::megaByte / (50 * size), MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 128 * MemoryConstants::megaByte, 2)); - EXPECT_EQ(1u, MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), MemoryConstants::pageSize64k, 2)); + if (device->getProductHelper().is2MBLocalMemAlignmentEnabled()) { + EXPECT_EQ(10u, MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 8 * MemoryConstants::gigaByte, 2)); + EXPECT_EQ(25u, MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 8 * MemoryConstants::gigaByte, 5)); + EXPECT_EQ(1u, MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 128 * MemoryConstants::megaByte, 2)); + EXPECT_EQ(1u, MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 64 * MemoryConstants::megaByte, 2)); + } else { + EXPECT_EQ(81u, MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 8 * MemoryConstants::gigaByte, 2)); + EXPECT_EQ(204u, MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 8 * MemoryConstants::gigaByte, 5)); + EXPECT_EQ(1u, MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 128 * MemoryConstants::megaByte, 2)); + EXPECT_EQ(1u, MockBufferPoolAllocator::calculateMaxPoolCount(this->poolAllocator->getParams(), 64 * MemoryConstants::megaByte, 2)); + } } TEST_F(AggregatedSmallBuffersEnabledTest, givenAggregatedSmallBuffersEnabledWhenAllocatingMainStorageThenMakeDeviceBufferLockableAndNotCompressed) { @@ -498,11 +504,10 @@ TEST_F(AggregatedSmallBuffersEnabledTest, givenAggregatedSmallBuffersEnabledAndM EXPECT_FALSE(bufferAfterExhaustMustSucceed->isSubBuffer()); mockNeoDevice->callBaseGetGlobalMemorySize = false; - auto poolSize = SmallBuffersParams::getDefaultParams().aggregatedSmallBuffersPoolSize; if (mockNeoDevice->getProductHelper().is2MBLocalMemAlignmentEnabled()) { - mockNeoDevice->getGlobalMemorySizeReturn = static_cast(2 * poolSize / 0.02); + mockNeoDevice->getGlobalMemorySizeReturn = static_cast(16 * 2 * MemoryConstants::megaByte / 0.02); } else { - mockNeoDevice->getGlobalMemorySizeReturn = static_cast(2 * poolSize / 0.02); + mockNeoDevice->getGlobalMemorySizeReturn = static_cast(2 * 2 * MemoryConstants::megaByte / 0.02); } const auto bitfield = mockNeoDevice->getDeviceBitfield(); const auto deviceMemory = mockNeoDevice->getGlobalMemorySize(static_cast(bitfield.to_ulong())); @@ -571,7 +576,7 @@ TEST_F(AggregatedSmallBuffersEnabledTestDoNotRunSetup, givenAggregatedSmallBuffe EXPECT_EQ(0u, output.size()); } -TEST_F(AggregatedSmallBuffersEnabledTestDoNotRunSetup, whenCreatingContextThenBufferPoolAllocatorHasCorrectParams) { +TEST_F(AggregatedSmallBuffersEnabledTestDoNotRunSetup, givenProductWithAndWithout2MBLocalMemAlignmentWhenCreatingContextThenBufferPoolAllocatorHasCorrectParams) { auto compareSmallBuffersParams = [](const NEO::SmallBuffersParams &first, const NEO::SmallBuffersParams &second) { return first.aggregatedSmallBuffersPoolSize == second.aggregatedSmallBuffersPoolSize && first.smallBufferThreshold == second.smallBufferThreshold && @@ -588,13 +593,32 @@ TEST_F(AggregatedSmallBuffersEnabledTestDoNotRunSetup, whenCreatingContextThenBu this->device = deviceFactory->rootDevices[rootDeviceIndex]; this->mockNeoDevice = static_cast(&this->device->getDevice()); + auto mockProductHelper = new MockProductHelper; + mockNeoDevice->getRootDeviceEnvironmentRef().productHelper.reset(mockProductHelper); + mockProductHelper->is2MBLocalMemAlignmentEnabledResult = false; + + auto &productHelper = mockNeoDevice->getRootDeviceEnvironment().getProductHelper(); + EXPECT_FALSE(productHelper.is2MBLocalMemAlignmentEnabled()); + cl_device_id devices[] = {device}; this->context.reset(Context::create(nullptr, ClDeviceVector(devices, 1), nullptr, nullptr, retVal)); auto &bufferPoolAllocator = context->getBufferPoolAllocator(); auto bufferPoolAllocatorParams = bufferPoolAllocator.getParams(); - auto preferredParams = NEO::SmallBuffersParams::getDefaultParams(); + auto preferredParams = NEO::SmallBuffersParams::getPreferredBufferPoolParams(productHelper); EXPECT_TRUE(compareSmallBuffersParams(bufferPoolAllocatorParams, preferredParams)); + + mockProductHelper->is2MBLocalMemAlignmentEnabledResult = true; + EXPECT_TRUE(productHelper.is2MBLocalMemAlignmentEnabled()); + + std::unique_ptr secondContext; + secondContext.reset(Context::create(nullptr, ClDeviceVector(devices, 1), nullptr, nullptr, retVal)); + + auto &bufferPoolAllocator2 = secondContext->getBufferPoolAllocator(); + auto bufferPoolAllocatorParams2 = bufferPoolAllocator2.getParams(); + + preferredParams = NEO::SmallBuffersParams::getPreferredBufferPoolParams(productHelper); + EXPECT_TRUE(compareSmallBuffersParams(bufferPoolAllocatorParams2, preferredParams)); } template diff --git a/opencl/test/unit_test/windows/CMakeLists.txt b/opencl/test/unit_test/windows/CMakeLists.txt index 703ca7aa20..a7667e193d 100644 --- a/opencl/test/unit_test/windows/CMakeLists.txt +++ b/opencl/test/unit_test/windows/CMakeLists.txt @@ -37,7 +37,6 @@ if(WIN32) ${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/wddm_calls.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_get_staging_buffer_size.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_usm_pool_size.cpp - ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_buffer_pool_size.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_pool_info.cpp ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_macros/test_checks_ocl.cpp ) diff --git a/shared/source/dll/CMakeLists.txt b/shared/source/dll/CMakeLists.txt index f0ee57d91d..dcceecdacf 100644 --- a/shared/source/dll/CMakeLists.txt +++ b/shared/source/dll/CMakeLists.txt @@ -20,7 +20,6 @@ set(NEO_SHARED_DLLS ${CMAKE_CURRENT_SOURCE_DIR}/options_dll.cpp ${CMAKE_CURRENT_SOURCE_DIR}/get_staging_buffer_size.cpp ${CMAKE_CURRENT_SOURCE_DIR}/usm_pool_size.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/buffer_pool_size.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pool_info.cpp ) diff --git a/shared/source/dll/buffer_pool_size.cpp b/shared/source/dll/buffer_pool_size.cpp deleted file mode 100644 index 7d5ea0ce31..0000000000 --- a/shared/source/dll/buffer_pool_size.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/utilities/buffer_pool_params.h" - -namespace NEO { -SmallBuffersParams SmallBuffersParams::getDefaultParams() { - return { - .aggregatedSmallBuffersPoolSize = 16 * MemoryConstants::megaByte, - .smallBufferThreshold = 2 * MemoryConstants::megaByte, - .chunkAlignment = MemoryConstants::pageSize64k, - .startingOffset = MemoryConstants::pageSize64k}; -} -} // namespace NEO diff --git a/shared/source/utilities/buffer_pool_allocator.h b/shared/source/utilities/buffer_pool_allocator.h index 71373a7aa2..8168c1dd1b 100644 --- a/shared/source/utilities/buffer_pool_allocator.h +++ b/shared/source/utilities/buffer_pool_allocator.h @@ -8,7 +8,6 @@ #pragma once #include "shared/source/helpers/constants.h" #include "shared/source/helpers/non_copyable_or_moveable.h" -#include "shared/source/utilities/buffer_pool_params.h" #include "shared/source/utilities/stackvec.h" #include @@ -24,6 +23,31 @@ class HeapAllocator; class MemoryManager; class ProductHelper; +struct SmallBuffersParams { + size_t aggregatedSmallBuffersPoolSize{0}; + size_t smallBufferThreshold{0}; + size_t chunkAlignment{0}; + size_t startingOffset{0}; + + static SmallBuffersParams getDefaultParams() { + return { + .aggregatedSmallBuffersPoolSize = 2 * MemoryConstants::megaByte, + .smallBufferThreshold = 1 * MemoryConstants::megaByte, + .chunkAlignment = MemoryConstants::pageSize64k, + .startingOffset = MemoryConstants::pageSize64k}; + } + + static SmallBuffersParams getLargePagesParams() { + return { + .aggregatedSmallBuffersPoolSize = 16 * MemoryConstants::megaByte, + .smallBufferThreshold = 2 * MemoryConstants::megaByte, + .chunkAlignment = MemoryConstants::pageSize64k, + .startingOffset = MemoryConstants::pageSize64k}; + } + + static inline SmallBuffersParams getPreferredBufferPoolParams(const ProductHelper &productHelper); +}; + template struct AbstractBuffersPool : public NonCopyableClass { // The prototype of a function allocating the `mainStorage` is not specified. diff --git a/shared/source/utilities/buffer_pool_allocator.inl b/shared/source/utilities/buffer_pool_allocator.inl index d9170fd8ee..9a06f1c37e 100644 --- a/shared/source/utilities/buffer_pool_allocator.inl +++ b/shared/source/utilities/buffer_pool_allocator.inl @@ -14,6 +14,10 @@ namespace NEO { +inline SmallBuffersParams SmallBuffersParams::getPreferredBufferPoolParams(const ProductHelper &productHelper) { + return productHelper.is2MBLocalMemAlignmentEnabled() ? SmallBuffersParams::getLargePagesParams() : SmallBuffersParams::getDefaultParams(); +} + template AbstractBuffersPool::AbstractBuffersPool(MemoryManager *memoryManager, OnChunkFreeCallback onChunkFreeCb) : AbstractBuffersPool::AbstractBuffersPool(memoryManager, onChunkFreeCb, SmallBuffersParams::getDefaultParams()) {} diff --git a/shared/source/utilities/buffer_pool_params.h b/shared/source/utilities/buffer_pool_params.h deleted file mode 100644 index 5e0aa8b973..0000000000 --- a/shared/source/utilities/buffer_pool_params.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#pragma once -#include "shared/source/helpers/constants.h" - -namespace NEO { - -struct SmallBuffersParams { - size_t aggregatedSmallBuffersPoolSize{0}; - size_t smallBufferThreshold{0}; - size_t chunkAlignment{0}; - size_t startingOffset{0}; - - static SmallBuffersParams getDefaultParams(); -}; - -} // namespace NEO diff --git a/shared/test/common/libult/CMakeLists.txt b/shared/test/common/libult/CMakeLists.txt index 16b5708ec7..3644d1b661 100644 --- a/shared/test/common/libult/CMakeLists.txt +++ b/shared/test/common/libult/CMakeLists.txt @@ -212,7 +212,6 @@ set(neo_libult_SRCS_LINUX ${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/linux/sys_calls_linux_ult.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_get_staging_buffer_size.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_usm_pool_size.cpp - ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_buffer_pool_size.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_pool_info.cpp ) @@ -231,7 +230,6 @@ set(neo_libult_SRCS_WINDOWS ${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/wddm_calls.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_get_staging_buffer_size.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_usm_pool_size.cpp - ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_buffer_pool_size.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_pool_info.cpp ) diff --git a/shared/test/common/mocks/mock_buffer_pool_size.cpp b/shared/test/common/mocks/mock_buffer_pool_size.cpp deleted file mode 100644 index afb921715d..0000000000 --- a/shared/test/common/mocks/mock_buffer_pool_size.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/utilities/buffer_pool_params.h" - -namespace NEO { -SmallBuffersParams SmallBuffersParams::getDefaultParams() { - return { - .aggregatedSmallBuffersPoolSize = MemoryConstants::pageSize64k, - .smallBufferThreshold = 4 * MemoryConstants::pageSize, - .chunkAlignment = MemoryConstants::pageSize, - .startingOffset = MemoryConstants::pageSize}; -} -} // namespace NEO diff --git a/shared/test/unit_test/utilities/buffer_pool_allocator_tests.cpp b/shared/test/unit_test/utilities/buffer_pool_allocator_tests.cpp index 6c99971586..36f5357f04 100644 --- a/shared/test/unit_test/utilities/buffer_pool_allocator_tests.cpp +++ b/shared/test/unit_test/utilities/buffer_pool_allocator_tests.cpp @@ -332,6 +332,41 @@ struct SmallBuffersParamsTest : public ::testing::Test { } }; +TEST_F(SmallBuffersParamsTest, WhenGettingDefaultParamsThenReturnCorrectValues) { + auto defaultParams = NEO::SmallBuffersParams::getDefaultParams(); + + EXPECT_EQ(2 * MemoryConstants::megaByte, defaultParams.aggregatedSmallBuffersPoolSize); + EXPECT_EQ(1 * MemoryConstants::megaByte, defaultParams.smallBufferThreshold); + EXPECT_EQ(MemoryConstants::pageSize64k, defaultParams.chunkAlignment); + EXPECT_EQ(MemoryConstants::pageSize64k, defaultParams.startingOffset); +} + +TEST_F(SmallBuffersParamsTest, WhenGettingLargePagesParamsThenReturnCorrectValues) { + auto largePagesParams = NEO::SmallBuffersParams::getLargePagesParams(); + + EXPECT_EQ(16 * MemoryConstants::megaByte, largePagesParams.aggregatedSmallBuffersPoolSize); + EXPECT_EQ(2 * MemoryConstants::megaByte, largePagesParams.smallBufferThreshold); + EXPECT_EQ(MemoryConstants::pageSize64k, largePagesParams.chunkAlignment); + EXPECT_EQ(MemoryConstants::pageSize64k, largePagesParams.startingOffset); +} + +TEST_F(SmallBuffersParamsTest, GivenProductHelperWhenGettingPreferredBufferPoolParamsThenReturnsCorrectValues) { + auto mockProductHelper = std::make_unique(); + + { + mockProductHelper->is2MBLocalMemAlignmentEnabledResult = false; + auto preferredParams = NEO::SmallBuffersParams::getPreferredBufferPoolParams(*mockProductHelper); + auto expectedParams = NEO::SmallBuffersParams::getDefaultParams(); + EXPECT_TRUE(compareSmallBuffersParams(expectedParams, preferredParams)); + } + { + mockProductHelper->is2MBLocalMemAlignmentEnabledResult = true; + auto preferredParams = NEO::SmallBuffersParams::getPreferredBufferPoolParams(*mockProductHelper); + auto expectedParams = NEO::SmallBuffersParams::getLargePagesParams(); + EXPECT_TRUE(compareSmallBuffersParams(expectedParams, preferredParams)); + } +} + TEST_F(SmallBuffersParamsTest, GivenBuffersAllocatorWhenSettingDifferentParamsThenGetParamsReturnsExpectedValues) { auto buffersAllocator = DummyBuffersAllocator{};