refactor: Remove global CompilerProductHelper gettter 2/n
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
parent
29012cb6ca
commit
3c6e7e12be
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<bool>(NEO::DebugManager.flags.FailBuildProgramWithStatefulAccess.get());
|
||||
}
|
||||
|
||||
const auto &compilerProductHelper = *CompilerProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
const auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
|
||||
auto forceToStatelessRequired = compilerProductHelper.isForceToStatelessRequired();
|
||||
|
||||
return failBuildProgram && forceToStatelessRequired;
|
||||
|
|
|
@ -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<KernelInfo *> &kernelInfos);
|
||||
|
||||
} // namespace AddressingModeHelper
|
||||
|
|
|
@ -48,5 +48,6 @@ HelperType &DeviceFixture::getHelper() const {
|
|||
|
||||
template ProductHelper &DeviceFixture::getHelper<ProductHelper>() const;
|
||||
template GfxCoreHelper &DeviceFixture::getHelper<GfxCoreHelper>() const;
|
||||
template CompilerProductHelper &DeviceFixture::getHelper<CompilerProductHelper>() const;
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -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<CompilerProductHelper>();
|
||||
EXPECT_TRUE(compilerProductHelper.isForceEmuInt32DivRemSPRequired());
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ HWTEST_F(CompilerProductHelperFixture, WhenAdjustHwInfoForIgcIsCalledThenHwInfoN
|
|||
using IsBeforeXeHpc = IsBeforeGfxCore<IGFX_XE_HPC_CORE>;
|
||||
|
||||
HWTEST2_F(CompilerProductHelperFixture, GivenProductBeforeXeHpcWhenIsForceToStatelessRequiredThenFalseIsReturned, IsBeforeXeHpc) {
|
||||
auto &compilerProductHelper = *CompilerProductHelper::get(productFamily);
|
||||
auto &compilerProductHelper = getHelper<CompilerProductHelper>();
|
||||
EXPECT_FALSE(compilerProductHelper.isForceToStatelessRequired());
|
||||
}
|
||||
|
||||
|
|
|
@ -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>();
|
||||
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);
|
||||
|
|
|
@ -73,10 +73,11 @@ PVCTEST_F(PvcProductHelperLinux, givenProductHelperWhenAskedIfPatIndexProgrammin
|
|||
}
|
||||
|
||||
PVCTEST_F(PvcProductHelperLinux, givenAotConfigWhenSetHwInfoRevisionIdForPvcThenCorrectValueIsSet) {
|
||||
auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper<CompilerProductHelper>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>();
|
||||
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>();
|
||||
compilerProductHelper.setProductConfigForHwInfo(hwInfo, aotConfig);
|
||||
|
||||
EXPECT_FALSE(productHelper->isBFloat16ConversionSupported(hwInfo));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue