diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.h b/level_zero/core/source/cmdlist/cmdlist_hw.h index dd103d67ac..4eb08cba23 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.h +++ b/level_zero/core/source/cmdlist/cmdlist_hw.h @@ -245,7 +245,6 @@ struct CommandListCoreFamily : CommandListImp { NEO::PipeControlArgs createBarrierFlags(); void appendMultiTileBarrier(NEO::Device &neoDevice); size_t estimateBufferSizeMultiTileBarrier(const NEO::HardwareInfo &hwInfo); - bool isFlushTaskSupported(); uint64_t getInputBufferSize(NEO::ImageType imageType, uint64_t bytesPerPixel, const ze_image_region_t *region); MOCKABLE_VIRTUAL AlignedAllocationData getAlignedAllocation(Device *device, const void *buffer, uint64_t bufferSize, bool hostCopyAllowed); diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 54332567aa..100305434d 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -136,7 +136,7 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO } if (this->cmdListType == CommandListType::TYPE_IMMEDIATE && !isCopyOnly() && !isInternal()) { - this->isFlushTaskSubmissionEnabled = this->isFlushTaskSupported(); + this->isFlushTaskSubmissionEnabled = NEO::HwHelper::get(device->getHwInfo().platform.eRenderCoreFamily).isPlatformFlushTaskEnabled(); if (NEO::DebugManager.flags.EnableFlushTaskSubmission.get() != -1) { this->isFlushTaskSubmissionEnabled = !!NEO::DebugManager.flags.EnableFlushTaskSubmission.get(); } diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_base.inl b/level_zero/core/source/cmdlist/cmdlist_hw_base.inl index 0edf8cde1a..53e3a7ff7a 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_base.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_base.inl @@ -202,9 +202,4 @@ inline size_t CommandListCoreFamily::estimateBufferSizeMultiTileB return 0; } -template -inline bool CommandListCoreFamily::isFlushTaskSupported() { - return false; -} - } // namespace L0 diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl index 20c6fd73ed..59458b434b 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl @@ -348,9 +348,4 @@ inline size_t CommandListCoreFamily::estimateBufferSizeMultiTileB false); } -template -inline bool CommandListCoreFamily::isFlushTaskSupported() { - return true; -} - } // namespace L0 diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp index 4bdbd542a8..3c2a828279 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp @@ -244,7 +244,17 @@ class CommandListImmediateFlushTaskTests : public DeviceFixture { }; using CommandListImmediateFlushTaskComputeTests = Test; -HWTEST2_F(CommandListImmediateFlushTaskComputeTests, givenCommandListIsInititalizedThenByDefaultFlushTaskSubmissionEnabled, IsAtLeastXeHpCore) { +using ATSOrDG2 = IsWithinGfxCore; +HWTEST2_F(CommandListImmediateFlushTaskComputeTests, givenATSOrDG2CommandListIsInititalizedThenByDefaultFlushTaskSubmissionEnabled, ATSOrDG2) { + ze_command_queue_desc_t queueDesc = {}; + ze_result_t returnValue; + std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue)); + + EXPECT_EQ(true, commandList->isFlushTaskSubmissionEnabled); +} + +using MatchXeHpc = IsGfxCore; +HWTEST2_F(CommandListImmediateFlushTaskComputeTests, givenXeHPCCommandListIsInititalizedThenByDefaultFlushTaskSubmissionEnabled, MatchXeHpc) { ze_command_queue_desc_t queueDesc = {}; ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue)); diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index 21815cc046..3ce1fee94d 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -1421,6 +1421,17 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenGettingIfRevisionSpecificBinaryBuiltinIs auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); EXPECT_FALSE(hwHelper.isRevisionSpecificBinaryBuiltinRequired()); } + +HWTEST2_F(HwHelperTest, givenAtsOrDg2HwHelperWhenGettingIsPlatformFlushTaskEnabledThenTrueIsReturned, ATSOrDG2) { + auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); + EXPECT_TRUE(hwHelper.isPlatformFlushTaskEnabled()); +} + +HWTEST2_F(HwHelperTest, givenNotAtsOrDg2HwHelperWhenGettingIsPlatformFlushTaskEnabledThenFalseIsReturned, IsAtMostGen12lp) { + auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); + EXPECT_FALSE(hwHelper.isPlatformFlushTaskEnabled()); +} + struct CoherentWANotNeeded { template static constexpr bool isMatched() { diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 97398174ca..0b85af6816 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -157,6 +157,7 @@ class HwHelper { virtual bool isLinuxCompletionFenceSupported() const = 0; virtual size_t getBatchBufferEndSize() const = 0; virtual const void *getBatchBufferEndReference() const = 0; + virtual bool isPlatformFlushTaskEnabled() const = 0; protected: HwHelper() = default; @@ -395,6 +396,7 @@ class HwHelperHw : public HwHelper { bool isLinuxCompletionFenceSupported() const override; size_t getBatchBufferEndSize() const override; const void *getBatchBufferEndReference() const override; + bool isPlatformFlushTaskEnabled() const override; protected: static const AuxTranslationMode defaultAuxTranslationMode; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 23ad870298..a51ce91e25 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -718,4 +718,8 @@ template const void *HwHelperHw::getBatchBufferEndReference() const { return reinterpret_cast(&GfxFamily::cmdInitBatchBufferEnd); } +template +bool HwHelperHw::isPlatformFlushTaskEnabled() const { + return false; +} } // namespace NEO diff --git a/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp b/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp index ad3c279def..02263966dc 100644 --- a/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp +++ b/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp @@ -149,6 +149,11 @@ bool HwHelperHw::disableL3CacheForDebug(const HardwareInfo &) const { return true; } +template <> +bool HwHelperHw::isPlatformFlushTaskEnabled() const { + return true; +} + template class HwHelperHw; template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; diff --git a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp index 1dce876071..a08cc2997b 100644 --- a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp @@ -421,6 +421,11 @@ bool HwHelperHw::isRevisionSpecificBinaryBuiltinRequired() const { return true; } +template <> +bool HwHelperHw::isPlatformFlushTaskEnabled() const { + return true; +} + } // namespace NEO #include "shared/source/helpers/hw_helper_pvc_and_later.inl" diff --git a/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp b/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp index d0099b29ce..3201dd5aee 100644 --- a/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp @@ -114,6 +114,11 @@ inline bool HwHelperHw::isLinuxCompletionFenceSupported() const { return true; } +template <> +bool HwHelperHw::isPlatformFlushTaskEnabled() const { + return true; +} + template class HwHelperHw; template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; diff --git a/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp b/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp index ec133b918d..6e8cc4bbd0 100644 --- a/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp +++ b/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -63,3 +63,8 @@ XE_HPC_CORETEST_F(HwHelperXeHpcCoreTest, givenHwHelperWhenGettingIfRevisionSpeci auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); EXPECT_TRUE(hwHelper.isRevisionSpecificBinaryBuiltinRequired()); } + +XE_HPC_CORETEST_F(HwHelperXeHpcCoreTest, givenHwHelperWhenGettingIsPlatformFlushTaskEnabledThenTrueIsReturned) { + auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); + EXPECT_TRUE(hwHelper.isPlatformFlushTaskEnabled()); +}