diff --git a/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl b/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl index c73824ce5b..0c13761ec6 100644 --- a/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl +++ b/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -17,9 +17,9 @@ namespace NEO { template <> void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const EncodeSurfaceStateArgs &args) { using L1_CACHE_POLICY = typename R_SURFACE_STATE::L1_CACHE_POLICY; - const auto &hwInfo = *args.gmmHelper->getHardwareInfo(); - auto productHelper = ProductHelper::get(hwInfo.platform.eProductFamily); - auto cachePolicy = static_cast(productHelper->getL1CachePolicy(args.isDebuggerActive)); + auto &productHelper = args.gmmHelper->getRootDeviceEnvironment().getHelper(); + + auto cachePolicy = static_cast(productHelper.getL1CachePolicy(args.isDebuggerActive)); if (DebugManager.flags.OverrideL1CacheControlInSurfaceState.get() != -1 && DebugManager.flags.ForceAllResourcesUncached.get() == false) { cachePolicy = static_cast(DebugManager.flags.OverrideL1CacheControlInSurfaceState.get()); diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 9a3a381537..ff81b9e5f8 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -644,7 +644,8 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemory(const AllocationData & if (use32Allocator || isAllocationOnLimitedGPU || (force32bitAllocations && allocationData.flags.allow32Bit && is64bit)) { auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); - bool useLocalMem = heapAssigner.useExternal32BitHeap(allocationData.type) ? ProductHelper::get(hwInfo->platform.eProductFamily)->heapInLocalMem(*hwInfo) : false; + auto &productHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHelper(); + bool useLocalMem = heapAssigner.useExternal32BitHeap(allocationData.type) ? productHelper.heapInLocalMem(*hwInfo) : false; return allocate32BitGraphicsMemoryImpl(allocationData, useLocalMem); } if (allocationData.flags.isUSMHostAllocation && allocationData.hostPtr) { diff --git a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp index 8da5e30949..12bffd60db 100644 --- a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp @@ -289,7 +289,7 @@ void EncodeDispatchKernel::appendAdditionalIDDFields(INTERFACE_DESCRIPTO } } - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = rootDeviceEnvironment.getHelper(); if ((slmSize == 0) && (productHelper.isAdjustProgrammableIdPreferredSlmSizeRequired(hwInfo))) { programmableIdPreferredSlmSize = PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K; diff --git a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp index 5cb891073b..e9848e95ef 100644 --- a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp @@ -72,8 +72,8 @@ void EncodeDispatchKernel::appendAdditionalIDDFields(INTERFACE_DESCRIPTO break; } } - - if (ProductHelper::get(hwInfo.platform.eProductFamily)->isAllocationSizeAdjustmentRequired(hwInfo)) { + auto &productHelper = rootDeviceEnvironment.getHelper(); + if (productHelper.isAllocationSizeAdjustmentRequired(hwInfo)) { pInterfaceDescriptor->setPreferredSlmAllocationSize(PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K); } else { pInterfaceDescriptor->setPreferredSlmAllocationSize(programmableIdPreferredSlmSize); diff --git a/shared/test/unit_test/encoders/command_encoder_tests_dg2.cpp b/shared/test/unit_test/encoders/command_encoder_tests_dg2.cpp index 1762c3b916..d430e46d3c 100644 --- a/shared/test/unit_test/encoders/command_encoder_tests_dg2.cpp +++ b/shared/test/unit_test/encoders/command_encoder_tests_dg2.cpp @@ -72,7 +72,7 @@ HWTEST2_F(DG2CommandEncoderTest, givenInterfaceDescriptorDataWhenForceThreadGrou iddArg = FamilyType::cmdInitInterfaceDescriptorData; const uint32_t forceThreadGroupDispatchSize = -1; auto hwInfo = pDevice->getHardwareInfo(); - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = pDevice->getProductHelper(); DebugManagerStateRestore restorer; DebugManager.flags.ForceThreadGroupDispatchSize.set(forceThreadGroupDispatchSize); diff --git a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.cpp b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.cpp index 94fd011076..d57b821731 100644 --- a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.cpp +++ b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.cpp @@ -89,8 +89,9 @@ HWTEST2_F(CommandEncodeStatesTestDg2AndLater, GivenVariousSlmTotalSizesAndSettin const std::array revs{REVISION_A0, REVISION_B, REVISION_C, REVISION_D, REVISION_K}; auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + auto &productHelper = pDevice->getRootDeviceEnvironment().getProductHelper(); for (auto rev : revs) { - hwInfo.platform.usRevId = ProductHelper::get(productFamily)->getHwRevIdFromStepping(rev, hwInfo); + hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(rev, hwInfo); verifyPreferredSlmValues(valuesToTest, pDevice->getRootDeviceEnvironment()); } } diff --git a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_pvc_and_later.cpp b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_pvc_and_later.cpp index 0a011ea851..0635a6a604 100644 --- a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_pvc_and_later.cpp +++ b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_pvc_and_later.cpp @@ -121,9 +121,10 @@ HWTEST2_F(CommandEncodeStatesTestHpc, GivenVariousSlmTotalSizesAndSettingRevIDTo const std::array revs{REVISION_A0, REVISION_B, REVISION_C, REVISION_D, REVISION_K}; auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + auto &productHelper = pDevice->getRootDeviceEnvironment().getProductHelper(); for (auto rev : revs) { - hwInfo.platform.usRevId = ProductHelper::get(productFamily)->getHwRevIdFromStepping(rev, hwInfo); + hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(rev, hwInfo); if ((hwInfo.platform.eProductFamily == IGFX_PVC) && (rev == REVISION_A0)) { verifyPreferredSlmValues(valuesToTestForPvcAStep, pDevice->getRootDeviceEnvironment()); } else { diff --git a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp index fc1bc656ca..2de6cae66e 100644 --- a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp +++ b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp @@ -646,7 +646,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenInterfaceDescriptorDa iddArg = FamilyType::cmdInitInterfaceDescriptorData; const uint32_t forceThreadGroupDispatchSize = -1; auto hwInfo = pDevice->getHardwareInfo(); - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = pDevice->getProductHelper(); DebugManagerStateRestore restorer; DebugManager.flags.ForceThreadGroupDispatchSize.set(forceThreadGroupDispatchSize); diff --git a/shared/test/unit_test/fixtures/command_container_fixture.cpp b/shared/test/unit_test/fixtures/command_container_fixture.cpp index 50ff28d7a4..e4d6f85f45 100644 --- a/shared/test/unit_test/fixtures/command_container_fixture.cpp +++ b/shared/test/unit_test/fixtures/command_container_fixture.cpp @@ -18,7 +18,8 @@ void CommandEncodeStatesFixture::setUp() { cmdContainer->initialize(pDevice, nullptr, true); cmdContainer->setDirtyStateForAllHeaps(false); const auto &hwInfo = pDevice->getHardwareInfo(); - cmdContainer->systolicModeSupport = ProductHelper::get(hwInfo.platform.eProductFamily)->isSystolicModeConfigurable(hwInfo); + auto &productHelper = pDevice->getProductHelper(); + cmdContainer->systolicModeSupport = productHelper.isSystolicModeConfigurable(hwInfo); } void CommandEncodeStatesFixture::tearDown() { diff --git a/shared/test/unit_test/gen12lp/coherency_tests_gen12lp.inl b/shared/test/unit_test/gen12lp/coherency_tests_gen12lp.inl index 3c4eb7f3ae..61566d2cdb 100644 --- a/shared/test/unit_test/gen12lp/coherency_tests_gen12lp.inl +++ b/shared/test/unit_test/gen12lp/coherency_tests_gen12lp.inl @@ -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); diff --git a/shared/test/unit_test/gen12lp/command_encoder_tests_gen12lp.cpp b/shared/test/unit_test/gen12lp/command_encoder_tests_gen12lp.cpp index e25d9288a9..ef22c99cbc 100644 --- a/shared/test/unit_test/gen12lp/command_encoder_tests_gen12lp.cpp +++ b/shared/test/unit_test/gen12lp/command_encoder_tests_gen12lp.cpp @@ -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::getCmdSizeForPipelineSelect(device.getHardwareInfo()), EncodeWA::getAdditionalPipelineSelectSize(device, csr->isRcs())); } else { diff --git a/shared/test/unit_test/gen12lp/sampler_tests_gen12lp.inl b/shared/test/unit_test/gen12lp/sampler_tests_gen12lp.inl index 042cc4ac58..28c54cee97 100644 --- a/shared/test/unit_test/gen12lp/sampler_tests_gen12lp.inl +++ b/shared/test/unit_test/gen12lp/sampler_tests_gen12lp.inl @@ -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(); 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(); 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()); } diff --git a/shared/test/unit_test/gen12lp/test_command_encoder_gen12lp.cpp b/shared/test/unit_test/gen12lp/test_command_encoder_gen12lp.cpp index 03fc483084..1980bf374d 100644 --- a/shared/test/unit_test/gen12lp/test_command_encoder_gen12lp.cpp +++ b/shared/test/unit_test/gen12lp/test_command_encoder_gen12lp.cpp @@ -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::parseCommandBuffer(commands, ptrOffset(cmdContainer.getCommandStream()->getCpuBase(), 0), cmdContainer.getCommandStream()->getUsed()); auto itorLRI = find(commands.begin(), commands.end()); - if (ProductHelper::get(defaultHwInfo->platform.eProductFamily)->is3DPipelineSelectWARequired()) { + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + if (productHelper.is3DPipelineSelectWARequired()) { EXPECT_NE(itorLRI, commands.end()); } else { EXPECT_EQ(itorLRI, commands.end());