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:
Kamil Kopryk
2023-01-23 16:24:42 +00:00
committed by Compute-Runtime-Automation
parent 29012cb6ca
commit 3c6e7e12be
10 changed files with 30 additions and 17 deletions

View File

@@ -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());
}

View File

@@ -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());
}

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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));
}