From 483f9fe3406de8cf31464ddd7e500c95a15a62e4 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Tue, 14 Mar 2023 10:30:15 +0000 Subject: [PATCH] refactor: move extensions support logic to compiler product helper - cl_intel_subgroup_local_block_io - cl_intel_dot_accumulate - cl_intel_create_buffer_with_properties - cl_khr_subgroup_named_barrier - cl_intel_subgroup_extended_block_read Related-To: NEO-7800 Signed-off-by: Mateusz Jablonski --- .../enable_compiler_product_helper_ehl.cpp | 1 + .../enable_compiler_product_helper_icllp.cpp | 1 + .../enable_compiler_product_helper_lkf.cpp | 1 + shared/source/gen11/gfx_core_helper_gen11.cpp | 5 -- .../enable_compiler_product_helper_adln.cpp | 1 + .../enable_compiler_product_helper_adlp.cpp | 1 + .../enable_compiler_product_helper_adls.cpp | 1 + .../enable_compiler_product_helper_dg1.cpp | 1 + .../enable_compiler_product_helper_rkl.cpp | 1 + .../enable_compiler_product_helper_tgllp.cpp | 1 + .../gen12lp/gfx_core_helper_gen12lp.cpp | 8 --- .../enable_compiler_product_helper_bdw.cpp | 1 + .../enable_compiler_product_helper_bxt.cpp | 1 + .../enable_compiler_product_helper_cfl.cpp | 1 + .../enable_compiler_product_helper_glk.cpp | 1 + .../enable_compiler_product_helper_kbl.cpp | 1 + .../enable_compiler_product_helper_skl.cpp | 1 + shared/source/helpers/CMakeLists.txt | 2 + .../source/helpers/compiler_product_helper.h | 10 ++++ .../compiler_product_helper_before_xe_hp.inl | 10 ++++ .../compiler_product_helper_before_xe_hpc.inl | 10 ++++ ...helper_disable_subgroup_local_block_io.inl | 16 +++++ ..._helper_enable_subgroup_local_block_io.inl | 16 +++++ ...ompiler_product_helper_xe_hp_and_later.inl | 10 ++++ ...mpiler_product_helper_xe_hpc_and_later.inl | 10 ++++ .../source/helpers/gfx_core_helper_base.inl | 34 +++++++++++ .../helpers/gfx_core_helper_bdw_and_later.inl | 5 -- ...able_compiler_product_helper_xe_hp_sdv.cpp | 1 + .../xe_hp_core/gfx_core_helper_xe_hp_core.cpp | 11 ---- .../enable_compiler_product_helper_pvc.cpp | 1 + .../gfx_core_helper_xe_hpc_core.cpp | 15 ----- .../enable_compiler_product_helper_dg2.cpp | 1 + .../enable_compiler_product_helper_mtl.cpp | 1 + .../gfx_core_helper_xe_hpg_core.cpp | 17 ------ .../test_macros/header/common_matchers.h | 2 + .../helpers/compiler_product_helper_tests.cpp | 60 +++++++++++++++++++ 36 files changed, 199 insertions(+), 61 deletions(-) create mode 100644 shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl create mode 100644 shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl diff --git a/shared/source/gen11/enable_compiler_product_helper_ehl.cpp b/shared/source/gen11/enable_compiler_product_helper_ehl.cpp index 1b634ddeb3..8c81a1e96a 100644 --- a/shared/source/gen11/enable_compiler_product_helper_ehl.cpp +++ b/shared/source/gen11/enable_compiler_product_helper_ehl.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" namespace NEO { template <> diff --git a/shared/source/gen11/enable_compiler_product_helper_icllp.cpp b/shared/source/gen11/enable_compiler_product_helper_icllp.cpp index 03d4a80358..0a8efb24af 100644 --- a/shared/source/gen11/enable_compiler_product_helper_icllp.cpp +++ b/shared/source/gen11/enable_compiler_product_helper_icllp.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" namespace NEO { template <> diff --git a/shared/source/gen11/enable_compiler_product_helper_lkf.cpp b/shared/source/gen11/enable_compiler_product_helper_lkf.cpp index c0f1f6df91..bcd2afaa2c 100644 --- a/shared/source/gen11/enable_compiler_product_helper_lkf.cpp +++ b/shared/source/gen11/enable_compiler_product_helper_lkf.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" namespace NEO { template <> diff --git a/shared/source/gen11/gfx_core_helper_gen11.cpp b/shared/source/gen11/gfx_core_helper_gen11.cpp index cbd6ce7b95..9793a77fbe 100644 --- a/shared/source/gen11/gfx_core_helper_gen11.cpp +++ b/shared/source/gen11/gfx_core_helper_gen11.cpp @@ -23,11 +23,6 @@ uint32_t GfxCoreHelperHw::getComputeUnitsUsedForScratch(const RootDevice return hwInfo->gtSystemInfo.MaxSubSlicesSupported * hwInfo->gtSystemInfo.MaxEuPerSubSlice * 8; } -template <> -std::string GfxCoreHelperHw::getExtensions(const RootDeviceEnvironment &rootDeviceEnvironment) const { - return "cl_intel_subgroup_local_block_io "; -} - template <> int32_t GfxCoreHelperHw::getDefaultThreadArbitrationPolicy() const { return ThreadArbitrationPolicy::RoundRobinAfterDependency; diff --git a/shared/source/gen12lp/enable_compiler_product_helper_adln.cpp b/shared/source/gen12lp/enable_compiler_product_helper_adln.cpp index 14f2b66474..4134da85d8 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_adln.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_adln.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" #include "compiler_product_helper_adln.inl" diff --git a/shared/source/gen12lp/enable_compiler_product_helper_adlp.cpp b/shared/source/gen12lp/enable_compiler_product_helper_adlp.cpp index 05e7ff5919..fb8f1cccc6 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_adlp.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_adlp.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" #include "compiler_product_helper_adlp.inl" diff --git a/shared/source/gen12lp/enable_compiler_product_helper_adls.cpp b/shared/source/gen12lp/enable_compiler_product_helper_adls.cpp index 8bde3f02dc..7e9efca85e 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_adls.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_adls.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" namespace NEO { template <> diff --git a/shared/source/gen12lp/enable_compiler_product_helper_dg1.cpp b/shared/source/gen12lp/enable_compiler_product_helper_dg1.cpp index cd75dc97b4..f5269952fc 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_dg1.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_dg1.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" namespace NEO { template <> diff --git a/shared/source/gen12lp/enable_compiler_product_helper_rkl.cpp b/shared/source/gen12lp/enable_compiler_product_helper_rkl.cpp index 5092b5f1fc..407c56ae7b 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_rkl.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_rkl.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" namespace NEO { diff --git a/shared/source/gen12lp/enable_compiler_product_helper_tgllp.cpp b/shared/source/gen12lp/enable_compiler_product_helper_tgllp.cpp index be8c50622f..4bce396d32 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_tgllp.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_tgllp.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" namespace NEO { template <> diff --git a/shared/source/gen12lp/gfx_core_helper_gen12lp.cpp b/shared/source/gen12lp/gfx_core_helper_gen12lp.cpp index 8515bc53ea..f53c6d70d3 100644 --- a/shared/source/gen12lp/gfx_core_helper_gen12lp.cpp +++ b/shared/source/gen12lp/gfx_core_helper_gen12lp.cpp @@ -134,14 +134,6 @@ EngineGroupType GfxCoreHelperHw::getEngineGroupType(aub_stream::EngineTy } } -template <> -std::string GfxCoreHelperHw::getExtensions(const RootDeviceEnvironment &rootDeviceEnvironment) const { - std::string extensions; - extensions += "cl_intel_subgroup_local_block_io "; - - return extensions; -} - template <> inline void MemorySynchronizationCommands::setBarrierExtraProperties(void *barrierCmd, PipeControlArgs &args) { auto &pipeControl = *reinterpret_cast(barrierCmd); diff --git a/shared/source/gen8/enable_compiler_product_helper_bdw.cpp b/shared/source/gen8/enable_compiler_product_helper_bdw.cpp index b999cdc206..e0f5156409 100644 --- a/shared/source/gen8/enable_compiler_product_helper_bdw.cpp +++ b/shared/source/gen8/enable_compiler_product_helper_bdw.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl" namespace NEO { diff --git a/shared/source/gen9/enable_compiler_product_helper_bxt.cpp b/shared/source/gen9/enable_compiler_product_helper_bxt.cpp index 0120594271..45fbd5b27e 100644 --- a/shared/source/gen9/enable_compiler_product_helper_bxt.cpp +++ b/shared/source/gen9/enable_compiler_product_helper_bxt.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl" namespace NEO { diff --git a/shared/source/gen9/enable_compiler_product_helper_cfl.cpp b/shared/source/gen9/enable_compiler_product_helper_cfl.cpp index f7d9590c2a..14a72f8c73 100644 --- a/shared/source/gen9/enable_compiler_product_helper_cfl.cpp +++ b/shared/source/gen9/enable_compiler_product_helper_cfl.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl" namespace NEO { template <> diff --git a/shared/source/gen9/enable_compiler_product_helper_glk.cpp b/shared/source/gen9/enable_compiler_product_helper_glk.cpp index 34f0b77a0c..7f82960e7d 100644 --- a/shared/source/gen9/enable_compiler_product_helper_glk.cpp +++ b/shared/source/gen9/enable_compiler_product_helper_glk.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl" namespace NEO { template <> diff --git a/shared/source/gen9/enable_compiler_product_helper_kbl.cpp b/shared/source/gen9/enable_compiler_product_helper_kbl.cpp index e8969b5d25..6142a84767 100644 --- a/shared/source/gen9/enable_compiler_product_helper_kbl.cpp +++ b/shared/source/gen9/enable_compiler_product_helper_kbl.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl" namespace NEO { template <> diff --git a/shared/source/gen9/enable_compiler_product_helper_skl.cpp b/shared/source/gen9/enable_compiler_product_helper_skl.cpp index d692195bde..018d323d77 100644 --- a/shared/source/gen9/enable_compiler_product_helper_skl.cpp +++ b/shared/source/gen9/enable_compiler_product_helper_skl.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hp.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl" namespace NEO { diff --git a/shared/source/helpers/CMakeLists.txt b/shared/source/helpers/CMakeLists.txt index 3002e4fed3..b044f0fbb5 100644 --- a/shared/source/helpers/CMakeLists.txt +++ b/shared/source/helpers/CMakeLists.txt @@ -45,6 +45,8 @@ set(NEO_CORE_HELPERS ${CMAKE_CURRENT_SOURCE_DIR}/compiler_product_helper_bdw_and_later.inl ${CMAKE_CURRENT_SOURCE_DIR}/compiler_product_helper_before_xe_hp.inl ${CMAKE_CURRENT_SOURCE_DIR}/compiler_product_helper_before_xe_hpc.inl + ${CMAKE_CURRENT_SOURCE_DIR}/compiler_product_helper_disable_subgroup_local_block_io.inl + ${CMAKE_CURRENT_SOURCE_DIR}/compiler_product_helper_enable_subgroup_local_block_io.inl ${CMAKE_CURRENT_SOURCE_DIR}/compiler_product_helper_xe_hp_and_later.inl ${CMAKE_CURRENT_SOURCE_DIR}/compiler_product_helper_xe_hpc_and_later.inl ${CMAKE_CURRENT_SOURCE_DIR}/compiler_options_parser.cpp diff --git a/shared/source/helpers/compiler_product_helper.h b/shared/source/helpers/compiler_product_helper.h index a0f0c65f40..ad07eabb50 100644 --- a/shared/source/helpers/compiler_product_helper.h +++ b/shared/source/helpers/compiler_product_helper.h @@ -38,6 +38,11 @@ class CompilerProductHelper { virtual bool isStatelessToStatefulBufferOffsetSupported() const = 0; virtual bool isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const = 0; virtual bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const = 0; + virtual bool isSubgroupLocalBlockIoSupported() const = 0; + virtual bool isDotAccumulateSupported() const = 0; + virtual bool isCreateBufferWithPropertiesSupported() const = 0; + virtual bool isSubgroupNamedBarrierSupported() const = 0; + virtual bool isSubgroupExtendedBlockReadSupported() const = 0; virtual bool isForceToStatelessRequired() const = 0; virtual bool failBuildProgramWithStatefulAccessPreference() const = 0; virtual void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const = 0; @@ -64,6 +69,11 @@ class CompilerProductHelperHw : public CompilerProductHelper { bool isStatelessToStatefulBufferOffsetSupported() const override; bool isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const override; bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const override; + bool isSubgroupLocalBlockIoSupported() const override; + bool isDotAccumulateSupported() const override; + bool isCreateBufferWithPropertiesSupported() const override; + bool isSubgroupNamedBarrierSupported() const override; + bool isSubgroupExtendedBlockReadSupported() const override; bool isForceToStatelessRequired() const override; bool failBuildProgramWithStatefulAccessPreference() const override; void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const override; diff --git a/shared/source/helpers/compiler_product_helper_before_xe_hp.inl b/shared/source/helpers/compiler_product_helper_before_xe_hp.inl index 2a642ca338..8bc5764257 100644 --- a/shared/source/helpers/compiler_product_helper_before_xe_hp.inl +++ b/shared/source/helpers/compiler_product_helper_before_xe_hp.inl @@ -23,4 +23,14 @@ bool CompilerProductHelperHw::isBFloat16ConversionSupported(const Ha return false; } +template +bool CompilerProductHelperHw::isDotAccumulateSupported() const { + return false; +} + +template +bool CompilerProductHelperHw::isCreateBufferWithPropertiesSupported() const { + return false; +} + } // namespace NEO diff --git a/shared/source/helpers/compiler_product_helper_before_xe_hpc.inl b/shared/source/helpers/compiler_product_helper_before_xe_hpc.inl index 867ca5efda..8cf920cf34 100644 --- a/shared/source/helpers/compiler_product_helper_before_xe_hpc.inl +++ b/shared/source/helpers/compiler_product_helper_before_xe_hpc.inl @@ -16,4 +16,14 @@ bool CompilerProductHelperHw::isForceToStatelessRequired() const { return false; } +template +bool CompilerProductHelperHw::isSubgroupNamedBarrierSupported() const { + return false; +} + +template +bool CompilerProductHelperHw::isSubgroupExtendedBlockReadSupported() const { + return false; +} + } // namespace NEO diff --git a/shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl b/shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl new file mode 100644 index 0000000000..6689513e57 --- /dev/null +++ b/shared/source/helpers/compiler_product_helper_disable_subgroup_local_block_io.inl @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2023 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/helpers/compiler_product_helper.h" + +namespace NEO { +template +bool CompilerProductHelperHw::isSubgroupLocalBlockIoSupported() const { + return false; +} + +} // namespace NEO diff --git a/shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl b/shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl new file mode 100644 index 0000000000..1d82b7abb7 --- /dev/null +++ b/shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2023 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/helpers/compiler_product_helper.h" + +namespace NEO { +template +bool CompilerProductHelperHw::isSubgroupLocalBlockIoSupported() const { + return true; +} + +} // namespace NEO diff --git a/shared/source/helpers/compiler_product_helper_xe_hp_and_later.inl b/shared/source/helpers/compiler_product_helper_xe_hp_and_later.inl index b61cb720cf..b35306f6b1 100644 --- a/shared/source/helpers/compiler_product_helper_xe_hp_and_later.inl +++ b/shared/source/helpers/compiler_product_helper_xe_hp_and_later.inl @@ -23,4 +23,14 @@ bool CompilerProductHelperHw::isBFloat16ConversionSupported(const Ha return true; } +template +bool CompilerProductHelperHw::isDotAccumulateSupported() const { + return true; +} + +template +bool CompilerProductHelperHw::isCreateBufferWithPropertiesSupported() const { + return true; +} + } // namespace NEO diff --git a/shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl b/shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl index 42fa0d9f2d..e1257984d4 100644 --- a/shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl +++ b/shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl @@ -20,4 +20,14 @@ bool CompilerProductHelperHw::isForceToStatelessRequired() const { return true; } +template +bool CompilerProductHelperHw::isSubgroupNamedBarrierSupported() const { + return true; +} + +template +bool CompilerProductHelperHw::isSubgroupExtendedBlockReadSupported() const { + return true; +} + } // namespace NEO diff --git a/shared/source/helpers/gfx_core_helper_base.inl b/shared/source/helpers/gfx_core_helper_base.inl index a992d18a53..0ab7e44048 100644 --- a/shared/source/helpers/gfx_core_helper_base.inl +++ b/shared/source/helpers/gfx_core_helper_base.inl @@ -12,6 +12,7 @@ #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/basic_math.h" +#include "shared/source/helpers/compiler_product_helper.h" #include "shared/source/helpers/constants.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/hw_info.h" @@ -683,4 +684,37 @@ template bool GfxCoreHelperHw::isRelaxedOrderingSupported() const { return false; } + +template +std::string GfxCoreHelperHw::getExtensions(const RootDeviceEnvironment &rootDeviceEnvironment) const { + std::string extensions = ""; + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); + auto &compilerProductHelper = rootDeviceEnvironment.template getHelper(); + + if (compilerProductHelper.isCreateBufferWithPropertiesSupported()) { + extensions += "cl_intel_create_buffer_with_properties "; + } + + if (compilerProductHelper.isDotAccumulateSupported()) { + extensions += "cl_intel_dot_accumulate "; + } + + if (compilerProductHelper.isSubgroupLocalBlockIoSupported()) { + extensions += "cl_intel_subgroup_local_block_io "; + } + + if (compilerProductHelper.isMatrixMultiplyAccumulateSupported(hwInfo)) { + extensions += "cl_intel_subgroup_matrix_multiply_accumulate "; + extensions += "cl_intel_subgroup_split_matrix_multiply_accumulate "; + } + + if (compilerProductHelper.isSubgroupNamedBarrierSupported()) { + extensions += "cl_khr_subgroup_named_barrier "; + } + + if (compilerProductHelper.isSubgroupExtendedBlockReadSupported()) { + extensions += "cl_intel_subgroup_extended_block_read "; + } + return extensions; +} } // namespace NEO diff --git a/shared/source/helpers/gfx_core_helper_bdw_and_later.inl b/shared/source/helpers/gfx_core_helper_bdw_and_later.inl index a19a2c304c..0f540ba9ef 100644 --- a/shared/source/helpers/gfx_core_helper_bdw_and_later.inl +++ b/shared/source/helpers/gfx_core_helper_bdw_and_later.inl @@ -71,11 +71,6 @@ EngineGroupType GfxCoreHelperHw::getEngineGroupType(aub_stream::Engin } } -template -std::string GfxCoreHelperHw::getExtensions(const RootDeviceEnvironment &rootDeviceEnvironment) const { - return ""; -} - template uint32_t GfxCoreHelperHw::getMocsIndex(const GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const { if (l3enabled) { diff --git a/shared/source/xe_hp_core/enable_compiler_product_helper_xe_hp_sdv.cpp b/shared/source/xe_hp_core/enable_compiler_product_helper_xe_hp_sdv.cpp index f7f35725f5..d4c4343d19 100644 --- a/shared/source/xe_hp_core/enable_compiler_product_helper_xe_hp_sdv.cpp +++ b/shared/source/xe_hp_core/enable_compiler_product_helper_xe_hp_sdv.cpp @@ -10,6 +10,7 @@ #include "shared/source/helpers/compiler_product_helper_base.inl" #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" #include "shared/source/helpers/compiler_product_helper_xe_hp_and_later.inl" namespace NEO { diff --git a/shared/source/xe_hp_core/gfx_core_helper_xe_hp_core.cpp b/shared/source/xe_hp_core/gfx_core_helper_xe_hp_core.cpp index d7081571ec..4ca28a0d0b 100644 --- a/shared/source/xe_hp_core/gfx_core_helper_xe_hp_core.cpp +++ b/shared/source/xe_hp_core/gfx_core_helper_xe_hp_core.cpp @@ -93,17 +93,6 @@ const StackVec GfxCoreHelperHw::getThreadsPerEUConfigs() co return {4, 8}; } -template <> -std::string GfxCoreHelperHw::getExtensions(const RootDeviceEnvironment &rootDeviceEnvironment) const { - std::string extensions; - extensions += "cl_intel_dot_accumulate "; - extensions += "cl_intel_subgroup_local_block_io "; - extensions += "cl_intel_subgroup_matrix_multiply_accumulate "; - extensions += "cl_intel_subgroup_split_matrix_multiply_accumulate "; - - return extensions; -} - template <> void MemorySynchronizationCommands::setBarrierWaFlags(void *barrierCmd) { auto &pipeControl = *reinterpret_cast(barrierCmd); diff --git a/shared/source/xe_hpc_core/enable_compiler_product_helper_pvc.cpp b/shared/source/xe_hpc_core/enable_compiler_product_helper_pvc.cpp index a8040430d7..b9fcf9e483 100644 --- a/shared/source/xe_hpc_core/enable_compiler_product_helper_pvc.cpp +++ b/shared/source/xe_hpc_core/enable_compiler_product_helper_pvc.cpp @@ -9,6 +9,7 @@ #include "shared/source/helpers/compiler_product_helper.h" #include "shared/source/helpers/compiler_product_helper_base.inl" #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" #include "shared/source/helpers/compiler_product_helper_xe_hp_and_later.inl" #include "shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl" diff --git a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp index c06a2358a4..952e984f3f 100644 --- a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp @@ -275,21 +275,6 @@ uint32_t GfxCoreHelperHw::getNumCacheRegions() const { return numTotalCacheRegions; } -template <> -std::string GfxCoreHelperHw::getExtensions(const RootDeviceEnvironment &rootDeviceEnvironment) const { - std::string extensions; - - extensions += "cl_intel_create_buffer_with_properties "; - extensions += "cl_intel_dot_accumulate "; - extensions += "cl_intel_subgroup_local_block_io "; - extensions += "cl_khr_subgroup_named_barrier "; - extensions += "cl_intel_subgroup_extended_block_read "; - extensions += "cl_intel_subgroup_matrix_multiply_accumulate "; - extensions += "cl_intel_subgroup_split_matrix_multiply_accumulate "; - - return extensions; -} - template <> uint32_t GfxCoreHelperHw::alignSlmSize(uint32_t slmSize) const { const uint32_t alignedSlmSizes[] = { diff --git a/shared/source/xe_hpg_core/enable_compiler_product_helper_dg2.cpp b/shared/source/xe_hpg_core/enable_compiler_product_helper_dg2.cpp index 61026a4557..2903914ee2 100644 --- a/shared/source/xe_hpg_core/enable_compiler_product_helper_dg2.cpp +++ b/shared/source/xe_hpg_core/enable_compiler_product_helper_dg2.cpp @@ -10,6 +10,7 @@ #include "shared/source/helpers/compiler_product_helper_base.inl" #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" #include "shared/source/helpers/compiler_product_helper_xe_hp_and_later.inl" #include "compiler_product_helper_dg2.inl" diff --git a/shared/source/xe_hpg_core/enable_compiler_product_helper_mtl.cpp b/shared/source/xe_hpg_core/enable_compiler_product_helper_mtl.cpp index c95ed35c54..f994ac15de 100644 --- a/shared/source/xe_hpg_core/enable_compiler_product_helper_mtl.cpp +++ b/shared/source/xe_hpg_core/enable_compiler_product_helper_mtl.cpp @@ -10,6 +10,7 @@ #include "shared/source/helpers/compiler_product_helper_base.inl" #include "shared/source/helpers/compiler_product_helper_bdw_and_later.inl" #include "shared/source/helpers/compiler_product_helper_before_xe_hpc.inl" +#include "shared/source/helpers/compiler_product_helper_enable_subgroup_local_block_io.inl" #include "shared/source/helpers/compiler_product_helper_xe_hp_and_later.inl" #include "shared/source/xe_hpg_core/hw_cmds_mtl.h" diff --git a/shared/source/xe_hpg_core/gfx_core_helper_xe_hpg_core.cpp b/shared/source/xe_hpg_core/gfx_core_helper_xe_hpg_core.cpp index fac0b43d40..a2b15a3f7c 100644 --- a/shared/source/xe_hpg_core/gfx_core_helper_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/gfx_core_helper_xe_hpg_core.cpp @@ -98,23 +98,6 @@ const StackVec GfxCoreHelperHw::getThreadsPerEUConfigs() co return {4, 8}; } -template <> -std::string GfxCoreHelperHw::getExtensions(const RootDeviceEnvironment &rootDeviceEnvironment) const { - std::string extensions; - extensions += "cl_intel_create_buffer_with_properties "; - extensions += "cl_intel_dot_accumulate "; - extensions += "cl_intel_subgroup_local_block_io "; - - auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); - auto &compilerProductHelper = rootDeviceEnvironment.template getHelper(); - if (compilerProductHelper.isMatrixMultiplyAccumulateSupported(hwInfo)) { - extensions += "cl_intel_subgroup_matrix_multiply_accumulate "; - extensions += "cl_intel_subgroup_split_matrix_multiply_accumulate "; - } - - return extensions; -} - template <> bool GfxCoreHelperHw::isBufferSizeSuitableForCompression(const size_t size) const { if (DebugManager.flags.OverrideBufferSuitableForRenderCompression.get() != -1) { diff --git a/shared/test/common/test_macros/header/common_matchers.h b/shared/test/common/test_macros/header/common_matchers.h index 647bed859f..889edf6f1f 100644 --- a/shared/test/common/test_macros/header/common_matchers.h +++ b/shared/test/common/test_macros/header/common_matchers.h @@ -18,9 +18,11 @@ using IsXeHpcCore = IsGfxCore; using IsNotXeHpcCore = IsNotGfxCore; using IsNotXeHpgCore = IsNotGfxCore; +using IsAtMostGen9 = IsAtMostGfxCore; using IsAtLeastGen9 = IsAtLeastGfxCore; using IsAtMostGen11 = IsAtMostGfxCore; +using IsAtLeastGen11 = IsAtLeastGfxCore; using IsAtMostGen12lp = IsAtMostGfxCore; diff --git a/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp b/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp index f94b50cff0..bd6fa2eaed 100644 --- a/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp +++ b/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp @@ -50,6 +50,66 @@ HWTEST2_F(CompilerProductHelperFixture, GivenXeHpcAndLaterWhenIsForceToStateless EXPECT_FALSE(compilerProductHelper.isForceToStatelessRequired()); } +HWTEST2_F(CompilerProductHelperFixture, GivenGen11AndLaterThenSubgroupLocalBlockIoIsSupported, IsAtLeastGen11) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_TRUE(compilerProductHelper.isSubgroupLocalBlockIoSupported()); +} + +HWTEST2_F(CompilerProductHelperFixture, GivenGen9OrBeforeThenSubgroupLocalBlockIoIsNotSupported, IsAtMostGen9) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_FALSE(compilerProductHelper.isSubgroupLocalBlockIoSupported()); +} + +HWTEST2_F(CompilerProductHelperFixture, GivenXeHpAndLaterThenDotAccumulateIsSupported, IsAtLeastXeHpCore) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_TRUE(compilerProductHelper.isDotAccumulateSupported()); +} + +HWTEST2_F(CompilerProductHelperFixture, GivenPreXeHpThenDotAccumulateIsNotSupported, IsAtMostGen12lp) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_FALSE(compilerProductHelper.isDotAccumulateSupported()); +} + +HWTEST2_F(CompilerProductHelperFixture, GivenXeHpAndLaterThenCreateBufferWithPropertiesIsSupported, IsAtLeastXeHpCore) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_TRUE(compilerProductHelper.isCreateBufferWithPropertiesSupported()); +} + +HWTEST2_F(CompilerProductHelperFixture, GivenPreXeHpThenCreateBufferWithPropertiesIsNotSupported, IsAtMostGen12lp) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_FALSE(compilerProductHelper.isCreateBufferWithPropertiesSupported()); +} + +HWTEST2_F(CompilerProductHelperFixture, GivenXeHpcAndLaterThenSubgroupNamedBarrierIsSupported, IsAtLeastXeHpcCore) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_TRUE(compilerProductHelper.isSubgroupNamedBarrierSupported()); +} + +HWTEST2_F(CompilerProductHelperFixture, GivenPreXeHpcThenSubgroupNamedBarrierIsNotSupported, IsAtMostXeHpgCore) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_FALSE(compilerProductHelper.isSubgroupNamedBarrierSupported()); +} + +HWTEST2_F(CompilerProductHelperFixture, GivenXeHpcAndLaterThenSubgroupExtendedBlockReadIsSupported, IsAtLeastXeHpcCore) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_TRUE(compilerProductHelper.isSubgroupExtendedBlockReadSupported()); +} + +HWTEST2_F(CompilerProductHelperFixture, GivenPreXeHpcThenSubgroupExtendedBlockReadIsNotSupported, IsAtMostXeHpgCore) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + + EXPECT_FALSE(compilerProductHelper.isSubgroupExtendedBlockReadSupported()); +} + HWTEST2_F(CompilerProductHelperFixture, GivenXeHpAndLaterThenBFloat16ConversionIsSupported, IsAtLeastXeHpCore) { auto &compilerProductHelper = pDevice->getCompilerProductHelper();