From 1758f55fe3fd6429fa334fd2ee925f2455ed76fd Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Mon, 23 Jan 2023 14:08:25 +0000 Subject: [PATCH] refactor: don't use global ProductHelper getter 7/n Related-To: NEO-6853 Signed-off-by: Kamil Kopryk --- level_zero/core/source/cmdlist/cmdlist_hw.inl | 4 +- .../core/source/cmdqueue/cmdqueue_hw.inl | 6 +-- .../command_stream_receiver_hw_1_tests.cpp | 2 +- .../ult_command_stream_receiver_fixture.h | 2 +- .../command_container/command_encoder.h | 2 +- .../encode_compute_mode_tgllp_and_later.inl | 5 ++- .../command_stream_receiver_hw_base.inl | 2 +- ...mmand_stream_receiver_hw_bdw_and_later.inl | 4 +- ...mand_stream_receiver_hw_xehp_and_later.inl | 2 +- .../definitions/stream_properties.inl | 6 +-- .../command_stream/stream_properties.cpp | 18 ++++---- shared/source/gen11/command_encoder_gen11.cpp | 2 +- shared/source/gen8/command_encoder_gen8.cpp | 2 +- shared/source/gen9/command_encoder_gen9.cpp | 2 +- shared/source/os_interface/hw_info_config.h | 4 +- shared/source/os_interface/hw_info_config.inl | 2 +- .../stream_properties_tests_common.cpp | 43 ++++++++++--------- .../unit_test/encoders/test_encode_states.cpp | 2 +- .../os_interface/hw_info_config_tests.cpp | 2 +- 19 files changed, 59 insertions(+), 53 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 37c169b98d..0683b465e3 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -2348,7 +2348,7 @@ void CommandListCoreFamily::updateStreamProperties(Kernel &kernel auto &kernelAttributes = kernel.getKernelDescriptor().kernelAttributes; if (!containsAnyKernel) { requiredStreamState.frontEndState.setProperties(isCooperative, kernelAttributes.flags.requiresDisabledEUFusion, true, -1, rootDeviceEnvironment); - requiredStreamState.pipelineSelect.setProperties(true, false, kernelAttributes.flags.usesSystolicPipelineSelectMode, hwInfo); + requiredStreamState.pipelineSelect.setProperties(true, false, kernelAttributes.flags.usesSystolicPipelineSelectMode, rootDeviceEnvironment); if (this->stateComputeModeTracking) { requiredStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), rootDeviceEnvironment); finalStreamState = requiredStreamState; @@ -2361,7 +2361,7 @@ void CommandListCoreFamily::updateStreamProperties(Kernel &kernel auto logicalStateHelperBlock = !getLogicalStateHelper(); - finalStreamState.pipelineSelect.setProperties(true, false, kernelAttributes.flags.usesSystolicPipelineSelectMode, hwInfo); + finalStreamState.pipelineSelect.setProperties(true, false, kernelAttributes.flags.usesSystolicPipelineSelectMode, rootDeviceEnvironment); if (this->pipelineSelectStateTracking && finalStreamState.pipelineSelect.isDirty() && logicalStateHelperBlock) { NEO::PipelineSelectArgs pipelineSelectArgs; pipelineSelectArgs.systolicPipelineSelectMode = kernelAttributes.flags.usesSystolicPipelineSelectMode; diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index f10eb844af..b88017d6c8 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -314,7 +314,7 @@ void CommandQueueHw::programOneCmdListFrontEndIfDirty( if (frontEndTrackingEnabled()) { csrState.frontEndState.setProperties(cmdListRequired.frontEndState); - csrState.frontEndState.setPropertySingleSliceDispatchCcsMode(ctx.engineInstanced, device->getHwInfo()); + csrState.frontEndState.setPropertySingleSliceDispatchCcsMode(ctx.engineInstanced, device->getNEODevice()->getRootDeviceEnvironment()); shouldProgramVfe |= csrState.frontEndState.isDirty(); } @@ -391,7 +391,7 @@ size_t CommandQueueHw::estimateFrontEndCmdSizeForMultipleCommandL size_t estimatedSize = 0; csrStateCopy.frontEndState.setProperties(cmdListRequired.frontEndState); - csrStateCopy.frontEndState.setPropertySingleSliceDispatchCcsMode(engineInstanced, device->getHwInfo()); + csrStateCopy.frontEndState.setPropertySingleSliceDispatchCcsMode(engineInstanced, device->getNEODevice()->getRootDeviceEnvironment()); if (isFrontEndStateDirty || csrStateCopy.frontEndState.isDirty()) { estimatedSize += singleFrontEndCmdSize; isFrontEndStateDirty = false; @@ -1191,7 +1191,7 @@ size_t CommandQueueHw::estimateScmCmdSizeForMultipleCommandLists( size_t estimatedSize = 0; bool isRcs = this->getCsr()->isRcs(); - size_t singleScmCmdSize = NEO::EncodeComputeMode::getCmdSizeForComputeMode(device->getHwInfo(), false, isRcs); + size_t singleScmCmdSize = NEO::EncodeComputeMode::getCmdSizeForComputeMode(device->getNEODevice()->getRootDeviceEnvironment(), false, isRcs); csrStateCopy.stateComputeMode.setProperties(cmdListRequired.stateComputeMode); if (csrStateCopy.stateComputeMode.isDirty()) { diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp index 99dcefb0be..76f47a3c0a 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp @@ -162,7 +162,7 @@ HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentAndThreadArbitrationPoli auto actualDifferenceForPreamble = policyChangedPreamble - policyNotChangedPreamble; auto actualDifferenceForFlush = policyChangedFlush - policyNotChangedFlush; - auto expectedDifference = EncodeComputeMode::getCmdSizeForComputeMode(*defaultHwInfo, false, commandStreamReceiver.isRcs()); + auto expectedDifference = EncodeComputeMode::getCmdSizeForComputeMode(pDevice->getRootDeviceEnvironment(), false, commandStreamReceiver.isRcs()); EXPECT_EQ(0u, actualDifferenceForPreamble); EXPECT_EQ(expectedDifference, actualDifferenceForFlush); } 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 bf6360ca4a..15b2805a89 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 @@ -154,7 +154,7 @@ struct UltCommandStreamReceiverTest commandStreamReceiver.lastMediaSamplerConfig = 0; commandStreamReceiver.lastSentUseGlobalAtomics = false; - commandStreamReceiver.streamProperties.pipelineSelect.setProperties(true, false, false, *defaultHwInfo); + commandStreamReceiver.streamProperties.pipelineSelect.setProperties(true, false, false, pDevice->getRootDeviceEnvironment()); commandStreamReceiver.streamProperties.stateComputeMode.setProperties(0, GrfConfig::DefaultGrfNumber, gfxCoreHelper.getDefaultThreadArbitrationPolicy(), pDevice->getPreemptionMode(), pDevice->getRootDeviceEnvironment()); commandStreamReceiver.streamProperties.frontEndState.setProperties(false, false, false, -1, pDevice->getRootDeviceEnvironment()); diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index ab410b9fa6..5d4753ee3e 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -333,7 +333,7 @@ struct EncodeStoreMMIO { template struct EncodeComputeMode { - static size_t getCmdSizeForComputeMode(const HardwareInfo &hwInfo, bool hasSharedHandles, bool isRcs); + static size_t getCmdSizeForComputeMode(const RootDeviceEnvironment &rootDeviceEnvironment, bool hasSharedHandles, bool isRcs); static void programComputeModeCommandWithSynchronization(LinearStream &csr, StateComputeModeProperties &properties, const PipelineSelectArgs &args, bool hasSharedHandles, const RootDeviceEnvironment &rootDeviceEnvironment, bool isRcs, bool dcFlush, LogicalStateHelper *logicalStateHelper); diff --git a/shared/source/command_container/encode_compute_mode_tgllp_and_later.inl b/shared/source/command_container/encode_compute_mode_tgllp_and_later.inl index 20b3a4108f..31756c1816 100644 --- a/shared/source/command_container/encode_compute_mode_tgllp_and_later.inl +++ b/shared/source/command_container/encode_compute_mode_tgllp_and_later.inl @@ -13,9 +13,10 @@ namespace NEO { template -size_t EncodeComputeMode::getCmdSizeForComputeMode(const HardwareInfo &hwInfo, bool hasSharedHandles, bool isRcs) { +size_t EncodeComputeMode::getCmdSizeForComputeMode(const RootDeviceEnvironment &rootDeviceEnvironment, bool hasSharedHandles, bool isRcs) { size_t size = 0; - auto &productHelper = (*ProductHelper::get(hwInfo.platform.eProductFamily)); + auto &productHelper = rootDeviceEnvironment.getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); std::ignore = isExtendedWARequired; 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 7195437f66..ef779f878f 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -1581,7 +1581,7 @@ bool CommandStreamReceiverHw::hasSharedHandles() { template size_t CommandStreamReceiverHw::getCmdSizeForComputeMode() { - return EncodeComputeMode::getCmdSizeForComputeMode(this->peekHwInfo(), hasSharedHandles(), isRcs()); + return EncodeComputeMode::getCmdSizeForComputeMode(this->peekRootDeviceEnvironment(), hasSharedHandles(), isRcs()); } template diff --git a/shared/source/command_stream/command_stream_receiver_hw_bdw_and_later.inl b/shared/source/command_stream/command_stream_receiver_hw_bdw_and_later.inl index 5c3a4035e2..ad73fe207d 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_bdw_and_later.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_bdw_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -66,7 +66,7 @@ void CommandStreamReceiverHw::programPipelineSelect(LinearStream &com } this->lastMediaSamplerConfig = pipelineSelectArgs.mediaSamplerRequired; this->lastSystolicPipelineSelectMode = pipelineSelectArgs.systolicPipelineSelectMode; - this->streamProperties.pipelineSelect.setProperties(true, this->lastMediaSamplerConfig, this->lastSystolicPipelineSelectMode, hwInfo); + this->streamProperties.pipelineSelect.setProperties(true, this->lastMediaSamplerConfig, this->lastSystolicPipelineSelectMode, peekRootDeviceEnvironment()); } } diff --git a/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl b/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl index 7294adbd56..17aea387e4 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl @@ -51,7 +51,7 @@ void CommandStreamReceiverHw::programPipelineSelect(LinearStream &com PreambleHelper::programPipelineSelect(&commandStream, pipelineSelectArgs, hwInfo); this->lastMediaSamplerConfig = pipelineSelectArgs.mediaSamplerRequired; this->lastSystolicPipelineSelectMode = pipelineSelectArgs.systolicPipelineSelectMode; - this->streamProperties.pipelineSelect.setProperties(true, this->lastMediaSamplerConfig, this->lastSystolicPipelineSelectMode, hwInfo); + this->streamProperties.pipelineSelect.setProperties(true, this->lastMediaSamplerConfig, this->lastSystolicPipelineSelectMode, peekRootDeviceEnvironment()); } } diff --git a/shared/source/command_stream/definitions/stream_properties.inl b/shared/source/command_stream/definitions/stream_properties.inl index 9bae9b6782..36230581c2 100644 --- a/shared/source/command_stream/definitions/stream_properties.inl +++ b/shared/source/command_stream/definitions/stream_properties.inl @@ -60,7 +60,7 @@ struct FrontEndProperties { 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); + void setPropertySingleSliceDispatchCcsMode(int32_t engineInstancedDevice, const RootDeviceEnvironment &rootDeviceEnvironment); bool isDirty() const; protected: @@ -81,7 +81,7 @@ struct PipelineSelectProperties { StreamProperty mediaSamplerDopClockGate{}; StreamProperty systolicMode{}; - void setProperties(bool modeSelected, bool mediaSamplerDopClockGate, bool systolicMode, const HardwareInfo &hwInfo); + void setProperties(bool modeSelected, bool mediaSamplerDopClockGate, bool systolicMode, const RootDeviceEnvironment &rootDeviceEnvironment); void setProperties(const PipelineSelectProperties &properties); bool isDirty() const; @@ -112,7 +112,7 @@ struct StateBaseAddressProperties { void setProperties(bool globalAtomics, int32_t statelessMocs, int64_t bindingTablePoolBaseAddress, int64_t surfaceStateBaseAddress, size_t surfaceStateSize, int64_t dynamicStateBaseAddress, size_t dynamicStateSize, - int64_t indirectObjectBaseAddress, size_t indirectObjectSize, const HardwareInfo &hwInfo); + int64_t indirectObjectBaseAddress, size_t indirectObjectSize, const RootDeviceEnvironment &rootDeviceEnvironment); void setProperties(const StateBaseAddressProperties &properties); bool isDirty() const; diff --git a/shared/source/command_stream/stream_properties.cpp b/shared/source/command_stream/stream_properties.cpp index 9a7b964165..7e86692608 100644 --- a/shared/source/command_stream/stream_properties.cpp +++ b/shared/source/command_stream/stream_properties.cpp @@ -132,9 +132,10 @@ void FrontEndProperties::setProperties(bool isCooperativeKernel, bool disableEUF } } -void FrontEndProperties::setPropertySingleSliceDispatchCcsMode(int32_t engineInstancedDevice, const HardwareInfo &hwInfo) { +void FrontEndProperties::setPropertySingleSliceDispatchCcsMode(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; } @@ -165,10 +166,11 @@ void FrontEndProperties::clearIsDirty() { computeDispatchAllWalkerEnable.isDirty = false; } -void PipelineSelectProperties::setProperties(bool modeSelected, bool mediaSamplerDopClockGate, bool systolicMode, const HardwareInfo &hwInfo) { +void PipelineSelectProperties::setProperties(bool modeSelected, bool mediaSamplerDopClockGate, bool systolicMode, const RootDeviceEnvironment &rootDeviceEnvironment) { if (this->propertiesSupportLoaded == false) { - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); - productHelper.fillPipelineSelectPropertiesSupportStructure(this->pipelineSelectPropertiesSupport, hwInfo); + auto &productHelper = rootDeviceEnvironment.getHelper(); + + productHelper.fillPipelineSelectPropertiesSupportStructure(this->pipelineSelectPropertiesSupport, *rootDeviceEnvironment.getHardwareInfo()); this->propertiesSupportLoaded = true; } @@ -208,10 +210,10 @@ void PipelineSelectProperties::clearIsDirty() { void StateBaseAddressProperties::setProperties(bool globalAtomics, int32_t statelessMocs, int64_t bindingTablePoolBaseAddress, int64_t surfaceStateBaseAddress, size_t surfaceStateSize, int64_t dynamicStateBaseAddress, size_t dynamicStateSize, - int64_t indirectObjectBaseAddress, size_t indirectObjectSize, const HardwareInfo &hwInfo) { + int64_t indirectObjectBaseAddress, size_t indirectObjectSize, const RootDeviceEnvironment &rootDeviceEnvironment) { if (this->propertiesSupportLoaded == false) { - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); - productHelper.fillStateBaseAddressPropertiesSupportStructure(this->stateBaseAddressPropertiesSupport, hwInfo); + auto &productHelper = rootDeviceEnvironment.getHelper(); + productHelper.fillStateBaseAddressPropertiesSupportStructure(this->stateBaseAddressPropertiesSupport); this->propertiesSupportLoaded = true; } diff --git a/shared/source/gen11/command_encoder_gen11.cpp b/shared/source/gen11/command_encoder_gen11.cpp index bcb38a01a8..23e2d8dd47 100644 --- a/shared/source/gen11/command_encoder_gen11.cpp +++ b/shared/source/gen11/command_encoder_gen11.cpp @@ -43,7 +43,7 @@ void EncodeSurfaceState::setFlagsForMediaCompression(R_SURFACE_STATE *su } template -size_t EncodeComputeMode::getCmdSizeForComputeMode(const HardwareInfo &hwInfo, bool hasSharedHandles, bool isRcs) { +size_t EncodeComputeMode::getCmdSizeForComputeMode(const RootDeviceEnvironment &rootDeviceEnvironment, bool hasSharedHandles, bool isRcs) { return sizeof(typename Family::PIPE_CONTROL) + 2u * sizeof(typename Family::MI_LOAD_REGISTER_IMM); } diff --git a/shared/source/gen8/command_encoder_gen8.cpp b/shared/source/gen8/command_encoder_gen8.cpp index 3ca171d977..61ceb2f972 100644 --- a/shared/source/gen8/command_encoder_gen8.cpp +++ b/shared/source/gen8/command_encoder_gen8.cpp @@ -35,7 +35,7 @@ void EncodeSurfaceState::setFlagsForMediaCompression(R_SURFACE_STATE *su } template -size_t EncodeComputeMode::getCmdSizeForComputeMode(const HardwareInfo &hwInfo, bool hasSharedHandles, bool isRcs) { +size_t EncodeComputeMode::getCmdSizeForComputeMode(const RootDeviceEnvironment &rootDeviceEnvironment, bool hasSharedHandles, bool isRcs) { return 0u; } diff --git a/shared/source/gen9/command_encoder_gen9.cpp b/shared/source/gen9/command_encoder_gen9.cpp index b90a337dea..a872ed8780 100644 --- a/shared/source/gen9/command_encoder_gen9.cpp +++ b/shared/source/gen9/command_encoder_gen9.cpp @@ -34,7 +34,7 @@ void EncodeSurfaceState::setFlagsForMediaCompression(R_SURFACE_STATE *su } } template -size_t EncodeComputeMode::getCmdSizeForComputeMode(const HardwareInfo &hwInfo, bool hasSharedHandles, bool isRcs) { +size_t EncodeComputeMode::getCmdSizeForComputeMode(const RootDeviceEnvironment &rootDeviceEnvironment, bool hasSharedHandles, bool isRcs) { return sizeof(typename Family::PIPE_CONTROL) + sizeof(typename Family::MI_LOAD_REGISTER_IMM); } diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index c55690b89c..d218fda00c 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -182,7 +182,7 @@ class ProductHelper { virtual void fillScmPropertiesSupportStructure(StateComputeModePropertiesSupport &propertiesSupport) const = 0; virtual void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const = 0; virtual void fillPipelineSelectPropertiesSupportStructure(PipelineSelectPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const = 0; - virtual void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const = 0; + virtual void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport) const = 0; virtual uint32_t getDefaultRevisionId() const = 0; virtual bool isMultiContextResourceDeferDeletionSupported() const = 0; @@ -330,7 +330,7 @@ class ProductHelperHw : public ProductHelper { void fillScmPropertiesSupportStructure(StateComputeModePropertiesSupport &propertiesSupport) const override; void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const override; void fillPipelineSelectPropertiesSupportStructure(PipelineSelectPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const override; - void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const override; + void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport) const override; uint32_t getDefaultRevisionId() const override; bool isMultiContextResourceDeferDeletionSupported() const override; diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index 5f58986712..0c9f8665b5 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -611,7 +611,7 @@ bool ProductHelperHw::getStateBaseAddressPropertyBindingTablePoolBas } template -void ProductHelperHw::fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const { +void ProductHelperHw::fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport) const { propertiesSupport.globalAtomics = getStateBaseAddressPropertyGlobalAtomicsSupport(); propertiesSupport.statelessMocs = getStateBaseAddressPropertyStatelessMocsSupport(); propertiesSupport.bindingTablePoolBaseAddress = getStateBaseAddressPropertyBindingTablePoolBaseAddressSupport(); 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 164d373e42..1bf03535da 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 @@ -277,7 +277,7 @@ TEST(StreamPropertiesTests, givenSingleDispatchCcsFrontEndPropertyWhenSettingPro int32_t engineInstancedDevice = 1; - feProperties.setPropertySingleSliceDispatchCcsMode(engineInstancedDevice, *defaultHwInfo); + feProperties.setPropertySingleSliceDispatchCcsMode(engineInstancedDevice, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(feProperties.propertiesSupportLoaded); if (fePropertiesSupport.singleSliceDispatchCcsMode) { EXPECT_TRUE(feProperties.singleSliceDispatchCcsMode.isDirty); @@ -290,7 +290,7 @@ TEST(StreamPropertiesTests, givenSingleDispatchCcsFrontEndPropertyWhenSettingPro feProperties.frontEndPropertiesSupport.singleSliceDispatchCcsMode = true; engineInstancedDevice = 2; - feProperties.setPropertySingleSliceDispatchCcsMode(engineInstancedDevice, *defaultHwInfo); + feProperties.setPropertySingleSliceDispatchCcsMode(engineInstancedDevice, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(feProperties.singleSliceDispatchCcsMode.isDirty); EXPECT_EQ(engineInstancedDevice, feProperties.singleSliceDispatchCcsMode.value); } @@ -306,7 +306,7 @@ TEST(StreamPropertiesTests, whenSettingPipelineSelectPropertiesThenCorrectValueI for (auto modeSelected : ::testing::Bool()) { for (auto mediaSamplerDopClockGate : ::testing::Bool()) { for (auto systolicMode : ::testing::Bool()) { - properties.pipelineSelect.setProperties(modeSelected, mediaSamplerDopClockGate, systolicMode, *defaultHwInfo); + properties.pipelineSelect.setProperties(modeSelected, mediaSamplerDopClockGate, systolicMode, *mockExecutionEnvironment.rootDeviceEnvironments[0]); if (pipelineSelectPropertiesSupport.modeSelected) { EXPECT_EQ(modeSelected, properties.pipelineSelect.modeSelected.value); @@ -329,6 +329,7 @@ TEST(StreamPropertiesTests, whenSettingPipelineSelectPropertiesThenCorrectValueI } TEST(StreamPropertiesTests, givenModeSelectPipelineSelectPropertyNotSupportedWhenSettingPropertyAndCheckIfDirtyThenExpectCleanState) { + MockExecutionEnvironment mockExecutionEnvironment{}; MockPipelineSelectProperties pipeProperties{}; pipeProperties.propertiesSupportLoaded = true; pipeProperties.pipelineSelectPropertiesSupport.modeSelected = false; @@ -337,26 +338,27 @@ TEST(StreamPropertiesTests, givenModeSelectPipelineSelectPropertyNotSupportedWhe constexpr bool constState = false; bool changingState = false; - pipeProperties.setProperties(changingState, constState, constState, *defaultHwInfo); + pipeProperties.setProperties(changingState, constState, constState, *mockExecutionEnvironment.rootDeviceEnvironments[0]); // expect dirty as media and systolic changes from initial registered EXPECT_TRUE(pipeProperties.isDirty()); changingState = !changingState; - pipeProperties.setProperties(changingState, constState, constState, *defaultHwInfo); + pipeProperties.setProperties(changingState, constState, constState, *mockExecutionEnvironment.rootDeviceEnvironments[0]); // expect clean as changed modeSelected is not supported EXPECT_FALSE(pipeProperties.isDirty()); } TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagStateWhenSettingPropertyAndCheckIfDirtyThenExpectCleanStateForNotSupportedAndDirtyForSupported) { + MockExecutionEnvironment mockExecutionEnvironment{}; MockStateBaseAddressProperties sbaProperties{}; sbaProperties.propertiesSupportLoaded = true; sbaProperties.stateBaseAddressPropertiesSupport.globalAtomics = false; sbaProperties.stateBaseAddressPropertiesSupport.statelessMocs = false; sbaProperties.stateBaseAddressPropertiesSupport.bindingTablePoolBaseAddress = false; - sbaProperties.setProperties(true, 1, 1, -1, -1, -1, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(true, 1, 1, -1, -1, -1, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_FALSE(sbaProperties.isDirty()); EXPECT_EQ(-1, sbaProperties.globalAtomics.value); @@ -364,7 +366,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagStateWhenSettingProp EXPECT_EQ(-1, sbaProperties.bindingTablePoolBaseAddress.value); sbaProperties.stateBaseAddressPropertiesSupport.globalAtomics = true; - sbaProperties.setProperties(true, 1, 0, -1, -1, -1, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(true, 1, 0, -1, -1, -1, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_TRUE(sbaProperties.globalAtomics.isDirty); EXPECT_FALSE(sbaProperties.statelessMocs.isDirty); @@ -376,7 +378,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagStateWhenSettingProp sbaProperties.stateBaseAddressPropertiesSupport.globalAtomics = false; sbaProperties.stateBaseAddressPropertiesSupport.statelessMocs = true; - sbaProperties.setProperties(false, 1, 1, -1, -1, -1, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(false, 1, 1, -1, -1, -1, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_FALSE(sbaProperties.globalAtomics.isDirty); EXPECT_TRUE(sbaProperties.statelessMocs.isDirty); @@ -388,7 +390,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagStateWhenSettingProp sbaProperties.stateBaseAddressPropertiesSupport.statelessMocs = false; sbaProperties.stateBaseAddressPropertiesSupport.bindingTablePoolBaseAddress = true; - sbaProperties.setProperties(true, 2, 2, -1, -1, -1, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(true, 2, 2, -1, -1, -1, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_FALSE(sbaProperties.globalAtomics.isDirty); EXPECT_FALSE(sbaProperties.statelessMocs.isDirty); @@ -400,10 +402,10 @@ TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagStateWhenSettingProp sbaProperties.stateBaseAddressPropertiesSupport.globalAtomics = true; sbaProperties.stateBaseAddressPropertiesSupport.statelessMocs = true; - sbaProperties.setProperties(true, 1, 2, -1, -1, -1, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(true, 1, 2, -1, -1, -1, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_FALSE(sbaProperties.isDirty()); - sbaProperties.setProperties(false, 0, 3, -1, -1, -1, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(false, 0, 3, -1, -1, -1, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_EQ(0, sbaProperties.globalAtomics.value); @@ -427,11 +429,11 @@ TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagDefaultValueWhenSett MockExecutionEnvironment mockExecutionEnvironment{}; auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); StateBaseAddressPropertiesSupport sbaPropertiesSupport = {}; - productHelper.fillStateBaseAddressPropertiesSupportStructure(sbaPropertiesSupport, *defaultHwInfo); + productHelper.fillStateBaseAddressPropertiesSupportStructure(sbaPropertiesSupport); StateBaseAddressProperties sbaProperties{}; - sbaProperties.setProperties(true, 2, 3, -1, -1, -1, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(true, 2, 3, -1, -1, -1, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); if (sbaPropertiesSupport.globalAtomics) { EXPECT_EQ(1, sbaProperties.globalAtomics.value); } else { @@ -452,13 +454,14 @@ TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagDefaultValueWhenSett } TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSettingAddressSizePropertiesThenExpectCorrectDirtyFlagAndStateValue) { + MockExecutionEnvironment mockExecutionEnvironment{}; MockStateBaseAddressProperties sbaProperties{}; sbaProperties.propertiesSupportLoaded = true; sbaProperties.stateBaseAddressPropertiesSupport.globalAtomics = false; sbaProperties.stateBaseAddressPropertiesSupport.statelessMocs = false; sbaProperties.stateBaseAddressPropertiesSupport.bindingTablePoolBaseAddress = false; - sbaProperties.setProperties(false, -1, -1, 10, -1, -1, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(false, -1, -1, 10, -1, -1, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_EQ(10, sbaProperties.surfaceStateBaseAddress.value); @@ -469,7 +472,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet EXPECT_FALSE(sbaProperties.indirectObjectBaseAddress.isDirty); EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty); - sbaProperties.setProperties(false, -1, -1, 10, 20, -1, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(false, -1, -1, 10, 20, -1, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_EQ(20u, sbaProperties.surfaceStateSize.value); @@ -480,7 +483,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet EXPECT_FALSE(sbaProperties.indirectObjectBaseAddress.isDirty); EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty); - sbaProperties.setProperties(false, -1, -1, 10, 20, 30, -1, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(false, -1, -1, 10, 20, 30, -1, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_EQ(30, sbaProperties.dynamicStateBaseAddress.value); @@ -491,7 +494,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet EXPECT_FALSE(sbaProperties.indirectObjectBaseAddress.isDirty); EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty); - sbaProperties.setProperties(false, -1, -1, 10, 20, 30, 40, -1, -1, *defaultHwInfo); + sbaProperties.setProperties(false, -1, -1, 10, 20, 30, 40, -1, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_EQ(40u, sbaProperties.dynamicStateSize.value); @@ -502,7 +505,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet EXPECT_FALSE(sbaProperties.indirectObjectBaseAddress.isDirty); EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty); - sbaProperties.setProperties(false, -1, -1, 10, 20, 30, 40, 50, -1, *defaultHwInfo); + sbaProperties.setProperties(false, -1, -1, 10, 20, 30, 40, 50, -1, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_EQ(50, sbaProperties.indirectObjectBaseAddress.value); @@ -513,7 +516,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet EXPECT_TRUE(sbaProperties.indirectObjectBaseAddress.isDirty); EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty); - sbaProperties.setProperties(false, -1, -1, 10, 20, 30, 40, 50, 60, *defaultHwInfo); + sbaProperties.setProperties(false, -1, -1, 10, 20, 30, 40, 50, 60, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_TRUE(sbaProperties.isDirty()); EXPECT_EQ(60u, sbaProperties.indirectObjectSize.value); @@ -524,6 +527,6 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet EXPECT_FALSE(sbaProperties.indirectObjectBaseAddress.isDirty); EXPECT_TRUE(sbaProperties.indirectObjectSize.isDirty); - sbaProperties.setProperties(false, -1, -1, 10, 20, 30, 40, 50, 60, *defaultHwInfo); + sbaProperties.setProperties(false, -1, -1, 10, 20, 30, 40, 50, 60, *mockExecutionEnvironment.rootDeviceEnvironments[0]); EXPECT_FALSE(sbaProperties.isDirty()); } diff --git a/shared/test/unit_test/encoders/test_encode_states.cpp b/shared/test/unit_test/encoders/test_encode_states.cpp index fd733de8ed..ff4886471a 100644 --- a/shared/test/unit_test/encoders/test_encode_states.cpp +++ b/shared/test/unit_test/encoders/test_encode_states.cpp @@ -452,7 +452,7 @@ HWTEST2_F(CommandEncodeStatesTest, whenGetCmdSizeForComputeModeThenCorrectValueI if constexpr (TestTraits::programComputeModeCommandProgramsNonCoherent) { expectedScmSize += sizeof(MI_LOAD_REGISTER_IMM); } - EXPECT_EQ(expectedScmSize, EncodeComputeMode::getCmdSizeForComputeMode(*defaultHwInfo, false, false)); + EXPECT_EQ(expectedScmSize, EncodeComputeMode::getCmdSizeForComputeMode(this->pDevice->getRootDeviceEnvironment(), false, false)); UltDeviceFactory deviceFactory{1, 0}; auto &csr = deviceFactory.rootDevices[0]->getUltCommandStreamReceiver(); diff --git a/shared/test/unit_test/os_interface/hw_info_config_tests.cpp b/shared/test/unit_test/os_interface/hw_info_config_tests.cpp index acb2a4f773..96d3363055 100644 --- a/shared/test/unit_test/os_interface/hw_info_config_tests.cpp +++ b/shared/test/unit_test/os_interface/hw_info_config_tests.cpp @@ -525,7 +525,7 @@ HWTEST_F(ProductHelperTest, WhenFillingPipelineSelectPropertiesSupportThenExpect HWTEST_F(ProductHelperTest, WhenFillingStateBaseAddressPropertiesSupportThenExpectUseCorrectGetters) { StateBaseAddressPropertiesSupport stateBaseAddressPropertiesSupport = {}; - productHelper->fillStateBaseAddressPropertiesSupportStructure(stateBaseAddressPropertiesSupport, pInHwInfo); + productHelper->fillStateBaseAddressPropertiesSupportStructure(stateBaseAddressPropertiesSupport); EXPECT_EQ(productHelper->getStateBaseAddressPropertyGlobalAtomicsSupport(), stateBaseAddressPropertiesSupport.globalAtomics); EXPECT_EQ(productHelper->getStateBaseAddressPropertyStatelessMocsSupport(), stateBaseAddressPropertiesSupport.statelessMocs); EXPECT_EQ(productHelper->getStateBaseAddressPropertyBindingTablePoolBaseAddressSupport(), stateBaseAddressPropertiesSupport.bindingTablePoolBaseAddress);