diff --git a/level_zero/core/test/unit_tests/sources/memory/test_memory_pooling.cpp b/level_zero/core/test/unit_tests/sources/memory/test_memory_pooling.cpp index c4dacb80f1..b8bb9e3ff8 100644 --- a/level_zero/core/test/unit_tests/sources/memory/test_memory_pooling.cpp +++ b/level_zero/core/test/unit_tests/sources/memory/test_memory_pooling.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -39,7 +39,7 @@ struct AllocUsmPoolMemoryTest : public ::testing::Test { executionEnvironment->rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(NEO::defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[i]->initGmm(); if (1 == deviceUsmPoolFlag) { - mockProductHelpers[i]->isUsmPoolAllocatorSupportedResult = true; + mockProductHelpers[i]->isDeviceUsmPoolAllocatorSupportedResult = true; } } diff --git a/opencl/source/context/context.cpp b/opencl/source/context/context.cpp index 083080eb46..b6dec1a9a7 100644 --- a/opencl/source/context/context.cpp +++ b/opencl/source/context/context.cpp @@ -553,7 +553,7 @@ void Context::initializeUsmAllocationPools() { } auto &productHelper = getDevices()[0]->getProductHelper(); - bool enabled = ApiSpecificConfig::isDeviceUsmPoolingEnabled() && productHelper.isUsmPoolAllocatorSupported(); + bool enabled = ApiSpecificConfig::isDeviceUsmPoolingEnabled() && productHelper.isDeviceUsmPoolAllocatorSupported(); auto usmDevicePoolParams = getUsmDevicePoolParams(); if (debugManager.flags.EnableDeviceUsmAllocationPool.get() != -1) { @@ -570,7 +570,7 @@ void Context::initializeUsmAllocationPools() { usmDeviceMemAllocPool.initialize(svmMemoryManager, memoryProperties, usmDevicePoolParams.poolSize, usmDevicePoolParams.minServicedSize, usmDevicePoolParams.maxServicedSize); } - enabled = ApiSpecificConfig::isHostUsmPoolingEnabled() && productHelper.isUsmPoolAllocatorSupported(); + enabled = ApiSpecificConfig::isHostUsmPoolingEnabled() && productHelper.isHostUsmPoolAllocatorSupported(); auto usmHostPoolParams = getUsmHostPoolParams(); if (debugManager.flags.EnableHostUsmAllocationPool.get() != -1) { enabled = debugManager.flags.EnableHostUsmAllocationPool.get() > 0; diff --git a/opencl/test/unit_test/context/context_tests.cpp b/opencl/test/unit_test/context/context_tests.cpp index 04755f3037..869fdac42e 100644 --- a/opencl/test/unit_test/context/context_tests.cpp +++ b/opencl/test/unit_test/context/context_tests.cpp @@ -904,7 +904,8 @@ TEST_F(ContextUsmPoolParamsTest, GivenEnabled2MBLocalMemAlignmentWhenGettingUsmP } TEST_F(ContextUsmPoolParamsTest, GivenUsmPoolAllocatorSupportedWhenInitializingUsmPoolsThenPoolsAreInitializedWithCorrectParams) { - mockProductHelper->isUsmPoolAllocatorSupportedResult = true; + mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true; + mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true; cl_device_id devices[] = {device}; context.reset(Context::create(nullptr, ClDeviceVector(devices, 1), nullptr, nullptr, retVal)); diff --git a/opencl/test/unit_test/context/context_usm_memory_pool_tests.cpp b/opencl/test/unit_test/context/context_usm_memory_pool_tests.cpp index 3ba372b9fb..ca27e4b755 100644 --- a/opencl/test/unit_test/context/context_usm_memory_pool_tests.cpp +++ b/opencl/test/unit_test/context/context_usm_memory_pool_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -110,8 +110,8 @@ TEST_F(ContextUsmPoolEnabledFlagsTestDefault, givenDefaultDebugSettingsThenPoolI clMemFreeINTEL(mockContext.get(), pooledHostAlloc); auto &productHelper = mockContext->getDevice(0u)->getProductHelper(); - bool enabledDevice = ApiSpecificConfig::isDeviceUsmPoolingEnabled() && productHelper.isUsmPoolAllocatorSupported(); - bool enabledHost = ApiSpecificConfig::isHostUsmPoolingEnabled() && productHelper.isUsmPoolAllocatorSupported(); + bool enabledDevice = ApiSpecificConfig::isDeviceUsmPoolingEnabled() && productHelper.isDeviceUsmPoolAllocatorSupported(); + bool enabledHost = ApiSpecificConfig::isHostUsmPoolingEnabled() && productHelper.isHostUsmPoolAllocatorSupported(); EXPECT_EQ(enabledDevice, mockDeviceUsmMemAllocPool->isInitialized()); EXPECT_EQ(enabledHost, mockHostUsmMemAllocPool->isInitialized()); diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 4c2f8e487f..2ca7d34e45 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -200,7 +200,7 @@ void Device::initializeCommonResources() { } if (ApiSpecificConfig::isDeviceUsmPoolingEnabled() && - getProductHelper().isUsmPoolAllocatorSupported() && + getProductHelper().isDeviceUsmPoolAllocatorSupported() && NEO::debugManager.flags.ExperimentalUSMAllocationReuseVersion.get() == 2) { RootDeviceIndicesContainer rootDeviceIndices; diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index e8359ea19e..65d1e9eee9 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -180,7 +180,8 @@ class ProductHelper { virtual bool isNonBlockingGpuSubmissionSupported() const = 0; virtual bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ, TaskCountType queueTaskCount, const CommandStreamReceiver &queueCsr) const = 0; virtual bool isBufferPoolAllocatorSupported() const = 0; - virtual bool isUsmPoolAllocatorSupported() const = 0; + virtual bool isHostUsmPoolAllocatorSupported() const = 0; + virtual bool isDeviceUsmPoolAllocatorSupported() const = 0; virtual bool isDeviceUsmAllocationReuseSupported() const = 0; virtual bool isHostUsmAllocationReuseSupported() const = 0; virtual bool useLocalPreferredForCacheableBuffers() const = 0; diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index ef9ffe2826..621805df11 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -122,7 +122,8 @@ class ProductHelperHw : public ProductHelper { bool isNonBlockingGpuSubmissionSupported() const override; bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ, TaskCountType queueTaskCount, const CommandStreamReceiver &queueCsr) const override; bool isBufferPoolAllocatorSupported() const override; - bool isUsmPoolAllocatorSupported() const override; + bool isHostUsmPoolAllocatorSupported() const override; + bool isDeviceUsmPoolAllocatorSupported() const override; bool isDeviceUsmAllocationReuseSupported() const override; bool isHostUsmAllocationReuseSupported() const override; bool useLocalPreferredForCacheableBuffers() const override; diff --git a/shared/source/os_interface/product_helper_tgllp_and_later.inl b/shared/source/os_interface/product_helper_tgllp_and_later.inl index 9ede602dfc..8cb37cc113 100644 --- a/shared/source/os_interface/product_helper_tgllp_and_later.inl +++ b/shared/source/os_interface/product_helper_tgllp_and_later.inl @@ -99,7 +99,12 @@ bool ProductHelperHw::isBufferPoolAllocatorSupported() const { } template -bool ProductHelperHw::isUsmPoolAllocatorSupported() const { +bool ProductHelperHw::isHostUsmPoolAllocatorSupported() const { + return false; +} + +template +bool ProductHelperHw::isDeviceUsmPoolAllocatorSupported() const { return false; } diff --git a/shared/source/os_interface/product_helper_xe2_and_later.inl b/shared/source/os_interface/product_helper_xe2_and_later.inl index 76c9a4d5c5..5fc83cfe6b 100644 --- a/shared/source/os_interface/product_helper_xe2_and_later.inl +++ b/shared/source/os_interface/product_helper_xe2_and_later.inl @@ -132,7 +132,12 @@ bool ProductHelperHw::isBufferPoolAllocatorSupported() const { } template -bool ProductHelperHw::isUsmPoolAllocatorSupported() const { +bool ProductHelperHw::isHostUsmPoolAllocatorSupported() const { + return true; +} + +template +bool ProductHelperHw::isDeviceUsmPoolAllocatorSupported() const { return true; } diff --git a/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl b/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl index c5007c9770..6fbbc13ed9 100644 --- a/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl +++ b/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -60,7 +60,12 @@ bool ProductHelperHw::isBufferPoolAllocatorSupported() const { } template -bool ProductHelperHw::isUsmPoolAllocatorSupported() const { +bool ProductHelperHw::isHostUsmPoolAllocatorSupported() const { + return false; +} + +template +bool ProductHelperHw::isDeviceUsmPoolAllocatorSupported() const { return false; } diff --git a/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl b/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl index 37f2bd10b3..e6c1642a06 100644 --- a/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl +++ b/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -205,7 +205,12 @@ bool ProductHelperHw::isBufferPoolAllocatorSupported() const { } template <> -bool ProductHelperHw::isUsmPoolAllocatorSupported() const { +bool ProductHelperHw::isHostUsmPoolAllocatorSupported() const { + return true; +} + +template <> +bool ProductHelperHw::isDeviceUsmPoolAllocatorSupported() const { return true; } diff --git a/shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl b/shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl index 5efcdeda79..d66a5632d9 100644 --- a/shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl +++ b/shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -63,7 +63,12 @@ bool ProductHelperHw::isBufferPoolAllocatorSupported() const { } template <> -bool ProductHelperHw::isUsmPoolAllocatorSupported() const { +bool ProductHelperHw::isHostUsmPoolAllocatorSupported() const { + return true; +} + +template <> +bool ProductHelperHw::isDeviceUsmPoolAllocatorSupported() const { return true; } diff --git a/shared/test/common/mocks/mock_product_helper.cpp b/shared/test/common/mocks/mock_product_helper.cpp index 58a940ab17..fe355b3b1b 100644 --- a/shared/test/common/mocks/mock_product_helper.cpp +++ b/shared/test/common/mocks/mock_product_helper.cpp @@ -438,7 +438,12 @@ bool ProductHelperHw::isBufferPoolAllocatorSupported() const { } template -bool ProductHelperHw::isUsmPoolAllocatorSupported() const { +bool ProductHelperHw::isHostUsmPoolAllocatorSupported() const { + return false; +} + +template +bool ProductHelperHw::isDeviceUsmPoolAllocatorSupported() const { return false; } diff --git a/shared/test/common/mocks/mock_product_helper.h b/shared/test/common/mocks/mock_product_helper.h index 54171648f8..a495b8050a 100644 --- a/shared/test/common/mocks/mock_product_helper.h +++ b/shared/test/common/mocks/mock_product_helper.h @@ -23,7 +23,8 @@ struct MockProductHelper : ProductHelperHw { ADDMETHOD_CONST_NOBASE(isBlitCopyRequiredForLocalMemory, bool, true, (const RootDeviceEnvironment &rootDeviceEnvironment, const GraphicsAllocation &allocation)); ADDMETHOD_CONST_NOBASE(isDeviceUsmAllocationReuseSupported, bool, false, ()); ADDMETHOD_CONST_NOBASE(isHostUsmAllocationReuseSupported, bool, false, ()); - ADDMETHOD_CONST_NOBASE(isUsmPoolAllocatorSupported, bool, false, ()); + ADDMETHOD_CONST_NOBASE(isHostUsmPoolAllocatorSupported, bool, false, ()); + ADDMETHOD_CONST_NOBASE(isDeviceUsmPoolAllocatorSupported, bool, false, ()); ADDMETHOD_CONST_NOBASE(is2MBLocalMemAlignmentEnabled, bool, false, ()); ADDMETHOD_CONST_NOBASE(isDisableScratchPagesRequiredForDebugger, bool, true, ()); }; diff --git a/shared/test/unit_test/device/neo_device_tests.cpp b/shared/test/unit_test/device/neo_device_tests.cpp index 2c3d51f31c..800737f534 100644 --- a/shared/test/unit_test/device/neo_device_tests.cpp +++ b/shared/test/unit_test/device/neo_device_tests.cpp @@ -2039,7 +2039,7 @@ TEST_F(DeviceTests, givenNewUsmPoolingEnabledWhenDeviceInitializedThenUsmMemAllo auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u); auto mockProductHelper = new MockProductHelper; executionEnvironment->rootDeviceEnvironments[0]->productHelper.reset(mockProductHelper); - mockProductHelper->isUsmPoolAllocatorSupportedResult = true; + mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true; UltDeviceFactory deviceFactory{1, 1, *executionEnvironment}; auto device = deviceFactory.rootDevices[0]; auto usmMemAllocPoolsManager = device->getUsmMemAllocPoolsManager(); @@ -2052,7 +2052,7 @@ TEST_F(DeviceTests, givenNewUsmPoolingEnabledWhenDeviceInitializedThenUsmMemAllo auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u); auto mockProductHelper = new MockProductHelper; executionEnvironment->rootDeviceEnvironments[0]->productHelper.reset(mockProductHelper); - mockProductHelper->isUsmPoolAllocatorSupportedResult = true; + mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true; UltDeviceFactory deviceFactory{1, 1, *executionEnvironment}; auto device = deviceFactory.rootDevices[0]; auto usmMemAllocPoolsManager = device->getUsmMemAllocPoolsManager(); @@ -2064,7 +2064,7 @@ TEST_F(DeviceTests, givenNewUsmPoolingEnabledWhenDeviceInitializedThenUsmMemAllo auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u); auto mockProductHelper = new MockProductHelper; executionEnvironment->rootDeviceEnvironments[0]->productHelper.reset(mockProductHelper); - mockProductHelper->isUsmPoolAllocatorSupportedResult = false; + mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = false; UltDeviceFactory deviceFactory{1, 1, *executionEnvironment}; auto device = deviceFactory.rootDevices[0]; auto usmMemAllocPoolsManager = device->getUsmMemAllocPoolsManager(); @@ -2077,7 +2077,7 @@ TEST_F(DeviceTests, givenNewUsmPoolingEnabledWhenDeviceInitializedThenUsmMemAllo auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u); auto mockProductHelper = new MockProductHelper; executionEnvironment->rootDeviceEnvironments[0]->productHelper.reset(mockProductHelper); - mockProductHelper->isUsmPoolAllocatorSupportedResult = true; + mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true; UltDeviceFactory deviceFactory{1, 1, *executionEnvironment}; auto device = deviceFactory.rootDevices[0]; auto usmMemAllocPoolsManager = device->getUsmMemAllocPoolsManager(); diff --git a/shared/test/unit_test/os_interface/product_helper_tests.cpp b/shared/test/unit_test/os_interface/product_helper_tests.cpp index b71c43c102..efd59bfd72 100644 --- a/shared/test/unit_test/os_interface/product_helper_tests.cpp +++ b/shared/test/unit_test/os_interface/product_helper_tests.cpp @@ -810,16 +810,28 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsBufferPoolAllocator EXPECT_TRUE(productHelper->isBufferPoolAllocatorSupported()); } -HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsUsmPoolAllocatorSupportedThenCorrectValueIsReturned, IsBeforeXeHpgCore) { - EXPECT_FALSE(productHelper->isUsmPoolAllocatorSupported()); +HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsHostUsmPoolAllocatorSupportedThenCorrectValueIsReturned, IsBeforeXeHpgCore) { + EXPECT_FALSE(productHelper->isHostUsmPoolAllocatorSupported()); } -HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsUsmPoolAllocatorSupportedThenCorrectValueIsReturned, IsXeHpcCore) { - EXPECT_FALSE(productHelper->isUsmPoolAllocatorSupported()); +HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsDeviceUsmPoolAllocatorSupportedThenCorrectValueIsReturned, IsBeforeXeHpgCore) { + EXPECT_FALSE(productHelper->isDeviceUsmPoolAllocatorSupported()); } -HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsUsmPoolAllocatorSupportedThenCorrectValueIsReturned, IsXeHpgCore) { - EXPECT_TRUE(productHelper->isUsmPoolAllocatorSupported()); +HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsHostUsmPoolAllocatorSupportedThenCorrectValueIsReturned, IsXeHpcCore) { + EXPECT_FALSE(productHelper->isHostUsmPoolAllocatorSupported()); +} + +HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsDeviceUsmPoolAllocatorSupportedThenCorrectValueIsReturned, IsXeHpcCore) { + EXPECT_FALSE(productHelper->isDeviceUsmPoolAllocatorSupported()); +} + +HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsHostUsmPoolAllocatorSupportedThenCorrectValueIsReturned, IsXeHpgCore) { + EXPECT_TRUE(productHelper->isHostUsmPoolAllocatorSupported()); +} + +HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsDeviceUsmPoolAllocatorSupportedThenCorrectValueIsReturned, IsXeHpgCore) { + EXPECT_TRUE(productHelper->isDeviceUsmPoolAllocatorSupported()); } HWTEST2_F(ProductHelperTest, givenProductHelperWhenCheckingIsDeviceUsmAllocationReuseSupportedThenCorrectValueIsReturned, IsAtMostDg2) {