Skip to content

Commit 2c8b86a

Browse files
committed
format and fix
Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent b885482 commit 2c8b86a

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,9 +1451,11 @@ void addInstrRequirements(const MachineInstr &MI,
14511451
const int64_t CoopOperands = MI.getOperand(MulAddMaxSize - 1).getImm();
14521452
if (CoopOperands &
14531453
SPIRV::CooperativeMatrixOperands::MatrixAAndBTF32ComponentsINTEL) {
1454-
report_fatal_error("MatrixAAndBTF32ComponentsINTEL type interpretation "
1455-
"require the following SPIR-V extension: "
1456-
"SPV_INTEL_joint_matrix", false);
1454+
if (!ST.canUseExtension(SPIRV::Extension::SPV_INTEL_joint_matrix))
1455+
report_fatal_error("MatrixAAndBTF32ComponentsINTEL type interpretation "
1456+
"require the following SPIR-V extension: "
1457+
"SPV_INTEL_joint_matrix",
1458+
false);
14571459
Reqs.addExtension(SPIRV::Extension::SPV_INTEL_joint_matrix);
14581460
Reqs.addCapability(
14591461
SPIRV::Capability::CooperativeMatrixTF32ComponentTypeINTEL);
@@ -1464,9 +1466,11 @@ void addInstrRequirements(const MachineInstr &MI,
14641466
SPIRV::CooperativeMatrixOperands::MatrixCBFloat16ComponentsINTEL ||
14651467
CoopOperands & SPIRV::CooperativeMatrixOperands::
14661468
MatrixResultBFloat16ComponentsINTEL) {
1467-
report_fatal_error("***BF16ComponentsINTEL type interpretations require "
1468-
"the following SPIR-V extension: "
1469-
"SPV_INTEL_joint_matrix", false);
1469+
if (!ST.canUseExtension(SPIRV::Extension::SPV_INTEL_joint_matrix))
1470+
report_fatal_error("***BF16ComponentsINTEL type interpretations "
1471+
"require the following SPIR-V extension: "
1472+
"SPV_INTEL_joint_matrix",
1473+
false);
14701474
Reqs.addExtension(SPIRV::Extension::SPV_INTEL_joint_matrix);
14711475
Reqs.addCapability(
14721476
SPIRV::Capability::CooperativeMatrixBFloat16ComponentTypeINTEL);
@@ -1519,21 +1523,22 @@ void addInstrRequirements(const MachineInstr &MI,
15191523
break;
15201524

15211525
std::string InstName;
1522-
switch(OpCode) {
1523-
case SPIRV::OpCooperativeMatrixPrefetchINTEL:
1524-
InstName = "OpCooperativeMatrixPrefetchINTEL";
1525-
break;
1526-
case SPIRV::OpCooperativeMatrixLoadCheckedINTEL:
1527-
InstName = "OpCooperativeMatrixLoadCheckedINTEL";
1528-
break;
1529-
case SPIRV::OpCooperativeMatrixStoreCheckedINTEL:
1530-
InstName = "OpCooperativeMatrixStoreCheckedINTEL";
1531-
break;
1526+
switch (OpCode) {
1527+
case SPIRV::OpCooperativeMatrixPrefetchINTEL:
1528+
InstName = "OpCooperativeMatrixPrefetchINTEL";
1529+
break;
1530+
case SPIRV::OpCooperativeMatrixLoadCheckedINTEL:
1531+
InstName = "OpCooperativeMatrixLoadCheckedINTEL";
1532+
break;
1533+
case SPIRV::OpCooperativeMatrixStoreCheckedINTEL:
1534+
InstName = "OpCooperativeMatrixStoreCheckedINTEL";
1535+
break;
15321536
}
15331537

15341538
if (!ST.canUseExtension(SPIRV::Extension::SPV_INTEL_joint_matrix)) {
1535-
const std::string ErrorMsg = InstName + " instruction requires the "
1536-
"following SPIR-V extension: SPV_INTEL_joint_matrix";
1539+
const std::string ErrorMsg =
1540+
InstName + " instruction requires the "
1541+
"following SPIR-V extension: SPV_INTEL_joint_matrix";
15371542
report_fatal_error(ErrorMsg.c_str(), false);
15381543
}
15391544
Reqs.addExtension(SPIRV::Extension::SPV_INTEL_joint_matrix);

llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_joint_matrix/cooperative_matrix_checked.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: not llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_cooperative_matrix %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
22

3-
; CHECK-ERROR: LLVM ERROR: OpCooperativeMatrixConstructCheckedINTEL instructions require the following SPIR-V extension:SPV_INTEL_joint_matrix
3+
; CHECK-ERROR: LLVM ERROR: OpCooperativeMatrixConstructCheckedINTEL instructions require the following SPIR-V extension: SPV_INTEL_joint_matrix
44

55
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_cooperative_matrix,+SPV_INTEL_joint_matrix %s -o - | FileCheck %s
66

0 commit comments

Comments
 (0)