From bd6b7d75f036b09a9c36a6dbfaa07a88a76f5c0b Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Thu, 19 Jan 2023 20:30:08 +0000 Subject: [PATCH] refactor: don't use global ProductHelper getter 3/n Related-To: NEO-6853 Signed-off-by: Kamil Kopryk --- level_zero/core/source/cmdlist/cmdlist_hw.inl | 4 ++-- level_zero/core/source/cmdqueue/cmdqueue_hw.inl | 3 +-- .../fixtures/ult_command_stream_receiver_fixture.h | 2 +- .../xe_hpg_core/test_cmds_programming_xe_hpg_core.cpp | 6 +++--- .../command_stream/command_stream_receiver_hw_base.inl | 2 +- .../command_stream/definitions/stream_properties.inl | 4 ++-- shared/source/command_stream/stream_properties.cpp | 8 +++++--- .../command_stream/stream_properties_tests_common.cpp | 2 +- .../test/unit_test/xe_hpc_core/pvc/test_preamble_pvc.cpp | 4 ++-- .../unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp | 4 ++-- 10 files changed, 20 insertions(+), 19 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 4be16a1ede..e34ab73718 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -2347,7 +2347,7 @@ void CommandListCoreFamily::updateStreamProperties(Kernel &kernel auto &kernelAttributes = kernel.getKernelDescriptor().kernelAttributes; if (!containsAnyKernel) { - requiredStreamState.frontEndState.setProperties(isCooperative, kernelAttributes.flags.requiresDisabledEUFusion, true, -1, hwInfo); + requiredStreamState.frontEndState.setProperties(isCooperative, kernelAttributes.flags.requiresDisabledEUFusion, true, -1, rootDeviceEnvironment); requiredStreamState.pipelineSelect.setProperties(true, false, kernelAttributes.flags.usesSystolicPipelineSelectMode, hwInfo); if (this->stateComputeModeTracking) { requiredStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), rootDeviceEnvironment); @@ -2372,7 +2372,7 @@ void CommandListCoreFamily::updateStreamProperties(Kernel &kernel hwInfo); } - finalStreamState.frontEndState.setProperties(isCooperative, kernelAttributes.flags.requiresDisabledEUFusion, true, -1, hwInfo); + finalStreamState.frontEndState.setProperties(isCooperative, kernelAttributes.flags.requiresDisabledEUFusion, true, -1, rootDeviceEnvironment); bool isPatchingVfeStateAllowed = NEO::DebugManager.flags.AllowPatchingVfeStateInCommandLists.get(); if (finalStreamState.frontEndState.isDirty() && logicalStateHelperBlock) { if (isPatchingVfeStateAllowed) { diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index 74cb48821a..f10eb844af 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -628,13 +628,12 @@ size_t CommandQueueHw::estimateLinearStreamSizeInitial( template void CommandQueueHw::setFrontEndStateProperties(CommandListExecutionContext &ctx) { - const auto &hwInfo = this->device->getHwInfo(); auto isEngineInstanced = csr->getOsContext().isEngineInstanced(); auto &streamProperties = this->csr->getStreamProperties(); if (!frontEndTrackingEnabled()) { streamProperties.frontEndState.setProperties(ctx.anyCommandListWithCooperativeKernels, ctx.anyCommandListRequiresDisabledEUFusion, - true, isEngineInstanced, hwInfo); + true, isEngineInstanced, this->device->getNEODevice()->getRootDeviceEnvironment()); ctx.frontEndStateDirty |= (streamProperties.frontEndState.isDirty() && !this->csr->getLogicalStateHelper()); } else { ctx.engineInstanced = isEngineInstanced; diff --git a/opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h b/opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h index d73ac7fb81..67442ad179 100644 --- a/opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h +++ b/opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h @@ -156,7 +156,7 @@ struct UltCommandStreamReceiverTest commandStreamReceiver.streamProperties.pipelineSelect.setProperties(true, false, false, *defaultHwInfo); commandStreamReceiver.streamProperties.stateComputeMode.setProperties(0, GrfConfig::DefaultGrfNumber, gfxCoreHelper.getDefaultThreadArbitrationPolicy(), pDevice->getPreemptionMode(), pDevice->getRootDeviceEnvironment()); - commandStreamReceiver.streamProperties.frontEndState.setProperties(false, false, false, -1, *defaultHwInfo); + commandStreamReceiver.streamProperties.frontEndState.setProperties(false, false, false, -1, pDevice->getRootDeviceEnvironment()); auto logicalStateHelper = commandStreamReceiver.getLogicalStateHelper(); diff --git a/opencl/test/unit_test/xe_hpg_core/test_cmds_programming_xe_hpg_core.cpp b/opencl/test/unit_test/xe_hpg_core/test_cmds_programming_xe_hpg_core.cpp index 0bfb2e78fd..524b95da90 100644 --- a/opencl/test/unit_test/xe_hpg_core/test_cmds_programming_xe_hpg_core.cpp +++ b/opencl/test/unit_test/xe_hpg_core/test_cmds_programming_xe_hpg_core.cpp @@ -324,7 +324,7 @@ HWTEST2_F(PreambleCfeState, givenXehpAndDisabledFusedEuWhenCfeStateProgrammedThe auto pVfeCmd = PreambleHelper::getSpaceForVfeState(&linearStream, hwInfo, EngineGroupType::RenderCompute); StreamProperties streamProperties{}; - streamProperties.frontEndState.setProperties(false, false, false, false, hwInfo); + streamProperties.frontEndState.setProperties(false, false, false, false, rootDeviceEnvironment); PreambleHelper::programVfeState(pVfeCmd, rootDeviceEnvironment, 0u, 0, 0, streamProperties, nullptr); parseCommands(linearStream); auto cfeStateIt = find(cmdList.begin(), cmdList.end()); @@ -346,7 +346,7 @@ HWTEST2_F(PreambleCfeState, givenXehpEnabledFusedEuAndDisableFusedDispatchFromKe auto pVfeCmd = PreambleHelper::getSpaceForVfeState(&linearStream, hwInfo, EngineGroupType::RenderCompute); StreamProperties streamProperties{}; - streamProperties.frontEndState.setProperties(false, true, false, false, hwInfo); + streamProperties.frontEndState.setProperties(false, true, false, false, rootDeviceEnvironment); PreambleHelper::programVfeState(pVfeCmd, rootDeviceEnvironment, 0u, 0, 0, streamProperties, nullptr); parseCommands(linearStream); auto cfeStateIt = find(cmdList.begin(), cmdList.end()); @@ -365,7 +365,7 @@ HWTEST2_F(PreambleCfeState, givenXehpAndEnabledFusedEuWhenCfeStateProgrammedThen auto pVfeCmd = PreambleHelper::getSpaceForVfeState(&linearStream, hwInfo, EngineGroupType::RenderCompute); StreamProperties streamProperties{}; - streamProperties.frontEndState.setProperties(false, false, false, false, hwInfo); + streamProperties.frontEndState.setProperties(false, false, false, false, rootDeviceEnvironment); PreambleHelper::programVfeState(pVfeCmd, rootDeviceEnvironment, 0u, 0, 0, streamProperties, nullptr); parseCommands(linearStream); auto cfeStateIt = find(cmdList.begin(), cmdList.end()); diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index 3b94de862c..99034b38c1 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -1081,7 +1081,7 @@ inline void CommandStreamReceiverHw::programVFEState(LinearStream &cs auto isCooperative = dispatchFlags.kernelExecutionType == KernelExecutionType::Concurrent; auto disableOverdispatch = (dispatchFlags.additionalKernelExecInfo != AdditionalKernelExecInfo::NotSet); - streamProperties.frontEndState.setProperties(isCooperative, dispatchFlags.disableEUFusion, disableOverdispatch, osContext->isEngineInstanced(), hwInfo); + streamProperties.frontEndState.setProperties(isCooperative, dispatchFlags.disableEUFusion, disableOverdispatch, osContext->isEngineInstanced(), peekRootDeviceEnvironment()); auto &gfxCoreHelper = getGfxCoreHelper(); auto engineGroupType = gfxCoreHelper.getEngineGroupType(getOsContext().getEngineType(), getOsContext().getEngineUsage(), hwInfo); diff --git a/shared/source/command_stream/definitions/stream_properties.inl b/shared/source/command_stream/definitions/stream_properties.inl index 29221ae34d..9bae9b6782 100644 --- a/shared/source/command_stream/definitions/stream_properties.inl +++ b/shared/source/command_stream/definitions/stream_properties.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -58,7 +58,7 @@ struct FrontEndProperties { StreamProperty disableOverdispatch{}; StreamProperty singleSliceDispatchCcsMode{}; - void setProperties(bool isCooperativeKernel, bool disableEUFusion, bool disableOverdispatch, int32_t engineInstancedDevice, const HardwareInfo &hwInfo); + void setProperties(bool isCooperativeKernel, bool disableEUFusion, bool disableOverdispatch, int32_t engineInstancedDevice, const RootDeviceEnvironment &rootDeviceEnvironment); void setProperties(const FrontEndProperties &properties); void setPropertySingleSliceDispatchCcsMode(int32_t engineInstancedDevice, const HardwareInfo &hwInfo); bool isDirty() const; diff --git a/shared/source/command_stream/stream_properties.cpp b/shared/source/command_stream/stream_properties.cpp index a6970c9c6b..9a7b964165 100644 --- a/shared/source/command_stream/stream_properties.cpp +++ b/shared/source/command_stream/stream_properties.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -104,9 +104,11 @@ void StateComputeModeProperties::clearIsDirty() { clearIsDirtyExtra(); } -void FrontEndProperties::setProperties(bool isCooperativeKernel, bool disableEUFusion, bool disableOverdispatch, int32_t engineInstancedDevice, const HardwareInfo &hwInfo) { +void FrontEndProperties::setProperties(bool isCooperativeKernel, bool disableEUFusion, bool disableOverdispatch, int32_t engineInstancedDevice, const RootDeviceEnvironment &rootDeviceEnvironment) { if (this->propertiesSupportLoaded == false) { - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + + auto &productHelper = rootDeviceEnvironment.getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); productHelper.fillFrontEndPropertiesSupportStructure(this->frontEndPropertiesSupport, hwInfo); this->propertiesSupportLoaded = true; } diff --git a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp index 8a2580e7a5..164d373e42 100644 --- a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp +++ b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp @@ -74,7 +74,7 @@ TEST(StreamPropertiesTests, whenSettingCooperativeKernelPropertiesThenCorrectVal for (auto isCooperativeKernel : ::testing::Bool()) { for (auto disableOverdispatch : ::testing::Bool()) { for (auto disableEUFusion : ::testing::Bool()) { - properties.frontEndState.setProperties(isCooperativeKernel, disableEUFusion, disableOverdispatch, isEngineInstanced, *defaultHwInfo); + properties.frontEndState.setProperties(isCooperativeKernel, disableEUFusion, disableOverdispatch, isEngineInstanced, rootDeviceEnvironment); if (frontEndPropertiesSupport.computeDispatchAllWalker) { EXPECT_EQ(isCooperativeKernel, properties.frontEndState.computeDispatchAllWalkerEnable.value); } else { diff --git a/shared/test/unit_test/xe_hpc_core/pvc/test_preamble_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/test_preamble_pvc.cpp index 1bd227ca03..2ac1a1721e 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/test_preamble_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/test_preamble_pvc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -31,7 +31,7 @@ PVCTEST_F(PreambleCfeState, givenXeHpcAndKernelExecutionTypeAndRevisionWhenCalli for (const auto &[revision, kernelExecutionType] : revisions) { StreamProperties streamProperties{}; hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(revision, *hwInfo); - streamProperties.frontEndState.setProperties(kernelExecutionType, false, false, false, *hwInfo); + streamProperties.frontEndState.setProperties(kernelExecutionType, false, false, false, pDevice->getRootDeviceEnvironment()); PreambleHelper::programVfeState(pVfeCmd, pDevice->getRootDeviceEnvironment(), 0u, 0, 0, streamProperties, nullptr); parseCommands(linearStream); diff --git a/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp index 8076ef16f1..c131171e3e 100644 --- a/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -47,7 +47,7 @@ XE_HPC_CORETEST_F(PreambleCfeState, givenKernelExecutionTypeConcurrentAndRevisio auto pVfeCmd = PreambleHelper::getSpaceForVfeState(&linearStream, hwInfo, EngineGroupType::RenderCompute); StreamProperties streamProperties{}; - streamProperties.frontEndState.setProperties(true, false, false, false, hwInfo); + streamProperties.frontEndState.setProperties(true, false, false, false, pDevice->getRootDeviceEnvironment()); PreambleHelper::programVfeState(pVfeCmd, pDevice->getRootDeviceEnvironment(), 0u, 0, 0, streamProperties, nullptr); parseCommands(linearStream);