Skip to content

Commit 691f2f5

Browse files
feature: Enable support for cl_intel_subgroup_matrix_multiply_accumulate_tf32
This change enables support for `cl_intel_subgroup_matrix_multiply_accumulate_tf32` extension for PVC B0 and later. Related-To: GSD-7825 Signed-off-by: Ratajewski, Andrzej <andrzej.ratajewski@intel.com> Source: f7888fa
1 parent af2529c commit 691f2f5

8 files changed

+79
-1
lines changed

opencl/test/unit_test/xe_hpc_core/pvc/test_cl_device_caps_pvc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ PVCTEST_F(PvcClDeviceCapsTests, givenPvcProductWhenDeviceCapsInitializedThenAddP
2121
EXPECT_TRUE(hasSubstr(dInfo.deviceExtensions, std::string("cl_intel_create_buffer_with_properties")));
2222
EXPECT_TRUE(hasSubstr(dInfo.deviceExtensions, std::string("cl_intel_subgroup_local_block_io")));
2323
EXPECT_TRUE(hasSubstr(dInfo.deviceExtensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate")));
24+
EXPECT_TRUE(hasSubstr(dInfo.deviceExtensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate_tf32")));
2425
EXPECT_TRUE(hasSubstr(dInfo.deviceExtensions, std::string("cl_khr_subgroup_named_barrier")));
2526
EXPECT_TRUE(hasSubstr(dInfo.deviceExtensions, std::string("cl_intel_subgroup_extended_block_read")));
2627
EXPECT_TRUE(hasSubstr(dInfo.deviceExtensions, std::string("cl_intel_subgroup_2d_block_io")));

shared/source/helpers/compiler_product_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class CompilerProductHelper {
5656
virtual bool isForceEmuInt32DivRemSPRequired() const = 0;
5757
virtual bool isStatelessToStatefulBufferOffsetSupported() const = 0;
5858
virtual bool isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const = 0;
59+
virtual bool isMatrixMultiplyAccumulateTF32Supported(const HardwareInfo &hwInfo) const = 0;
5960
virtual bool isSplitMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const = 0;
6061
virtual bool isBFloat16ConversionSupported(const ReleaseHelper *releaseHelper) const = 0;
6162
virtual bool isSubgroupLocalBlockIoSupported() const = 0;
@@ -106,6 +107,7 @@ class CompilerProductHelperHw : public CompilerProductHelper {
106107
bool isForceEmuInt32DivRemSPRequired() const override;
107108
bool isStatelessToStatefulBufferOffsetSupported() const override;
108109
bool isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const override;
110+
bool isMatrixMultiplyAccumulateTF32Supported(const HardwareInfo &hwInfo) const override;
109111
bool isSplitMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const override;
110112
bool isBFloat16ConversionSupported(const ReleaseHelper *releaseHelper) const override;
111113
bool isSubgroupLocalBlockIoSupported() const override;

shared/source/helpers/compiler_product_helper_base.inl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ std::string CompilerProductHelperHw<gfxProduct>::getDeviceExtensions(const Hardw
181181
extensions += "cl_intel_subgroup_matrix_multiply_accumulate ";
182182
}
183183

184+
if (isMatrixMultiplyAccumulateTF32Supported(hwInfo)) {
185+
extensions += "cl_intel_subgroup_matrix_multiply_accumulate_tf32 ";
186+
}
187+
184188
if (isSplitMatrixMultiplyAccumulateSupported(releaseHelper)) {
185189
extensions += "cl_intel_subgroup_split_matrix_multiply_accumulate ";
186190
}

shared/source/helpers/compiler_product_helper_before_xe_hpc.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ bool CompilerProductHelperHw<gfxProduct>::isForceToStatelessRequired() const {
1616
return false;
1717
}
1818

19+
template <PRODUCT_FAMILY gfxProduct>
20+
bool CompilerProductHelperHw<gfxProduct>::isMatrixMultiplyAccumulateTF32Supported(const HardwareInfo &hwInfo) const {
21+
return false;
22+
}
23+
1924
template <PRODUCT_FAMILY gfxProduct>
2025
bool CompilerProductHelperHw<gfxProduct>::isSubgroupNamedBarrierSupported() const {
2126
return false;

shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ bool CompilerProductHelperHw<gfxProduct>::isForceToStatelessRequired() const {
2020
return true;
2121
}
2222

23+
template <PRODUCT_FAMILY gfxProduct>
24+
bool CompilerProductHelperHw<gfxProduct>::isMatrixMultiplyAccumulateTF32Supported(const HardwareInfo &hwInfo) const {
25+
return true;
26+
}
27+
2328
template <PRODUCT_FAMILY gfxProduct>
2429
bool CompilerProductHelperHw<gfxProduct>::isSubgroupNamedBarrierSupported() const {
2530
return true;

shared/source/xe_hpc_core/enable_compiler_product_helper_pvc.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ bool CompilerProductHelperHw<IGFX_PVC>::isMatrixMultiplyAccumulateSupported(cons
7777
return true;
7878
}
7979

80+
template <>
81+
bool CompilerProductHelperHw<IGFX_PVC>::isMatrixMultiplyAccumulateTF32Supported(const HardwareInfo &hwInfo) const {
82+
auto config = getProductConfigFromHwInfo(hwInfo);
83+
if (config >= AOT::PVC_XT_B0 && config < AOT::PVC_XT_C0_VG)
84+
return true;
85+
return false;
86+
}
87+
8088
template <>
8189
bool CompilerProductHelperHw<IGFX_PVC>::isBFloat16ConversionSupported(const ReleaseHelper *releaseHelper) const {
8290
return true;

shared/test/unit_test/helpers/compiler_product_helper_tests.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@ HWTEST2_F(CompilerProductHelperFixture, GivenReleaseHelperThenMatrixMultiplyAccu
168168
}
169169
}
170170

171+
HWTEST2_F(CompilerProductHelperFixture, GivenXeHpcAndLaterThenMatrixMultiplyAccumulateTF32IsSupported, IsAtLeastXeHpcCore) {
172+
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
173+
auto hwInfo = *defaultHwInfo;
174+
175+
EXPECT_TRUE(compilerProductHelper.isMatrixMultiplyAccumulateTF32Supported(hwInfo));
176+
}
177+
178+
HWTEST2_F(CompilerProductHelperFixture, GivenPreXeHpcThenMatrixMultiplyAccumulateTF32IsNotSupported, IsAtMostXeHpgCore) {
179+
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
180+
auto hwInfo = *defaultHwInfo;
181+
182+
EXPECT_FALSE(compilerProductHelper.isMatrixMultiplyAccumulateTF32Supported(hwInfo));
183+
}
184+
171185
HWTEST2_F(CompilerProductHelperFixture, GivenReleaseHelperThenDotProductAccumulateSystolicIsSupportedBasedOnReleaseHelper, IsNotXeHpcCore) {
172186
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
173187
auto releaseHelper = pDevice->getReleaseHelper();

shared/test/unit_test/xe_hpc_core/pvc/compiler_product_helper_tests_pvc.cpp

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/*
2-
* Copyright (C) 2023 Intel Corporation
2+
* Copyright (C) 2023-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#include "shared/source/helpers/compiler_product_helper.h"
9+
#include "shared/source/os_interface/product_helper.h"
910
#include "shared/source/xe_hpc_core/hw_cmds_pvc.h"
11+
#include "shared/source/xe_hpc_core/pvc/device_ids_configs_pvc.h"
1012
#include "shared/test/common/mocks/mock_execution_environment.h"
1113
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
1214
#include "shared/test/common/test_macros/test.h"
@@ -42,3 +44,40 @@ PVCTEST_F(CompilerProductHelperPvcTest, givenPvcWhenFailBuildProgramWithStateful
4244
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
4345
EXPECT_FALSE(compilerProductHelper.failBuildProgramWithStatefulAccessPreference());
4446
}
47+
48+
PVCTEST_F(CompilerProductHelperPvcTest, givenPvcB0AndLaterThenMatrixMultiplyAccumulateTF32IsSupported) {
49+
MockExecutionEnvironment executionEnvironment{};
50+
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
51+
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
52+
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
53+
54+
auto hwInfo = *rootDeviceEnvironment.getHardwareInfo();
55+
56+
for (auto revision : {REVISION_A0, REVISION_B}) {
57+
for (auto deviceId : pvcXlDeviceIds) {
58+
hwInfo.platform.usDeviceID = deviceId;
59+
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo);
60+
EXPECT_FALSE(compilerProductHelper.isMatrixMultiplyAccumulateTF32Supported(hwInfo));
61+
}
62+
}
63+
64+
for (auto deviceId : pvcXtDeviceIds) {
65+
hwInfo.platform.usDeviceID = deviceId;
66+
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
67+
EXPECT_FALSE(compilerProductHelper.isMatrixMultiplyAccumulateTF32Supported(hwInfo));
68+
}
69+
70+
for (auto revision : {REVISION_B, REVISION_C}) {
71+
for (auto deviceId : pvcXtDeviceIds) {
72+
hwInfo.platform.usDeviceID = deviceId;
73+
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo);
74+
EXPECT_TRUE(compilerProductHelper.isMatrixMultiplyAccumulateTF32Supported(hwInfo));
75+
}
76+
}
77+
78+
for (auto deviceId : pvcXtVgDeviceIds) {
79+
hwInfo.platform.usDeviceID = deviceId;
80+
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_C, hwInfo);
81+
EXPECT_FALSE(compilerProductHelper.isMatrixMultiplyAccumulateTF32Supported(hwInfo));
82+
}
83+
}

0 commit comments

Comments
 (0)