diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 86ec149cb7..53e6f85bb1 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -166,7 +166,7 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO this->l1CachePolicyData.init(productHelper); this->cmdListHeapAddressModel = L0GfxCoreHelper::getHeapAddressModel(rootDeviceEnvironment); this->dummyBlitWa.rootDeviceEnvironment = &(device->getNEODevice()->getRootDeviceEnvironmentRef()); - this->dispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(this->cmdListType == CommandListType::TYPE_REGULAR); + this->dispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(rootDeviceEnvironment, this->cmdListType == CommandListType::TYPE_REGULAR); this->requiredStreamState.initSupport(rootDeviceEnvironment); this->finalStreamState.initSupport(rootDeviceEnvironment); diff --git a/level_zero/core/source/cmdqueue/cmdqueue.cpp b/level_zero/core/source/cmdqueue/cmdqueue.cpp index 03c43bda22..13857b3024 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.cpp +++ b/level_zero/core/source/cmdqueue/cmdqueue.cpp @@ -100,7 +100,7 @@ ze_result_t CommandQueueImp::initialize(bool copyOnly, bool isInternal, bool imm auto &productHelper = rootDeviceEnvironment.getHelper(); this->doubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo); this->cmdListHeapAddressModel = L0GfxCoreHelper::getHeapAddressModel(rootDeviceEnvironment); - this->dispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(!immediateCmdListQueue); + this->dispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(rootDeviceEnvironment, !immediateCmdListQueue); } return returnValue; } diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.cpp b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.cpp index d6284f34cd..3bb9737a70 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.cpp +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.cpp @@ -103,9 +103,9 @@ NEO::HeapAddressModel L0GfxCoreHelper::getHeapAddressModel(const NEO::RootDevice return l0GfxCoreHelper.getPlatformHeapAddressModel(); } -bool L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(bool allowPrimary) { - constexpr bool defaultValue = false; - bool value = defaultValue; +bool L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(const NEO::RootDeviceEnvironment &rootDeviceEnvironment, bool allowPrimary) { + auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); + bool value = l0GfxCoreHelper.platformSupportsPrimaryBatchBufferCmdList(); if (NEO::DebugManager.flags.DispatchCmdlistCmdBufferPrimary.get() != -1) { value = !!(NEO::DebugManager.flags.DispatchCmdlistCmdBufferPrimary.get()); } diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h index aa091b6228..51b5d4a349 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h @@ -50,7 +50,7 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper { static bool useDynamicEventPacketsCount(const NEO::HardwareInfo &hwInfo); static bool useSignalAllEventPackets(const NEO::HardwareInfo &hwInfo); static NEO::HeapAddressModel getHeapAddressModel(const NEO::RootDeviceEnvironment &rootDeviceEnvironment); - static bool dispatchCmdListBatchBufferAsPrimary(bool allowPrimary); + static bool dispatchCmdListBatchBufferAsPrimary(const NEO::RootDeviceEnvironment &rootDeviceEnvironment, bool allowPrimary); 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; @@ -70,6 +70,7 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper { virtual bool platformSupportsPipelineSelectTracking() const = 0; virtual bool platformSupportsStateBaseAddressTracking() const = 0; virtual bool platformSupportsRayTracing() const = 0; + virtual bool platformSupportsPrimaryBatchBufferCmdList() const = 0; virtual bool isZebinAllowed(const NEO::Debugger *debugger) const = 0; virtual uint32_t getEventMaxKernelCount(const NEO::HardwareInfo &hwInfo) const = 0; virtual uint32_t getEventBaseMaxPacketCount(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const = 0; @@ -105,6 +106,7 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper { bool platformSupportsPipelineSelectTracking() const override; bool platformSupportsStateBaseAddressTracking() const override; bool platformSupportsRayTracing() const override; + bool platformSupportsPrimaryBatchBufferCmdList() const override; bool isZebinAllowed(const NEO::Debugger *debugger) const override; uint32_t getEventMaxKernelCount(const NEO::HardwareInfo &hwInfo) const override; uint32_t getEventBaseMaxPacketCount(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const override; diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_skl_to_tgllp.inl b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_skl_to_tgllp.inl index 9ebe161e7f..b0a36eb5a9 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_skl_to_tgllp.inl +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_skl_to_tgllp.inl @@ -64,4 +64,9 @@ std::vector L0GfxCoreHelperHw::getSupportedNumGrfs() const { return {128u}; } +template +bool L0GfxCoreHelperHw::platformSupportsPrimaryBatchBufferCmdList() const { + return false; +} + } // namespace L0 diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_xehp_and_later.inl b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_xehp_and_later.inl index 00cc4b8e14..ac151e23b9 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_xehp_and_later.inl +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_xehp_and_later.inl @@ -77,4 +77,9 @@ std::vector L0GfxCoreHelperHw::getSupportedNumGrfs() const { return {128u, 256u}; } +template +bool L0GfxCoreHelperHw::platformSupportsPrimaryBatchBufferCmdList() const { + return false; +} + } // namespace L0 diff --git a/level_zero/core/test/unit_tests/gen11/test_l0_gfx_core_helper_gen11.cpp b/level_zero/core/test/unit_tests/gen11/test_l0_gfx_core_helper_gen11.cpp index 6d1df2f14f..a5eba8d019 100644 --- a/level_zero/core/test/unit_tests/gen11/test_l0_gfx_core_helper_gen11.cpp +++ b/level_zero/core/test/unit_tests/gen11/test_l0_gfx_core_helper_gen11.cpp @@ -51,5 +51,10 @@ GEN11TEST_F(L0GfxCoreHelperTestGen11, GivenGen11WhenGettingPlatformDefaultHeapAd EXPECT_EQ(NEO::HeapAddressModel::PrivateHeaps, l0GfxCoreHelper.getPlatformHeapAddressModel()); } +GEN11TEST_F(L0GfxCoreHelperTestGen11, GivenGen11WhenCheckingL0HelperForCmdlistPrimaryBufferSupportThenReturnFalse) { + auto &l0GfxCoreHelper = getHelper(); + EXPECT_FALSE(l0GfxCoreHelper.platformSupportsPrimaryBatchBufferCmdList()); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/gen12lp/test_l0_gfx_core_helper_gen12lp.cpp b/level_zero/core/test/unit_tests/gen12lp/test_l0_gfx_core_helper_gen12lp.cpp index 03d6f373b7..40a0ea2533 100644 --- a/level_zero/core/test/unit_tests/gen12lp/test_l0_gfx_core_helper_gen12lp.cpp +++ b/level_zero/core/test/unit_tests/gen12lp/test_l0_gfx_core_helper_gen12lp.cpp @@ -63,5 +63,10 @@ GEN12LPTEST_F(L0GfxCoreHelperTestGen12Lp, GivenGen12LpWhenGettingPlatformDefault EXPECT_EQ(NEO::HeapAddressModel::PrivateHeaps, l0GfxCoreHelper.getPlatformHeapAddressModel()); } +GEN12LPTEST_F(L0GfxCoreHelperTestGen12Lp, GivenGen12LpWhenCheckingL0HelperForCmdlistPrimaryBufferSupportThenReturnFalse) { + auto &l0GfxCoreHelper = getHelper(); + EXPECT_FALSE(l0GfxCoreHelper.platformSupportsPrimaryBatchBufferCmdList()); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/gen9/test_l0_gfx_core_helper_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_l0_gfx_core_helper_gen9.cpp index 235ac6698c..39c1c53ed6 100644 --- a/level_zero/core/test/unit_tests/gen9/test_l0_gfx_core_helper_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_l0_gfx_core_helper_gen9.cpp @@ -51,5 +51,10 @@ GEN9TEST_F(L0GfxCoreHelperTestGen9, GivenGen9WhenGettingPlatformDefaultHeapAddre EXPECT_EQ(NEO::HeapAddressModel::PrivateHeaps, l0GfxCoreHelper.getPlatformHeapAddressModel()); } +GEN9TEST_F(L0GfxCoreHelperTestGen9, GivenGen9WhenCheckingL0HelperForCmdlistPrimaryBufferSupportThenReturnFalse) { + auto &l0GfxCoreHelper = getHelper(); + EXPECT_FALSE(l0GfxCoreHelper.platformSupportsPrimaryBatchBufferCmdList()); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index 54613aaca3..56bee816cc 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -2436,7 +2436,7 @@ TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingTrackingFlagsThenDef EXPECT_EQ(expectedHeapAddressModel, commandList->getCmdListHeapAddressModel()); EXPECT_EQ(expectedHeapAddressModel, commandList->getCmdContainer().getHeapAddressModel()); - auto expectedDispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(true); + auto expectedDispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(rootDeviceEnvironment, true); EXPECT_EQ(expectedDispatchCmdListBatchBufferAsPrimary, commandList->dispatchCmdListBatchBufferAsPrimary); } diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp index 80a5e06a17..b80861d2aa 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp @@ -2052,7 +2052,7 @@ TEST_F(CommandQueueCreate, givenCreatedCommandQueueWhenGettingTrackingFlagsThenD auto expectedHeapAddressModel = l0GfxCoreHelper.getPlatformHeapAddressModel(); EXPECT_EQ(expectedHeapAddressModel, commandQueue->cmdListHeapAddressModel); - auto expectedDispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(true); + auto expectedDispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(rootDeviceEnvironment, true); EXPECT_EQ(expectedDispatchCmdListBatchBufferAsPrimary, commandQueue->dispatchCmdListBatchBufferAsPrimary); commandQueue->destroy(); diff --git a/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp b/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp index 766fac4dd6..ee2dad347f 100644 --- a/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp +++ b/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp @@ -859,22 +859,34 @@ HWTEST2_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenGettingSupportedNumGrfsTh TEST_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperUsingOverrideDebugKeyWhenGettingDispatchCmdListCmdBufferPrimaryThenUseDbgKeyValue) { DebugManagerStateRestore restorer; + MockExecutionEnvironment executionEnvironment; + const auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0].get(); DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); - EXPECT_FALSE(L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(true)); + EXPECT_FALSE(L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(rootDeviceEnvironment, true)); DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(1); - EXPECT_TRUE(L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(true)); + EXPECT_TRUE(L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(rootDeviceEnvironment, true)); } TEST_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperUsingOverrideDebugKeyWhenGettingDispatchCmdListCmdBufferPrimaryAndNotAllowPrimaryThenOverrideDbgKeyValueAndDisallow) { DebugManagerStateRestore restorer; + MockExecutionEnvironment executionEnvironment; + const auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0].get(); DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(1); - EXPECT_FALSE(L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(false)); + EXPECT_FALSE(L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(rootDeviceEnvironment, false)); +} + +TEST_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenGettingDefaultCmdlistPrimaryBatchBufferThenUsePlatformDefaultSetting) { + MockExecutionEnvironment executionEnvironment; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0].get(); + auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); + + EXPECT_EQ(l0GfxCoreHelper.platformSupportsPrimaryBatchBufferCmdList(), L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(rootDeviceEnvironment, true)); } } // namespace ult diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_gfx_core_helper_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_gfx_core_helper_xe_hpc_core.cpp index dc18547fcf..265322ca62 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_gfx_core_helper_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_gfx_core_helper_xe_hpc_core.cpp @@ -64,5 +64,10 @@ XE_HPC_CORETEST_F(L0GfxCoreHelperTestXeHpc, GivenXeHpcWhenGettingPlatformDefault EXPECT_EQ(NEO::HeapAddressModel::PrivateHeaps, l0GfxCoreHelper.getPlatformHeapAddressModel()); } +XE_HPC_CORETEST_F(L0GfxCoreHelperTestXeHpc, GivenXeHpcWhenCheckingL0HelperForCmdlistPrimaryBufferSupportThenReturnFalse) { + auto &l0GfxCoreHelper = getHelper(); + EXPECT_FALSE(l0GfxCoreHelper.platformSupportsPrimaryBatchBufferCmdList()); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_gfx_core_helper_xe_hpg_core.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_gfx_core_helper_xe_hpg_core.cpp index e7bc8d5b8b..dfce8efaac 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_gfx_core_helper_xe_hpg_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_gfx_core_helper_xe_hpg_core.cpp @@ -66,5 +66,10 @@ XE_HPG_CORETEST_F(L0GfxCoreHelperTestXeHpg, GivenXeHpgWhenGettingPlatformDefault EXPECT_EQ(NEO::HeapAddressModel::PrivateHeaps, l0GfxCoreHelper.getPlatformHeapAddressModel()); } +XE_HPG_CORETEST_F(L0GfxCoreHelperTestXeHpg, GivenXeHpgWhenCheckingL0HelperForCmdlistPrimaryBufferSupportThenReturnFalse) { + auto &l0GfxCoreHelper = getHelper(); + EXPECT_FALSE(l0GfxCoreHelper.platformSupportsPrimaryBatchBufferCmdList()); +} + } // namespace ult } // namespace L0