diff --git a/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl b/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl index e85ee12ad4..0d32dafb33 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -178,7 +178,7 @@ void CommandQueueHw::patchCommands(CommandList &commandList, uint cfeStateCmd = reinterpret_cast(commandToPatch.pCommand); cfeStateCmd->setScratchSpaceBuffer(lowScratchAddress); - cfeStateCmd->setSingleSliceDispatchCcsMode(csr->getOsContext().isEngineInstanced()); + NEO::PreambleHelper::setSingleSliceDispatchMode(cfeStateCmd, csr->getOsContext().isEngineInstanced()); *reinterpret_cast(commandToPatch.pDestination) = *cfeStateCmd; break; diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp index d64c7b8441..ed14771f0f 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp @@ -8,6 +8,7 @@ #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/helpers/blit_properties.h" #include "shared/source/helpers/gfx_core_helper.h" +#include "shared/source/helpers/hw_mapper.h" #include "shared/source/helpers/state_base_address.h" #include "shared/source/indirect_heap/indirect_heap.h" #include "shared/source/os_interface/os_context.h" @@ -677,7 +678,15 @@ struct EngineInstancedDeviceExecuteTests : public ::testing::Test { NEO::MockDevice *rootDevice = nullptr; }; -HWTEST2_F(EngineInstancedDeviceExecuteTests, givenEngineInstancedDeviceWhenExecutingThenEnableSingleSliceDispatch, IsAtLeastXeHpCore) { +struct SingleSliceDispatchSupportMatcher { + template + static constexpr bool isMatched() { + using GfxProduct = typename HwMapper::GfxProduct; + return GfxProduct::FrontEndStateSupport::singleSliceDispatchCcsMode; + } +}; + +HWTEST2_F(EngineInstancedDeviceExecuteTests, givenEngineInstancedDeviceWhenExecutingThenEnableSingleSliceDispatch, SingleSliceDispatchSupportMatcher) { using CFE_STATE = typename FamilyType::CFE_STATE; constexpr uint32_t genericDevicesCount = 1; @@ -726,7 +735,7 @@ HWTEST2_F(EngineInstancedDeviceExecuteTests, givenEngineInstancedDeviceWhenExecu commandQueue->destroy(); } -HWTEST2_F(EngineInstancedDeviceExecuteTests, givenEngineInstancedDeviceWithFabricEnumerationWhenExecutingThenEnableSingleSliceDispatch, IsAtLeastXeHpCore) { +HWTEST2_F(EngineInstancedDeviceExecuteTests, givenEngineInstancedDeviceWithFabricEnumerationWhenExecutingThenEnableSingleSliceDispatch, SingleSliceDispatchSupportMatcher) { using CFE_STATE = typename FamilyType::CFE_STATE; constexpr uint32_t genericDevicesCount = 1; diff --git a/opencl/test/unit_test/device/sub_device_tests.cpp b/opencl/test/unit_test/device/sub_device_tests.cpp index d239a51288..d7b70acc53 100644 --- a/opencl/test/unit_test/device/sub_device_tests.cpp +++ b/opencl/test/unit_test/device/sub_device_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #include "shared/source/device/sub_device.h" #include "shared/source/helpers/gfx_core_helper.h" +#include "shared/source/helpers/hw_mapper.h" #include "shared/source/os_interface/device_factory.h" #include "shared/source/os_interface/os_context.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" @@ -950,7 +951,15 @@ TEST_F(EngineInstancedDeviceTests, givenAffinityMaskWhenCreatingClSubDevicesThen EXPECT_EQ(0b100u, clRootDevice->getSubDevice(1)->getDeviceBitfield().to_ulong()); } -HWTEST2_F(EngineInstancedDeviceTests, givenEngineInstancedDeviceWhenProgrammingCfeStateThenSetSingleSliceDispatch, IsAtLeastXeHpCore) { +struct SingleSliceDispatchSupportMatcher { + template + static constexpr bool isMatched() { + using GfxProduct = typename HwMapper::GfxProduct; + return GfxProduct::FrontEndStateSupport::singleSliceDispatchCcsMode; + } +}; + +HWTEST2_F(EngineInstancedDeviceTests, givenEngineInstancedDeviceWhenProgrammingCfeStateThenSetSingleSliceDispatch, SingleSliceDispatchSupportMatcher) { using CFE_STATE = typename FamilyType::CFE_STATE; debugManager.flags.EngineInstancedSubDevices.set(true); diff --git a/shared/source/helpers/preamble.h b/shared/source/helpers/preamble.h index 6b547acd54..0b4d898f0d 100644 --- a/shared/source/helpers/preamble.h +++ b/shared/source/helpers/preamble.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -60,6 +60,7 @@ struct PreambleHelper { static size_t getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment); static size_t getSemaphoreDelayCommandSize(); static uint32_t getScratchSizeValueToProgramMediaVfeState(uint32_t scratchSize); + static void setSingleSliceDispatchMode(void *cmd, bool enable); }; template diff --git a/shared/source/helpers/preamble_bdw_and_later.inl b/shared/source/helpers/preamble_bdw_and_later.inl index f1cf5939c1..94a7c72d5c 100644 --- a/shared/source/helpers/preamble_bdw_and_later.inl +++ b/shared/source/helpers/preamble_bdw_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -82,4 +82,8 @@ size_t PreambleHelper::getCmdSizeForPipelineSelect(const RootDeviceEn return sizeof(PIPELINE_SELECT); } +template +void PreambleHelper::setSingleSliceDispatchMode(void *cmd, bool enable) { +} + } // namespace NEO diff --git a/shared/source/helpers/preamble_xehp_and_later.inl b/shared/source/helpers/preamble_xehp_and_later.inl index 07e632c0ce..430bee1028 100644 --- a/shared/source/helpers/preamble_xehp_and_later.inl +++ b/shared/source/helpers/preamble_xehp_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -53,8 +53,17 @@ void PreambleHelper::programVfeState(void *pVfeState, uint32_t lowAddress = uint32_t(0xFFFFFFFF & scratchAddress); cmd.setScratchSpaceBuffer(lowAddress); cmd.setMaximumNumberOfThreads(maxFrontEndThreads); + + cmd.setComputeOverdispatchDisable(streamProperties.frontEndState.disableOverdispatch.value == 1); + + PreambleHelper::setSingleSliceDispatchMode(&cmd, streamProperties.frontEndState.singleSliceDispatchCcsMode.value == 1); + appendProgramVFEState(rootDeviceEnvironment, streamProperties, &cmd); + if (debugManager.flags.CFEComputeOverdispatchDisable.get() != -1) { + cmd.setComputeOverdispatchDisable(debugManager.flags.CFEComputeOverdispatchDisable.get()); + } + if (debugManager.flags.CFEMaximumNumberOfThreads.get() != -1) { cmd.setMaximumNumberOfThreads(debugManager.flags.CFEMaximumNumberOfThreads.get()); } @@ -84,6 +93,17 @@ uint32_t PreambleHelper::getL3Config(const HardwareInfo &hwInfo, bool return 0u; } +template +void PreambleHelper::setSingleSliceDispatchMode(void *cmd, bool enable) { + auto cfeState = reinterpret_cast(cmd); + + cfeState->setSingleSliceDispatchCcsMode(enable); + + if (debugManager.flags.CFESingleSliceDispatchCCSMode.get() != -1) { + cfeState->setSingleSliceDispatchCcsMode(debugManager.flags.CFESingleSliceDispatchCCSMode.get()); + } +} + template <> const uint32_t L3CNTLRegisterOffset::registerOffset = std::numeric_limits::max(); diff --git a/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp b/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp index 42b844d9dc..a2d157c836 100644 --- a/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,9 +24,6 @@ template <> void PreambleHelper::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd) { auto command = static_cast(cmd); - command->setComputeOverdispatchDisable(streamProperties.frontEndState.disableOverdispatch.value == 1); - command->setSingleSliceDispatchCcsMode(streamProperties.frontEndState.singleSliceDispatchCcsMode.value == 1); - if (streamProperties.frontEndState.computeDispatchAllWalkerEnable.value > 0) { command->setComputeDispatchAllWalkerEnable(true); } @@ -35,13 +32,6 @@ void PreambleHelper::appendProgramVFEState(const RootDeviceEnvironment & command->setComputeDispatchAllWalkerEnable(debugManager.flags.CFEComputeDispatchAllWalkerEnable.get()); } - if (debugManager.flags.CFEComputeOverdispatchDisable.get() != -1) { - command->setComputeOverdispatchDisable(debugManager.flags.CFEComputeOverdispatchDisable.get()); - } - if (debugManager.flags.CFESingleSliceDispatchCCSMode.get() != -1) { - command->setSingleSliceDispatchCcsMode(debugManager.flags.CFESingleSliceDispatchCCSMode.get()); - } - command->setNumberOfWalkers(1); if (debugManager.flags.CFENumberOfWalkers.get() != -1) { command->setNumberOfWalkers(debugManager.flags.CFENumberOfWalkers.get()); diff --git a/shared/source/xe_hpg_core/preamble_xe_hpg_core.cpp b/shared/source/xe_hpg_core/preamble_xe_hpg_core.cpp index ff78bcdc26..0bee241cd4 100644 --- a/shared/source/xe_hpg_core/preamble_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/preamble_xe_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,16 +22,6 @@ template <> void PreambleHelper::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd) { auto command = static_cast(cmd); - command->setComputeOverdispatchDisable(streamProperties.frontEndState.disableOverdispatch.value == 1); - command->setSingleSliceDispatchCcsMode(streamProperties.frontEndState.singleSliceDispatchCcsMode.value == 1); - - if (debugManager.flags.CFEComputeOverdispatchDisable.get() != -1) { - command->setComputeOverdispatchDisable(debugManager.flags.CFEComputeOverdispatchDisable.get()); - } - if (debugManager.flags.CFESingleSliceDispatchCCSMode.get() != -1) { - command->setSingleSliceDispatchCcsMode(debugManager.flags.CFESingleSliceDispatchCCSMode.get()); - } - auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); if (!gfxCoreHelper.isFusedEuDispatchEnabled(hwInfo, streamProperties.frontEndState.disableEUFusion.value == 1)) {