diff --git a/level_zero/core/source/module/module_imp.cpp b/level_zero/core/source/module/module_imp.cpp index 5a9acc89ac..a1c078cd04 100644 --- a/level_zero/core/source/module/module_imp.cpp +++ b/level_zero/core/source/module/module_imp.cpp @@ -586,7 +586,7 @@ ze_result_t ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neo auto failBuildProgram = containsStatefulAccess && isUserKernel && - NEO::AddressingModeHelper::failBuildProgramWithStatefulAccess(hwInfo); + NEO::AddressingModeHelper::failBuildProgramWithStatefulAccess(neoDevice->getRootDeviceEnvironment()); if (failBuildProgram) { result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; diff --git a/opencl/source/program/build.cpp b/opencl/source/program/build.cpp index cb83832d4d..c051c501b8 100644 --- a/opencl/source/program/build.cpp +++ b/opencl/source/program/build.cpp @@ -168,7 +168,7 @@ cl_int Program::build( auto failBuildProgram = (containsStatefulAccess && isUserKernel && - AddressingModeHelper::failBuildProgramWithStatefulAccess(clDevices[0]->getHardwareInfo())); + AddressingModeHelper::failBuildProgramWithStatefulAccess(clDevices[0]->getRootDeviceEnvironment())); if (failBuildProgram) { retVal = CL_BUILD_PROGRAM_FAILURE; diff --git a/shared/source/helpers/addressing_mode_helper.cpp b/shared/source/helpers/addressing_mode_helper.cpp index f5089eb5d2..3688bb39aa 100644 --- a/shared/source/helpers/addressing_mode_helper.cpp +++ b/shared/source/helpers/addressing_mode_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,18 +8,19 @@ #include "addressing_mode_helper.h" #include "shared/source/debug_settings/debug_settings_manager.h" +#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/compiler_hw_info_config.h" #include "shared/source/program/kernel_info.h" namespace NEO::AddressingModeHelper { -bool failBuildProgramWithStatefulAccess(const HardwareInfo &hwInfo) { +bool failBuildProgramWithStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment) { auto failBuildProgram = false; if (NEO::DebugManager.flags.FailBuildProgramWithStatefulAccess.get() != -1) { failBuildProgram = static_cast(NEO::DebugManager.flags.FailBuildProgramWithStatefulAccess.get()); } - const auto &compilerProductHelper = *CompilerProductHelper::get(hwInfo.platform.eProductFamily); + const auto &compilerProductHelper = rootDeviceEnvironment.getHelper(); auto forceToStatelessRequired = compilerProductHelper.isForceToStatelessRequired(); return failBuildProgram && forceToStatelessRequired; diff --git a/shared/source/helpers/addressing_mode_helper.h b/shared/source/helpers/addressing_mode_helper.h index 79dd6b4225..d9b66f6468 100644 --- a/shared/source/helpers/addressing_mode_helper.h +++ b/shared/source/helpers/addressing_mode_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,10 +10,10 @@ namespace NEO { struct KernelInfo; -struct HardwareInfo; +struct RootDeviceEnvironment; namespace AddressingModeHelper { -bool failBuildProgramWithStatefulAccess(const HardwareInfo &hwInfo); +bool failBuildProgramWithStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment); bool containsStatefulAccess(const std::vector &kernelInfos); } // namespace AddressingModeHelper diff --git a/shared/test/common/fixtures/device_fixture.cpp b/shared/test/common/fixtures/device_fixture.cpp index cec4d09175..cafe46aa9e 100644 --- a/shared/test/common/fixtures/device_fixture.cpp +++ b/shared/test/common/fixtures/device_fixture.cpp @@ -48,5 +48,6 @@ HelperType &DeviceFixture::getHelper() const { template ProductHelper &DeviceFixture::getHelper() const; template GfxCoreHelper &DeviceFixture::getHelper() const; +template CompilerProductHelper &DeviceFixture::getHelper() const; } // namespace NEO diff --git a/shared/test/unit_test/gen12lp/rkl/test_hw_info_config_rkl.cpp b/shared/test/unit_test/gen12lp/rkl/test_hw_info_config_rkl.cpp index f6941c8aee..5fc773df4e 100644 --- a/shared/test/unit_test/gen12lp/rkl/test_hw_info_config_rkl.cpp +++ b/shared/test/unit_test/gen12lp/rkl/test_hw_info_config_rkl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,6 +10,7 @@ #include "shared/source/helpers/hw_helper.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/helpers/default_hw_info.h" +#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" #include "shared/test/common/test_macros/test.h" #include "shared/test/unit_test/os_interface/hw_info_config_tests.h" @@ -138,5 +139,7 @@ RKLTEST_F(RklProductHelper, givenProductHelperWhenAskedIf3DPipelineSelectWAIsReq using CompilerProductHelperHelperTestsRkl = ::testing::Test; RKLTEST_F(CompilerProductHelperHelperTestsRkl, givenRklWhenIsForceEmuInt32DivRemSPRequiredIsCalledThenReturnsTrue) { - EXPECT_TRUE(CompilerProductHelper::get(productFamily)->isForceEmuInt32DivRemSPRequired()); + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &compilerProductHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + EXPECT_TRUE(compilerProductHelper.isForceEmuInt32DivRemSPRequired()); } diff --git a/shared/test/unit_test/helpers/compiler_hw_info_config_tests.cpp b/shared/test/unit_test/helpers/compiler_hw_info_config_tests.cpp index f5d788fa8e..f5539c3fab 100644 --- a/shared/test/unit_test/helpers/compiler_hw_info_config_tests.cpp +++ b/shared/test/unit_test/helpers/compiler_hw_info_config_tests.cpp @@ -38,7 +38,7 @@ HWTEST_F(CompilerProductHelperFixture, WhenAdjustHwInfoForIgcIsCalledThenHwInfoN using IsBeforeXeHpc = IsBeforeGfxCore; HWTEST2_F(CompilerProductHelperFixture, GivenProductBeforeXeHpcWhenIsForceToStatelessRequiredThenFalseIsReturned, IsBeforeXeHpc) { - auto &compilerProductHelper = *CompilerProductHelper::get(productFamily); + auto &compilerProductHelper = getHelper(); EXPECT_FALSE(compilerProductHelper.isForceToStatelessRequired()); } diff --git a/shared/test/unit_test/helpers/hw_aot_config_tests.cpp b/shared/test/unit_test/helpers/hw_aot_config_tests.cpp index 1980f682d7..6ea937c0bc 100644 --- a/shared/test/unit_test/helpers/hw_aot_config_tests.cpp +++ b/shared/test/unit_test/helpers/hw_aot_config_tests.cpp @@ -1,11 +1,12 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/helpers/compiler_hw_info_config.h" +#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/unit_test/fixtures/product_config_fixture.h" using namespace NEO; @@ -33,7 +34,9 @@ HWTEST2_P(ProductConfigHwInfoBadRevisionTests, givenAotConfigWithIncorrectRevisi HWTEST2_P(ProductConfigHwInfoTests, givenAotConfigWhenSetHwInfoGmdIdThenCorrectValueIsSet, IsAtLeastMtl) { HardwareIpVersion aotConfig = {0}; aotConfig.value = productConfig; - CompilerProductHelper::get(productFamily)->setProductConfigForHwInfo(hwInfo, aotConfig); + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &compilerProductHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + compilerProductHelper.setProductConfigForHwInfo(hwInfo, aotConfig); EXPECT_EQ(hwInfo.ipVersion.architecture, aotConfig.architecture); EXPECT_EQ(hwInfo.ipVersion.release, aotConfig.release); EXPECT_EQ(hwInfo.ipVersion.revision, aotConfig.revision); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/linux/hw_info_config_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/linux/hw_info_config_tests_pvc.cpp index 9c7be4cd8e..a0d5918260 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/linux/hw_info_config_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/linux/hw_info_config_tests_pvc.cpp @@ -73,10 +73,11 @@ PVCTEST_F(PvcProductHelperLinux, givenProductHelperWhenAskedIfPatIndexProgrammin } PVCTEST_F(PvcProductHelperLinux, givenAotConfigWhenSetHwInfoRevisionIdForPvcThenCorrectValueIsSet) { + auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper(); for (const auto &config : AOT_PVC::productConfigs) { HardwareIpVersion aotConfig = {0}; aotConfig.value = config; - CompilerProductHelper::get(pInHwInfo.platform.eProductFamily)->setProductConfigForHwInfo(pInHwInfo, aotConfig); + compilerProductHelper.setProductConfigForHwInfo(pInHwInfo, aotConfig); EXPECT_EQ(pInHwInfo.platform.usRevId, aotConfig.revision); } } diff --git a/shared/test/unit_test/xe_hpg_core/mtl/hw_info_config_tests_mtl.cpp b/shared/test/unit_test/xe_hpg_core/mtl/hw_info_config_tests_mtl.cpp index 444a41dd22..03459b9156 100644 --- a/shared/test/unit_test/xe_hpg_core/mtl/hw_info_config_tests_mtl.cpp +++ b/shared/test/unit_test/xe_hpg_core/mtl/hw_info_config_tests_mtl.cpp @@ -1,11 +1,13 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/command_stream/stream_properties.h" +#include "shared/source/execution_environment/execution_environment.h" +#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/compiler_hw_info_config.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/source/xe_hpg_core/hw_cmds_mtl.h" @@ -155,7 +157,8 @@ MTLTEST_F(MtlProductHelper, givenMtlNotLpgWhenIsBFloat16ConversionSupportedIsCal HardwareIpVersion aotConfig = {0}; aotConfig.architecture = notLpgArchitecture; - CompilerProductHelper::get(hwInfo.platform.eProductFamily)->setProductConfigForHwInfo(hwInfo, aotConfig); + auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + compilerProductHelper.setProductConfigForHwInfo(hwInfo, aotConfig); EXPECT_TRUE(productHelper->isBFloat16ConversionSupported(hwInfo)); } @@ -168,7 +171,8 @@ MTLTEST_F(MtlProductHelper, givenMtlLpgWhenIsBFloat16ConversionSupportedIsCalled HardwareIpVersion aotConfig = {0}; aotConfig.architecture = lpgArchitecture; aotConfig.release = lpgRelease; - CompilerProductHelper::get(hwInfo.platform.eProductFamily)->setProductConfigForHwInfo(hwInfo, aotConfig); + auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + compilerProductHelper.setProductConfigForHwInfo(hwInfo, aotConfig); EXPECT_FALSE(productHelper->isBFloat16ConversionSupported(hwInfo)); }