diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index cfdeee1bab..97861fb0b7 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -42,6 +42,7 @@ #include "level_zero/core/source/device/device_imp.h" #include "level_zero/core/source/driver/driver_handle_imp.h" #include "level_zero/core/source/event/event.h" +#include "level_zero/core/source/hw_helpers/l0_hw_helper.h" #include "level_zero/core/source/image/image.h" #include "level_zero/core/source/kernel/kernel.h" #include "level_zero/core/source/module/module.h" @@ -131,6 +132,7 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO auto &hwInfo = device->getHwInfo(); this->systolicModeSupport = NEO::PreambleHelper::isSystolicModeConfigurable(hwInfo); + this->stateComputeModeTracking = L0HwHelper::enableStateComputeModeTracking(hwInfo); if (device->isImplicitScalingCapable() && !this->internalUsage && !isCopyOnly()) { this->partitionCount = static_cast(this->device->getNEODevice()->getDeviceBitfield().count()); diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index 9944207d9b..899ea9086b 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -29,7 +29,6 @@ namespace L0 { CommandList::CommandList(uint32_t numIddsPerBlock) : commandContainer(numIddsPerBlock) { frontEndStateTracking = L0HwHelper::enableFrontEndStateTracking(); pipelineSelectStateTracking = L0HwHelper::enablePipelineSelectStateTracking(); - stateComputeModeTracking = L0HwHelper::enableStateComputeModeTracking(); } CommandListAllocatorFn commandListFactory[IGFX_MAX_PRODUCT] = {}; diff --git a/level_zero/core/source/cmdqueue/cmdqueue.cpp b/level_zero/core/source/cmdqueue/cmdqueue.cpp index 97f1a3434a..d1b256dfe1 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.cpp +++ b/level_zero/core/source/cmdqueue/cmdqueue.cpp @@ -46,7 +46,6 @@ CommandQueueImp::CommandQueueImp(Device *device, NEO::CommandStreamReceiver *csr frontEndStateTracking = L0HwHelper::enableFrontEndStateTracking(); pipelineSelectStateTracking = L0HwHelper::enablePipelineSelectStateTracking(); - stateComputeModeTracking = L0HwHelper::enableStateComputeModeTracking(); } ze_result_t CommandQueueImp::destroy() { @@ -73,6 +72,7 @@ ze_result_t CommandQueueImp::initialize(bool copyOnly, bool isInternal) { if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) { device->getL0Debugger()->notifyCommandQueueCreated(device->getNEODevice()); } + this->stateComputeModeTracking = L0HwHelper::enableStateComputeModeTracking(device->getHwInfo()); } return returnValue; } diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper.cpp b/level_zero/core/source/hw_helpers/l0_hw_helper.cpp index 0c033076fa..6707497a6b 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper.cpp +++ b/level_zero/core/source/hw_helpers/l0_hw_helper.cpp @@ -33,12 +33,11 @@ bool L0HwHelper::enablePipelineSelectStateTracking() { return defaultValue; } -bool L0HwHelper::enableStateComputeModeTracking() { - constexpr bool defaultValue = false; +bool L0HwHelper::enableStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) { if (NEO::DebugManager.flags.EnableStateComputeModeTracking.get() != -1) { return !!NEO::DebugManager.flags.EnableStateComputeModeTracking.get(); } - return defaultValue; + return get(hwInfo.platform.eRenderCoreFamily).platformSupportsStateComputeModeTracking(hwInfo); } bool L0HwHelper::enableImmediateCmdListHeapSharing(const NEO::HardwareInfo &hwInfo, bool cmdlistSupport) { diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper.h b/level_zero/core/source/hw_helpers/l0_hw_helper.h index 49b43afb43..4e7327ef13 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper.h +++ b/level_zero/core/source/hw_helpers/l0_hw_helper.h @@ -32,7 +32,7 @@ class L0HwHelper { static L0HwHelper &get(GFXCORE_FAMILY gfxCore); static bool enableFrontEndStateTracking(); static bool enablePipelineSelectStateTracking(); - static bool enableStateComputeModeTracking(); + static bool enableStateComputeModeTracking(const NEO::HardwareInfo &hwInfo); static bool enableImmediateCmdListHeapSharing(const NEO::HardwareInfo &hwInfo, bool cmdlistSupport); virtual void setAdditionalGroupProperty(ze_command_queue_group_properties_t &groupProperty, NEO::EngineGroupT &group) const = 0; virtual L0::Event *createEvent(L0::EventPool *eventPool, const ze_event_desc_t *desc, L0::Device *device) const = 0; @@ -47,6 +47,7 @@ class L0HwHelper { virtual bool multiTileCapablePlatform() const = 0; virtual bool alwaysAllocateEventInLocalMem() const = 0; virtual bool platformSupportsCmdListHeapSharing(const NEO::HardwareInfo &hwInfo) const = 0; + virtual bool platformSupportsStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) const = 0; protected: L0HwHelper() = default; @@ -72,6 +73,7 @@ class L0HwHelperHw : public L0HwHelper { bool multiTileCapablePlatform() const override; bool alwaysAllocateEventInLocalMem() const override; bool platformSupportsCmdListHeapSharing(const NEO::HardwareInfo &hwInfo) const override; + bool platformSupportsStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) const override; }; } // namespace L0 diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper_pvc_and_later.inl b/level_zero/core/source/hw_helpers/l0_hw_helper_pvc_and_later.inl index 12df3d620b..a763784e45 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper_pvc_and_later.inl +++ b/level_zero/core/source/hw_helpers/l0_hw_helper_pvc_and_later.inl @@ -43,4 +43,9 @@ bool L0HwHelperHw::platformSupportsCmdListHeapSharing(const NEO::Hardwar return false; } +template +bool L0HwHelperHw::platformSupportsStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) const { + return false; +} + } // namespace L0 diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper_skl_and_later.inl b/level_zero/core/source/hw_helpers/l0_hw_helper_skl_and_later.inl index f3acfe8537..80c0ca79e2 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper_skl_and_later.inl +++ b/level_zero/core/source/hw_helpers/l0_hw_helper_skl_and_later.inl @@ -23,4 +23,9 @@ bool L0HwHelperHw::platformSupportsCmdListHeapSharing(const NEO::Hardwar return false; } +template +bool L0HwHelperHw::platformSupportsStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) const { + return false; +} + } // namespace L0 diff --git a/level_zero/core/test/unit_tests/gen11/test_l0_hw_helper_gen11.cpp b/level_zero/core/test/unit_tests/gen11/test_l0_hw_helper_gen11.cpp index 900958deb9..112dd6a8a7 100644 --- a/level_zero/core/test/unit_tests/gen11/test_l0_hw_helper_gen11.cpp +++ b/level_zero/core/test/unit_tests/gen11/test_l0_hw_helper_gen11.cpp @@ -20,5 +20,10 @@ GEN11TEST_F(L0HwHelperTestGen11, GivenGen11WhenCheckingL0HelperForCmdListHeapSha EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsCmdListHeapSharing(hwInfo)); } +GEN11TEST_F(L0HwHelperTestGen11, GivenGen11WhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnFalse) { + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; + EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsStateComputeModeTracking(hwInfo)); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/gen12lp/test_l0_hw_helper_gen12lp.cpp b/level_zero/core/test/unit_tests/gen12lp/test_l0_hw_helper_gen12lp.cpp index 90e0f4230f..065b750cf7 100644 --- a/level_zero/core/test/unit_tests/gen12lp/test_l0_hw_helper_gen12lp.cpp +++ b/level_zero/core/test/unit_tests/gen12lp/test_l0_hw_helper_gen12lp.cpp @@ -27,5 +27,10 @@ GEN12LPTEST_F(L0HwHelperTestGen12Lp, GivenGen12LpWhenCheckingL0HelperForCmdListH EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsCmdListHeapSharing(hwInfo)); } +GEN12LPTEST_F(L0HwHelperTestGen12Lp, GivenGen12LpWhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnFalse) { + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; + EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsStateComputeModeTracking(hwInfo)); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/gen9/test_l0_hw_helper_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_l0_hw_helper_gen9.cpp index f6aea1e61d..6bd36f4ea5 100644 --- a/level_zero/core/test/unit_tests/gen9/test_l0_hw_helper_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_l0_hw_helper_gen9.cpp @@ -20,5 +20,10 @@ GEN9TEST_F(L0HwHelperTestGen9, GivenGen9WhenCheckingL0HelperForCmdListHeapSharin EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsCmdListHeapSharing(hwInfo)); } +GEN9TEST_F(L0HwHelperTestGen9, GivenGen9WhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnFalse) { + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; + EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsStateComputeModeTracking(hwInfo)); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp index 40ffaf3747..867417eb45 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp @@ -327,19 +327,24 @@ HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenUpdateStr auto pMockModule = std::unique_ptr(new Mock(device, nullptr)); kernel.module = pMockModule.get(); - auto pCommandList = std::make_unique>>(); - auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u); + auto commandList = std::make_unique>>(); + auto result = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); ASSERT_EQ(ZE_RESULT_SUCCESS, result); const_cast(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x100; - pCommandList->updateStreamProperties(kernel, false); - EXPECT_EQ(hwInfoConfig.getScmPropertyCoherencyRequiredSupport(), pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); - EXPECT_EQ(hwInfoConfig.isGrfNumReportedWithScm(), pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + commandList->updateStreamProperties(kernel, false); + if (commandList->stateComputeModeTracking) { + EXPECT_FALSE(commandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); + EXPECT_FALSE(commandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + } else { + EXPECT_EQ(hwInfoConfig.getScmPropertyCoherencyRequiredSupport(), commandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); + EXPECT_EQ(hwInfoConfig.isGrfNumReportedWithScm(), commandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + } const_cast(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x80; - pCommandList->updateStreamProperties(kernel, false); - EXPECT_EQ(hwInfoConfig.isGrfNumReportedWithScm(), pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); - EXPECT_FALSE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); + commandList->updateStreamProperties(kernel, false); + EXPECT_EQ(hwInfoConfig.isGrfNumReportedWithScm(), commandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + EXPECT_FALSE(commandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); } struct ProgramAllFieldsInComputeMode { @@ -380,18 +385,23 @@ HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenPropertes auto pMockModule = std::unique_ptr(new Mock(device, nullptr)); kernel.module = pMockModule.get(); - auto pCommandList = std::make_unique>>(); - auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u); + auto commandList = std::make_unique>>(); + auto result = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); ASSERT_EQ(ZE_RESULT_SUCCESS, result); const_cast(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x100; - pCommandList->updateStreamProperties(kernel, false); - EXPECT_EQ(hwInfoConfig.getScmPropertyCoherencyRequiredSupport(), pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); - EXPECT_EQ(hwInfoConfig.isGrfNumReportedWithScm(), pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + commandList->updateStreamProperties(kernel, false); + if (commandList->stateComputeModeTracking) { + EXPECT_FALSE(commandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); + EXPECT_FALSE(commandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + } else { + EXPECT_EQ(hwInfoConfig.getScmPropertyCoherencyRequiredSupport(), commandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); + EXPECT_EQ(hwInfoConfig.isGrfNumReportedWithScm(), commandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + } - pCommandList->updateStreamProperties(kernel, false); - EXPECT_FALSE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); - EXPECT_FALSE(pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + commandList->updateStreamProperties(kernel, false); + EXPECT_FALSE(commandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); + EXPECT_FALSE(commandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); } HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenAppendingMemoryCopyThenSuccessIsReturned, IsAtLeastSkl) { diff --git a/level_zero/core/test/unit_tests/xe_hp_core/test_l0_hw_helper_xe_hp_core.cpp b/level_zero/core/test/unit_tests/xe_hp_core/test_l0_hw_helper_xe_hp_core.cpp index 30d09e28d7..b3d23e0029 100644 --- a/level_zero/core/test/unit_tests/xe_hp_core/test_l0_hw_helper_xe_hp_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hp_core/test_l0_hw_helper_xe_hp_core.cpp @@ -32,5 +32,10 @@ XEHPTEST_F(L0HwHelperTestXeHp, GivenXeHpWhenCheckingL0HelperForCmdListHeapSharin EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsCmdListHeapSharing(hwInfo)); } +XEHPTEST_F(L0HwHelperTestXeHp, GivenXeHpWhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnFalse) { + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; + EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsStateComputeModeTracking(hwInfo)); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_hw_helper_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_hw_helper_xe_hpc_core.cpp index 4811552718..6c06659a0f 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_hw_helper_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_hw_helper_xe_hpc_core.cpp @@ -31,5 +31,10 @@ XE_HPC_CORETEST_F(L0HwHelperTestXeHpc, GivenXeHpcWhenCheckingL0HelperForCmdListH EXPECT_TRUE(L0::L0HwHelperHw::get().platformSupportsCmdListHeapSharing(hwInfo)); } +XE_HPC_CORETEST_F(L0HwHelperTestXeHpc, GivenXeHpcWhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnFalse) { + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; + EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsStateComputeModeTracking(hwInfo)); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_hw_helper_xe_hpg_core.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_hw_helper_xe_hpg_core.cpp index e4ae6d9a83..66e3e42cad 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_hw_helper_xe_hpg_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_hw_helper_xe_hpg_core.cpp @@ -34,5 +34,10 @@ XE_HPG_CORETEST_F(L0HwHelperTestXeHpg, GivenXeHpgWhenCheckingL0HelperForCmdListH EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsCmdListHeapSharing(hwInfo)); } +XE_HPG_CORETEST_F(L0HwHelperTestXeHpg, GivenXeHpgcWhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnFalse) { + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; + EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsStateComputeModeTracking(hwInfo)); +} + } // namespace ult } // namespace L0