From c59c4b29572cb052a76641b9203f090222da1d4d Mon Sep 17 00:00:00 2001 From: Katarzyna Cencelewska Date: Fri, 10 Jun 2022 13:16:04 +0000 Subject: [PATCH] Add hwInfo as argument to method getSupportedDeviceFeatureCapabilities set proper value in method isMatrixMultiplyAccumulateSupported to be consistent with support of extension *matrix_multiply_accumulate* Signed-off-by: Katarzyna Cencelewska --- opencl/source/cl_device/cl_device_info.cpp | 5 +++-- opencl/source/gen12lp/cl_hw_helper_gen12lp.cpp | 4 ++-- opencl/source/helpers/cl_device_helpers.cpp | 4 ++-- opencl/source/helpers/cl_device_helpers.h | 5 +++-- opencl/source/helpers/cl_hw_helper.h | 6 +++--- opencl/source/helpers/cl_hw_helper_bdw_and_later.inl | 4 ++-- opencl/source/helpers/cl_hw_helper_xehp_and_later.inl | 6 +++--- opencl/test/unit_test/device/get_device_info_tests.cpp | 2 +- opencl/test/unit_test/gen11/hw_helper_tests_gen11.cpp | 4 ++-- opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl | 2 +- opencl/test/unit_test/gen8/cl_hw_helper_tests_gen8.cpp | 4 ++-- opencl/test/unit_test/gen9/hw_helper_tests_gen9.cpp | 4 ++-- .../unit_test/helpers/hw_helper_tests_xehp_and_later.cpp | 4 ++++ shared/source/os_interface/hw_info_config.inl | 5 ----- .../source/os_interface/hw_info_config_bdw_and_later.inl | 4 ++++ .../source/os_interface/hw_info_config_xehp_and_later.inl | 5 +++++ .../xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl | 5 ----- shared/test/common/mocks/mock_hw_info_config.cpp | 5 +++++ shared/test/unit_test/gen8/hw_helper_tests_gen8.cpp | 8 +++++++- 19 files changed, 51 insertions(+), 35 deletions(-) diff --git a/opencl/source/cl_device/cl_device_info.cpp b/opencl/source/cl_device/cl_device_info.cpp index 15d5fb6145..0310c29c24 100644 --- a/opencl/source/cl_device/cl_device_info.cpp +++ b/opencl/source/cl_device/cl_device_info.cpp @@ -281,8 +281,9 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName, break; } case CL_DEVICE_FEATURE_CAPABILITIES_INTEL: { - auto &clHwHelper = ClHwHelper::get(getHardwareInfo().platform.eRenderCoreFamily); - param.bitfield = clHwHelper.getSupportedDeviceFeatureCapabilities(); + auto &hwInfo = getHardwareInfo(); + auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily); + param.bitfield = clHwHelper.getSupportedDeviceFeatureCapabilities(hwInfo); src = ¶m.bitfield; retSize = srcSize = sizeof(cl_device_feature_capabilities_intel); break; diff --git a/opencl/source/gen12lp/cl_hw_helper_gen12lp.cpp b/opencl/source/gen12lp/cl_hw_helper_gen12lp.cpp index 03a427c749..645353fcac 100644 --- a/opencl/source/gen12lp/cl_hw_helper_gen12lp.cpp +++ b/opencl/source/gen12lp/cl_hw_helper_gen12lp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,7 +24,7 @@ void populateFactoryTable>() { } template <> -cl_device_feature_capabilities_intel ClHwHelperHw::getSupportedDeviceFeatureCapabilities() const { +cl_device_feature_capabilities_intel ClHwHelperHw::getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const { return CL_DEVICE_FEATURE_FLAG_DP4A_INTEL; } diff --git a/opencl/source/helpers/cl_device_helpers.cpp b/opencl/source/helpers/cl_device_helpers.cpp index 53218bba6c..546fd8a08e 100644 --- a/opencl/source/helpers/cl_device_helpers.cpp +++ b/opencl/source/helpers/cl_device_helpers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,5 +9,5 @@ namespace NEO { void ClDeviceHelper::getExtraDeviceInfo(const ClDevice &clDevice, cl_device_info paramName, ClDeviceInfoParam ¶m, const void *&src, size_t &size, size_t &retSize) {} -cl_device_feature_capabilities_intel ClDeviceHelper::getExtraCapabilities() { return 0; } +cl_device_feature_capabilities_intel ClDeviceHelper::getExtraCapabilities(const HardwareInfo &hwInfo) { return 0; } } // namespace NEO diff --git a/opencl/source/helpers/cl_device_helpers.h b/opencl/source/helpers/cl_device_helpers.h index e6978cf139..4395f6efaf 100644 --- a/opencl/source/helpers/cl_device_helpers.h +++ b/opencl/source/helpers/cl_device_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,9 +14,10 @@ namespace NEO { class ClDevice; struct ClDeviceInfoParam; +struct HardwareInfo; namespace ClDeviceHelper { void getExtraDeviceInfo(const ClDevice &clDevice, cl_device_info paramName, ClDeviceInfoParam ¶m, const void *&src, size_t &size, size_t &retSize); -cl_device_feature_capabilities_intel getExtraCapabilities(); +cl_device_feature_capabilities_intel getExtraCapabilities(const HardwareInfo &hwInfo); }; // namespace ClDeviceHelper } // namespace NEO diff --git a/opencl/source/helpers/cl_hw_helper.h b/opencl/source/helpers/cl_hw_helper.h index 53c3b36586..3ca3bc0855 100644 --- a/opencl/source/helpers/cl_hw_helper.h +++ b/opencl/source/helpers/cl_hw_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -39,7 +39,7 @@ class ClHwHelper { virtual bool isSupportedKernelThreadArbitrationPolicy() const = 0; virtual std::vector getSupportedThreadArbitrationPolicies() const = 0; virtual cl_version getDeviceIpVersion(const HardwareInfo &hwInfo) const = 0; - virtual cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities() const = 0; + virtual cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const = 0; virtual bool allowImageCompression(cl_image_format format) const = 0; virtual bool isFormatRedescribable(cl_image_format format) const = 0; @@ -70,7 +70,7 @@ class ClHwHelperHw : public ClHwHelper { bool isSupportedKernelThreadArbitrationPolicy() const override; std::vector getSupportedThreadArbitrationPolicies() const override; cl_version getDeviceIpVersion(const HardwareInfo &hwInfo) const override; - cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities() const override; + cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const override; bool allowImageCompression(cl_image_format format) const override; bool isFormatRedescribable(cl_image_format format) const override; diff --git a/opencl/source/helpers/cl_hw_helper_bdw_and_later.inl b/opencl/source/helpers/cl_hw_helper_bdw_and_later.inl index 3d7deaf659..32a5cd19f4 100644 --- a/opencl/source/helpers/cl_hw_helper_bdw_and_later.inl +++ b/opencl/source/helpers/cl_hw_helper_bdw_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,7 +24,7 @@ cl_ulong ClHwHelperHw::getKernelPrivateMemSize(const KernelInfo &kern } template -cl_device_feature_capabilities_intel ClHwHelperHw::getSupportedDeviceFeatureCapabilities() const { +cl_device_feature_capabilities_intel ClHwHelperHw::getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const { return 0; } diff --git a/opencl/source/helpers/cl_hw_helper_xehp_and_later.inl b/opencl/source/helpers/cl_hw_helper_xehp_and_later.inl index 85f116d703..517625a545 100644 --- a/opencl/source/helpers/cl_hw_helper_xehp_and_later.inl +++ b/opencl/source/helpers/cl_hw_helper_xehp_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,8 +22,8 @@ cl_ulong ClHwHelperHw::getKernelPrivateMemSize(const KernelInfo &kern } template -cl_device_feature_capabilities_intel ClHwHelperHw::getSupportedDeviceFeatureCapabilities() const { - return ClDeviceHelper::getExtraCapabilities(); +cl_device_feature_capabilities_intel ClHwHelperHw::getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const { + return ClDeviceHelper::getExtraCapabilities(hwInfo); } template diff --git a/opencl/test/unit_test/device/get_device_info_tests.cpp b/opencl/test/unit_test/device/get_device_info_tests.cpp index 10f4a8fa5b..132e62a7af 100644 --- a/opencl/test/unit_test/device/get_device_info_tests.cpp +++ b/opencl/test/unit_test/device/get_device_info_tests.cpp @@ -1126,7 +1126,7 @@ struct DeviceAttributeQueryTest : public ::testing::TestWithParam(object.get()); auto &hwInfo = device.getHardwareInfo(); auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily); - EXPECT_EQ(clHwHelper.getSupportedDeviceFeatureCapabilities(), *pCapabilities); + EXPECT_EQ(clHwHelper.getSupportedDeviceFeatureCapabilities(hwInfo), *pCapabilities); EXPECT_EQ(sizeof(cl_device_feature_capabilities_intel), sizeReturned); break; } diff --git a/opencl/test/unit_test/gen11/hw_helper_tests_gen11.cpp b/opencl/test/unit_test/gen11/hw_helper_tests_gen11.cpp index 6d3c12f787..1dff0ec988 100644 --- a/opencl/test/unit_test/gen11/hw_helper_tests_gen11.cpp +++ b/opencl/test/unit_test/gen11/hw_helper_tests_gen11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -41,7 +41,7 @@ GEN11TEST_F(HwHelperTestGen11, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIp } GEN11TEST_F(HwHelperTestGen11, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) { - EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities()); + EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities(hardwareInfo)); } using MemorySynchronizatiopCommandsTestsGen11 = ::testing::Test; diff --git a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl index 4d96e4d395..c53ce7172a 100644 --- a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl @@ -413,7 +413,7 @@ HWTEST2_F(HwHelperTestGen12Lp, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIp GEN12LPTEST_F(HwHelperTestGen12Lp, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) { cl_device_feature_capabilities_intel expectedCapabilities = CL_DEVICE_FEATURE_FLAG_DP4A_INTEL; - EXPECT_EQ(expectedCapabilities, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities()); + EXPECT_EQ(expectedCapabilities, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities(hardwareInfo)); } GEN12LPTEST_F(HwHelperTestGen12Lp, givenLocalMemoryFeatureDisabledWhenIsLocalMemoryEnabledIsCalledThenTrueIsReturned) { diff --git a/opencl/test/unit_test/gen8/cl_hw_helper_tests_gen8.cpp b/opencl/test/unit_test/gen8/cl_hw_helper_tests_gen8.cpp index 08859068a9..e1f9ea9ee1 100644 --- a/opencl/test/unit_test/gen8/cl_hw_helper_tests_gen8.cpp +++ b/opencl/test/unit_test/gen8/cl_hw_helper_tests_gen8.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,5 +19,5 @@ GEN8TEST_F(ClHwHelperTestGen8, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIp } GEN8TEST_F(ClHwHelperTestGen8, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) { - EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities()); + EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities(*defaultHwInfo)); } diff --git a/opencl/test/unit_test/gen9/hw_helper_tests_gen9.cpp b/opencl/test/unit_test/gen9/hw_helper_tests_gen9.cpp index 70a90a1b89..b75ba89627 100644 --- a/opencl/test/unit_test/gen9/hw_helper_tests_gen9.cpp +++ b/opencl/test/unit_test/gen9/hw_helper_tests_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -53,7 +53,7 @@ GEN9TEST_F(HwHelperTestGen9, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVe } GEN9TEST_F(HwHelperTestGen9, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) { - EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities()); + EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities(*defaultHwInfo)); } using MemorySynchronizatiopCommandsTestsGen9 = ::testing::Test; diff --git a/opencl/test/unit_test/helpers/hw_helper_tests_xehp_and_later.cpp b/opencl/test/unit_test/helpers/hw_helper_tests_xehp_and_later.cpp index 4139fe8ae5..df8cd6b5c1 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests_xehp_and_later.cpp @@ -494,3 +494,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, HwInfoConfigTestXeHpAndLater, givenCLImageFormatsWh EXPECT_EQ(false, clHwHelper.isFormatRedescribable(format)); } } + +HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, givenHwInfosWhenIsMatrixMultiplyAccumulateSupportedThenReturnTrue) { + EXPECT_TRUE(HwInfoConfig::get(productFamily)->isMatrixMultiplyAccumulateSupported(*defaultHwInfo)); +} diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index c0c51d6758..9b1eec53cc 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -413,9 +413,4 @@ bool HwInfoConfigHw::isImplicitScalingSupported(const HardwareInfo & return false; } -template -bool HwInfoConfigHw::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const { - return false; -} - } // namespace NEO diff --git a/shared/source/os_interface/hw_info_config_bdw_and_later.inl b/shared/source/os_interface/hw_info_config_bdw_and_later.inl index d8e53dc2eb..51b72011b0 100644 --- a/shared/source/os_interface/hw_info_config_bdw_and_later.inl +++ b/shared/source/os_interface/hw_info_config_bdw_and_later.inl @@ -70,4 +70,8 @@ bool HwInfoConfigHw::useChannelRedForUnusedShaderChannels() const { return true; } +template +bool HwInfoConfigHw::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const { + return false; +} } // namespace NEO diff --git a/shared/source/os_interface/hw_info_config_xehp_and_later.inl b/shared/source/os_interface/hw_info_config_xehp_and_later.inl index b2d34041fb..40ad8ef69c 100644 --- a/shared/source/os_interface/hw_info_config_xehp_and_later.inl +++ b/shared/source/os_interface/hw_info_config_xehp_and_later.inl @@ -67,4 +67,9 @@ bool HwInfoConfigHw::useChannelRedForUnusedShaderChannels() const { return true; } +template +bool HwInfoConfigHw::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const { + return true; +} + } // namespace NEO diff --git a/shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl b/shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl index 97d433da63..45f79c1712 100644 --- a/shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl +++ b/shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl @@ -180,8 +180,3 @@ template <> bool HwInfoConfigHw::isTimestampWaitSupportedForEvents() const { return true; } - -template <> -bool HwInfoConfigHw::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const { - return true; -} diff --git a/shared/test/common/mocks/mock_hw_info_config.cpp b/shared/test/common/mocks/mock_hw_info_config.cpp index 30165234c9..b30ccdd467 100644 --- a/shared/test/common/mocks/mock_hw_info_config.cpp +++ b/shared/test/common/mocks/mock_hw_info_config.cpp @@ -342,6 +342,11 @@ bool HwInfoConfigHw::isBFloat16ConversionSupported(const HardwareI return false; } +template <> +bool HwInfoConfigHw::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const { + return false; +} + template <> bool HwInfoConfigHw::useChannelRedForUnusedShaderChannels() const { return false; diff --git a/shared/test/unit_test/gen8/hw_helper_tests_gen8.cpp b/shared/test/unit_test/gen8/hw_helper_tests_gen8.cpp index fcfbcd6d5e..cea5ca693d 100644 --- a/shared/test/unit_test/gen8/hw_helper_tests_gen8.cpp +++ b/shared/test/unit_test/gen8/hw_helper_tests_gen8.cpp @@ -1,11 +1,12 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/helpers/constants.h" +#include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/helpers/hw_helper_tests.h" #include "shared/test/unit_test/helpers/get_gpgpu_engines_tests.inl" @@ -46,3 +47,8 @@ GEN8TEST_F(MemorySynchronizatiopCommandsTestsGen8, WhenProgrammingCacheFlushThen ASSERT_NE(nullptr, pipeControl); EXPECT_TRUE(pipeControl->getConstantCacheInvalidationEnable()); } + +using HwInfoConfigTestGen8 = Test; +GEN8TEST_F(HwInfoConfigTestGen8, givenHwInfosWhenIsMatrixMultiplyAccumulateSupportedThenReturnFalse) { + EXPECT_FALSE(HwInfoConfig::get(productFamily)->isMatrixMultiplyAccumulateSupported(*defaultHwInfo)); +}