refactor: don't use global ProductHelper getter 6/n

Related-To: NEO-6853
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2023-01-23 13:20:47 +00:00
committed by Compute-Runtime-Automation
parent 8ba950176d
commit e9990dd124
13 changed files with 32 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 Intel Corporation
* Copyright (C) 2019-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -63,7 +63,7 @@ struct Gen12LpCoherencyRequirements : public ::testing::Test {
GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenNoSharedHandlesWhenGettingCmdSizeThenSizeIsCorrect) {
auto cmdsSize = sizeof(STATE_COMPUTE_MODE);
const auto &productHelper = *ProductHelper::get(device->getHardwareInfo().platform.eProductFamily);
const auto &productHelper = device->getProductHelper();
if (productHelper.is3DPipelineSelectWARequired()) {
cmdsSize += 2 * sizeof(PIPELINE_SELECT);
if (SpecialUltHelperGen12lp::isPipeControlWArequired(device->getHardwareInfo().platform.eProductFamily)) {
@@ -90,7 +90,7 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenNoSharedHandlesWhenGettingCmdSi
GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenSharedHandlesWhenGettingCmdSizeThenSizeIsCorrect) {
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
const auto &productHelper = *ProductHelper::get(device->getHardwareInfo().platform.eProductFamily);
const auto &productHelper = device->getProductHelper();
if (productHelper.is3DPipelineSelectWARequired()) {
cmdsSize += 2 * sizeof(PIPELINE_SELECT);
if (SpecialUltHelperGen12lp::isPipeControlWArequired(device->getHardwareInfo().platform.eProductFamily)) {
@@ -118,7 +118,7 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenSharedHandlesWhenGettingCmdSize
GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenNoSharedHandlesThenCoherencyCmdValuesAreCorrect) {
auto cmdsSize = sizeof(STATE_COMPUTE_MODE);
auto cmdsSizeWABeginOffset = 0;
const auto &productHelper = *ProductHelper::get(device->getHardwareInfo().platform.eProductFamily);
const auto &productHelper = device->getProductHelper();
if (productHelper.is3DPipelineSelectWARequired()) {
cmdsSizeWABeginOffset += sizeof(PIPELINE_SELECT);
cmdsSize += sizeof(PIPELINE_SELECT);
@@ -158,7 +158,7 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenNoSharedHandlesThenCoherencyCmd
GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenSharedHandlesThenCoherencyCmdValuesAreCorrect) {
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
auto cmdsSizeWABeginOffset = 0;
const auto &productHelper = *ProductHelper::get(device->getHardwareInfo().platform.eProductFamily);
const auto &productHelper = device->getProductHelper();
if (productHelper.is3DPipelineSelectWARequired()) {
cmdsSizeWABeginOffset += sizeof(PIPELINE_SELECT);
cmdsSize += sizeof(PIPELINE_SELECT);

View File

@@ -33,7 +33,7 @@ GEN12LPTEST_F(Gen12LpCommandEncodeTest, WhenDefaultEngineIsRcsAnd3DPipelineSelec
auto oldCsr = device.getDefaultEngine().commandStreamReceiver;
device.getDefaultEngine().commandStreamReceiver = csr.get();
auto &productHelper = *ProductHelper::get(device.getHardwareInfo().platform.eProductFamily);
const auto &productHelper = device.getProductHelper();
if (productHelper.is3DPipelineSelectWARequired()) {
EXPECT_EQ(2 * PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(device.getHardwareInfo()), EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device, csr->isRcs()));
} else {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 Intel Corporation
* Copyright (C) 2019-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,8 +21,9 @@ HWTEST2_F(Gen12LpSamplerTest, givenTglLpSamplerWhenUsingDefaultFilteringAndAppen
EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
auto state = FamilyType::cmdInitSamplerState;
auto &productHelper = getHelper<ProductHelper>();
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
ProductHelper::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
productHelper.adjustSamplerState(&state, *defaultHwInfo);
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
}
@@ -31,9 +32,10 @@ HWTEST2_F(Gen12LpSamplerTest, givenTglLpSamplerWhenForcingLowQualityFilteringAnd
DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true);
EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
auto &productHelper = getHelper<ProductHelper>();
auto state = FamilyType::cmdInitSamplerState;
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
ProductHelper::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
productHelper.adjustSamplerState(&state, *defaultHwInfo);
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
}

View File

@@ -16,6 +16,7 @@
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
@@ -98,7 +99,9 @@ GEN12LPTEST_F(CommandEncodeStatesTest, givenVariousEngineTypesWhenEncodeSbaThenA
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer.getCommandStream()->getCpuBase(), 0), cmdContainer.getCommandStream()->getUsed());
auto itorLRI = find<PIPELINE_SELECT *>(commands.begin(), commands.end());
if (ProductHelper::get(defaultHwInfo->platform.eProductFamily)->is3DPipelineSelectWARequired()) {
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
if (productHelper.is3DPipelineSelectWARequired()) {
EXPECT_NE(itorLRI, commands.end());
} else {
EXPECT_EQ(itorLRI, commands.end());