Refactor: don't use global ProductHelper getter in shared files 4/n

Related-To: NEO-6853
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2023-01-02 12:19:09 +00:00
committed by Compute-Runtime-Automation
parent 173f12d940
commit aec6a42d69
15 changed files with 48 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,7 +18,7 @@ bool ProductHelperHw<gfxProduct>::isPageTableManagerSupported(const HardwareInfo
}
template <>
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const {
using SAMPLER_STATE = typename Gen12LpFamily::SAMPLER_STATE;
auto samplerState = reinterpret_cast<SAMPLER_STATE *>(sampler);
if (DebugManager.flags.ForceSamplerLowFilteringPrecision.get()) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -58,7 +58,7 @@ class ProductHelper {
int configureHwInfoDrm(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, const RootDeviceEnvironment &rootDeviceEnvironemnt);
virtual int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const = 0;
virtual void adjustPlatformForProductFamily(HardwareInfo *hwInfo) = 0;
virtual void adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) = 0;
virtual void adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const = 0;
virtual void disableRcsExposure(HardwareInfo *hwInfo) const = 0;
virtual uint64_t getHostMemCapabilities(const HardwareInfo *hwInfo) const = 0;
virtual uint64_t getDeviceMemCapabilities() const = 0;
@@ -204,7 +204,7 @@ class ProductHelperHw : public ProductHelper {
}
int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const override;
void adjustPlatformForProductFamily(HardwareInfo *hwInfo) override;
void adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) override;
void adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const override;
void disableRcsExposure(HardwareInfo *hwInfo) const override;
uint64_t getHostMemCapabilities(const HardwareInfo *hwInfo) const override;
uint64_t getDeviceMemCapabilities() const override;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -48,7 +48,7 @@ template <PRODUCT_FAMILY gfxProduct>
void ProductHelperHw<gfxProduct>::adjustPlatformForProductFamily(HardwareInfo *hwInfo) {}
template <PRODUCT_FAMILY gfxProduct>
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {}
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const {}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isTlbFlushRequired(aub_stream::EngineType engineType) const {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -46,7 +46,7 @@ bool ProductHelperHw<gfxProduct>::isMaxThreadsForWorkgroupWARequired(const Hardw
}
template <>
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const {
using SAMPLER_STATE = typename XeHpFamily::SAMPLER_STATE;
auto samplerState = reinterpret_cast<SAMPLER_STATE *>(sampler);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -49,7 +49,7 @@ bool ProductHelperHw<gfxProduct>::isTlbFlushRequired(aub_stream::EngineType engi
}
template <>
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const {
using SAMPLER_STATE = typename XeHpcCoreFamily::SAMPLER_STATE;
auto samplerState = reinterpret_cast<SAMPLER_STATE *>(sampler);

View File

@@ -11,7 +11,7 @@
namespace NEO {
template <>
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const {
using SAMPLER_STATE = typename XeHpgCoreFamily::SAMPLER_STATE;
auto samplerState = reinterpret_cast<SAMPLER_STATE *>(sampler);
if (DebugManager.flags.ForceSamplerLowFilteringPrecision.get()) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,7 +11,7 @@
namespace NEO {
template <>
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const {
using SAMPLER_STATE = typename XeHpgCoreFamily::SAMPLER_STATE;
auto samplerState = reinterpret_cast<SAMPLER_STATE *>(sampler);
if (DebugManager.flags.ForceSamplerLowFilteringPrecision.get()) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,7 +16,7 @@
namespace NEO {
template <>
void ProductHelperHw<IGFX_UNKNOWN>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
void ProductHelperHw<IGFX_UNKNOWN>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const {
}
template <>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -79,7 +79,7 @@ TEST_F(AubCenterTests, WhenAubManagerIsCreatedThenCorrectSteppingIsSet) {
DebugManager.flags.UseAubStream.set(true);
auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
for (auto steppingPair : steppingPairsToTest) {
auto hwRevId = productHelper.getHwRevIdFromStepping(steppingPair.stepping, hwInfo);
if (hwRevId == CommonConstants::invalidStepping) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -2090,7 +2090,8 @@ TEST_F(CommandStreamReceiverPageTableManagerTest, givenNonExisitingPageTableMana
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiver commandStreamReceiver(executionEnvironment, 0u, deviceBitfield);
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
bool supportsPageTableManager = ProductHelper::get(hwInfo->platform.eProductFamily)->isPageTableManagerSupported(*hwInfo);
auto &productHelper = executionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
bool supportsPageTableManager = productHelper.isPageTableManagerSupported(*hwInfo);
EXPECT_EQ(nullptr, commandStreamReceiver.pageTableManager.get());
EXPECT_EQ(supportsPageTableManager, commandStreamReceiver.needsPageTableManager());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -23,7 +23,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ComputeModeRequirements, givenCoherencyWithoutShare
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
setUpImpl<FamilyType>();
const auto &productHelper = *ProductHelper::get(productFamily);
const auto &productHelper = device->getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo, csr->isRcs());
std::ignore = isExtendedWARequired;
@@ -54,7 +54,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ComputeModeRequirements, givenCoherencyWithSharedHa
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
const auto &productHelper = *ProductHelper::get(productFamily);
const auto &productHelper = device->getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo, csr->isRcs());
std::ignore = isExtendedWARequired;
@@ -95,7 +95,7 @@ HWTEST2_F(ComputeModeRequirements, givenCoherencyWithoutSharedHandlesWhenCompute
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
const auto &productHelper = *ProductHelper::get(productFamily);
const auto &productHelper = device->getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo, csr->isRcs());
std::ignore = isExtendedWARequired;
@@ -145,7 +145,7 @@ HWTEST2_F(ComputeModeRequirements, givenCoherencyWithSharedHandlesWhenComputeMod
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
const auto &productHelper = *ProductHelper::get(productFamily);
const auto &productHelper = device->getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo, csr->isRcs());
std::ignore = isExtendedWARequired;
@@ -343,7 +343,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ComputeModeRequirements, givenComputeModeCmdSizeWhe
overrideComputeModeRequest<FamilyType>(false, false, false, false, 128u);
EXPECT_FALSE(getCsrHw<FamilyType>()->streamProperties.stateComputeMode.isDirty());
const auto &productHelper = *ProductHelper::get(productFamily);
const auto &productHelper = device->getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo, csr->isRcs());
std::ignore = isExtendedWARequired;
@@ -368,7 +368,7 @@ HWTEST2_F(ComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfModeCh
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
const auto &productHelper = *ProductHelper::get(productFamily);
const auto &productHelper = device->getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo, csr->isRcs());
std::ignore = isExtendedWARequired;
@@ -430,7 +430,7 @@ HWTEST2_F(ComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNum
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
const auto &productHelper = *ProductHelper::get(productFamily);
const auto &productHelper = device->getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo, csr->isRcs());
std::ignore = isExtendedWARequired;
@@ -464,7 +464,7 @@ HWTEST2_F(ComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNum
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
const auto &productHelper = *ProductHelper::get(productFamily);
const auto &productHelper = device->getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo, csr->isRcs());
std::ignore = isExtendedWARequired;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -267,8 +267,9 @@ TEST(StreamPropertiesTests, givenOtherPipelineSelectPropertiesStructWhenSetPrope
}
TEST(StreamPropertiesTests, givenSingleDispatchCcsFrontEndPropertyWhenSettingPropertyAndCheckIfSupportedThenExpectCorrectState) {
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
FrontEndPropertiesSupport fePropertiesSupport{};
auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily);
productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, *defaultHwInfo);
MockFrontEndProperties feProperties{};
@@ -295,11 +296,12 @@ TEST(StreamPropertiesTests, givenSingleDispatchCcsFrontEndPropertyWhenSettingPro
}
TEST(StreamPropertiesTests, whenSettingPipelineSelectPropertiesThenCorrectValueIsSet) {
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
StreamProperties properties;
PipelineSelectPropertiesSupport pipelineSelectPropertiesSupport = {};
auto productHelper = ProductHelper::get(defaultHwInfo->platform.eProductFamily);
productHelper->fillPipelineSelectPropertiesSupportStructure(pipelineSelectPropertiesSupport, *defaultHwInfo);
productHelper.fillPipelineSelectPropertiesSupportStructure(pipelineSelectPropertiesSupport, *defaultHwInfo);
for (auto modeSelected : ::testing::Bool()) {
for (auto mediaSamplerDopClockGate : ::testing::Bool()) {
@@ -422,9 +424,10 @@ TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagStateWhenSettingProp
}
TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagDefaultValueWhenSettingPropertyAndCheckIfDirtyThenExpectValueSetForSupportedAndCleanForNotSupported) {
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
StateBaseAddressPropertiesSupport sbaPropertiesSupport = {};
auto productHelper = ProductHelper::get(defaultHwInfo->platform.eProductFamily);
productHelper->fillStateBaseAddressPropertiesSupportStructure(sbaPropertiesSupport, *defaultHwInfo);
productHelper.fillStateBaseAddressPropertiesSupportStructure(sbaPropertiesSupport, *defaultHwInfo);
StateBaseAddressProperties sbaProperties{};

View File

@@ -961,7 +961,9 @@ HWTEST_F(DirectSubmissionTest,
EXPECT_EQ(expectedStoreAddress, storeDataCmdAtPosition->getAddress());
cmdBufferPosition += sizeof(MI_STORE_DATA_IMM);
if (ProductHelper::get(defaultHwInfo->platform.eProductFamily)->isPrefetcherDisablingInDirectSubmissionRequired()) {
auto &productHelper = pDevice->getProductHelper();
if (productHelper.isPrefetcherDisablingInDirectSubmissionRequired()) {
cmdBufferPosition += directSubmission.getSizeDisablePrefetcher();
}
MI_SEMAPHORE_WAIT *semaphoreWaitCmdAtPosition = genCmdCast<MI_SEMAPHORE_WAIT *>(cmdBufferPosition);

View File

@@ -41,8 +41,8 @@ struct DirectSubmissionDispatchMiMemFenceTest : public DirectSubmissionDispatchB
void SetUp() override {
DirectSubmissionDispatchBufferTest::SetUp();
auto productHelper = ProductHelper::get(pDevice->getHardwareInfo().platform.eProductFamily);
miMemFenceSupported = productHelper->isGlobalFenceInDirectSubmissionRequired(pDevice->getHardwareInfo());
auto &productHelper = pDevice->getProductHelper();
miMemFenceSupported = productHelper.isGlobalFenceInDirectSubmissionRequired(pDevice->getHardwareInfo());
}
template <typename FamilyType>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -529,8 +529,8 @@ HWTEST_F(DrmDirectSubmissionTest, givenDisabledMonitorFenceWhenUpdateTagValueThe
HWTEST_F(DrmDirectSubmissionTest, whenCheckForDirectSubmissionSupportThenProperValueIsReturned) {
auto directSubmissionSupported = osContext->isDirectSubmissionSupported(device->getHardwareInfo());
auto productHelper = ProductHelper::get(device->getHardwareInfo().platform.eProductFamily);
EXPECT_EQ(directSubmissionSupported, productHelper->isDirectSubmissionSupported(device->getHardwareInfo()) && executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>()->isVmBindAvailable());
auto &productHelper = device->getProductHelper();
EXPECT_EQ(directSubmissionSupported, productHelper.isDirectSubmissionSupported(device->getHardwareInfo()) && executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>()->isVmBindAvailable());
}
HWTEST_F(DrmDirectSubmissionTest, givenDirectSubmissionNewResourceTlbFlushWhenDispatchCommandBufferThenTlbIsFlushed) {
@@ -566,7 +566,7 @@ HWTEST_F(DrmDirectSubmissionTest, givenNewResourceBoundWhenDispatchCommandBuffer
DebugManagerStateRestore restorer;
DebugManager.flags.DirectSubmissionNewResourceTlbFlush.set(-1);
const auto &productHelper = *ProductHelper::get(device->getHardwareInfo().platform.eProductFamily);
const auto &productHelper = device->getProductHelper();
MockDrmDirectSubmission<FamilyType, Dispatcher> directSubmission(*device->getDefaultEngine().commandStreamReceiver);