Skip to content

Commit 5f459b8

Browse files
committed
format
Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent 0556328 commit 5f459b8

File tree

4 files changed

+52
-48
lines changed

4 files changed

+52
-48
lines changed

llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVBaseInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ namespace Opcode {
210210
namespace CooperativeMatrixLayout {
211211
#define GET_CooperativeMatrixLayout_DECL
212212
#include "SPIRVGenTables.inc"
213-
} // namespace Opcode
213+
} // namespace CooperativeMatrixLayout
214214

215215
namespace CooperativeMatrixOperands {
216216
#define GET_CooperativeMatrixOperands_DECL
217217
#include "SPIRVGenTables.inc"
218-
} // namespace Opcode
218+
} // namespace CooperativeMatrixOperands
219219

220220
struct ExtendedBuiltin {
221221
StringRef Name;

llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,13 @@ void SPIRVInstPrinter::printInst(const MCInst *MI, uint64_t Address,
220220
const unsigned MulAddOp = MI->getOperand(FirstVariableIndex).getImm();
221221
if (MulAddOp == 0) {
222222
printSymbolicOperand<
223-
OperandCategory::CooperativeMatrixOperandsOperand>(
224-
MI, FirstVariableIndex, OS);
223+
OperandCategory::CooperativeMatrixOperandsOperand>(
224+
MI, FirstVariableIndex, OS);
225225
} else {
226226
std::string Buffer;
227227
for (unsigned Mask = 0x1;
228-
Mask != SPIRV::CooperativeMatrixOperands::MatrixResultBFloat16ComponentsINTEL;
228+
Mask != SPIRV::CooperativeMatrixOperands::
229+
MatrixResultBFloat16ComponentsINTEL;
229230
Mask <<= 1) {
230231
if (MulAddOp & Mask) {
231232
if (!Buffer.empty())

llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,42 +1974,41 @@ static bool generateCoopMatrInst(const SPIRV::IncomingCall *Call,
19741974
Opcode != SPIRV::OpCooperativeMatrixPrefetchINTEL;
19751975
unsigned ArgSz = Call->Arguments.size();
19761976
unsigned LiteralIdx = 0;
1977-
switch(Opcode) {
1978-
// Memory operand is optional and is literal.
1979-
case SPIRV::OpCooperativeMatrixLoadKHR:
1980-
LiteralIdx = ArgSz > 3 ? 3 : 0;
1981-
break;
1982-
case SPIRV::OpCooperativeMatrixStoreKHR:
1983-
LiteralIdx = ArgSz > 4 ? 4 : 0;
1984-
break;
1985-
case SPIRV::OpCooperativeMatrixLoadCheckedINTEL:
1986-
LiteralIdx = ArgSz > 7 ? 7 : 0;
1987-
break;
1988-
case SPIRV::OpCooperativeMatrixStoreCheckedINTEL:
1989-
LiteralIdx = ArgSz > 8 ? 8 : 0;
1990-
break;
1991-
// Cooperative Matrix Operands operand is optional and is literal.
1992-
case SPIRV::OpCooperativeMatrixMulAddKHR:
1993-
LiteralIdx = ArgSz > 3 ? 3 : 0;
1994-
break;
1977+
switch (Opcode) {
1978+
// Memory operand is optional and is literal.
1979+
case SPIRV::OpCooperativeMatrixLoadKHR:
1980+
LiteralIdx = ArgSz > 3 ? 3 : 0;
1981+
break;
1982+
case SPIRV::OpCooperativeMatrixStoreKHR:
1983+
LiteralIdx = ArgSz > 4 ? 4 : 0;
1984+
break;
1985+
case SPIRV::OpCooperativeMatrixLoadCheckedINTEL:
1986+
LiteralIdx = ArgSz > 7 ? 7 : 0;
1987+
break;
1988+
case SPIRV::OpCooperativeMatrixStoreCheckedINTEL:
1989+
LiteralIdx = ArgSz > 8 ? 8 : 0;
1990+
break;
1991+
// Cooperative Matrix Operands operand is optional and is literal.
1992+
case SPIRV::OpCooperativeMatrixMulAddKHR:
1993+
LiteralIdx = ArgSz > 3 ? 3 : 0;
1994+
break;
19951995
};
19961996

19971997
SmallVector<uint32_t, 1> ImmArgs;
19981998
MachineRegisterInfo *MRI = MIRBuilder.getMRI();
19991999
if (Opcode == SPIRV::OpCooperativeMatrixPrefetchINTEL) {
2000-
const uint32_t CacheLevel =
2001-
getConstFromIntrinsic(Call->Arguments[3], MRI);
2000+
const uint32_t CacheLevel = getConstFromIntrinsic(Call->Arguments[3], MRI);
20022001
auto MIB = MIRBuilder.buildInstr(SPIRV::OpCooperativeMatrixPrefetchINTEL)
2003-
.addUse(Call->Arguments[0]) // pointer
2004-
.addUse(Call->Arguments[1]) // rows
2005-
.addUse(Call->Arguments[2]) // columns
2006-
.addImm(CacheLevel) // cache level
2007-
.addUse(Call->Arguments[4]); // memory layout
2002+
.addUse(Call->Arguments[0]) // pointer
2003+
.addUse(Call->Arguments[1]) // rows
2004+
.addUse(Call->Arguments[2]) // columns
2005+
.addImm(CacheLevel) // cache level
2006+
.addUse(Call->Arguments[4]); // memory layout
20082007
if (ArgSz > 5)
20092008
MIB.addUse(Call->Arguments[5]); // stride
20102009
if (ArgSz > 6) {
20112010
const uint32_t MemOp = getConstFromIntrinsic(Call->Arguments[6], MRI);
2012-
MIB.addImm(MemOp); // memory operand
2011+
MIB.addImm(MemOp); // memory operand
20132012
}
20142013
return true;
20152014
}

llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,8 @@ void addInstrRequirements(const MachineInstr &MI,
14411441
if (!ST.canUseExtension(SPIRV::Extension::SPV_KHR_cooperative_matrix))
14421442
report_fatal_error("Cooperative matrix instructions require the "
14431443
"following SPIR-V extension: "
1444-
"SPV_KHR_cooperative_matrix", false);
1444+
"SPV_KHR_cooperative_matrix",
1445+
false);
14451446
Reqs.addExtension(SPIRV::Extension::SPV_KHR_cooperative_matrix);
14461447
Reqs.addCapability(SPIRV::Capability::CooperativeMatrixKHR);
14471448
constexpr unsigned MulAddMaxSize = 6;
@@ -1455,11 +1456,11 @@ void addInstrRequirements(const MachineInstr &MI,
14551456
SPIRV::Capability::CooperativeMatrixTF32ComponentTypeINTEL);
14561457
}
14571458
if (CoopOperands & SPIRV::CooperativeMatrixOperands::
1458-
MatrixAAndBBFloat16ComponentsINTEL ||
1459-
CoopOperands & SPIRV::CooperativeMatrixOperands::
1460-
MatrixCBFloat16ComponentsINTEL ||
1459+
MatrixAAndBBFloat16ComponentsINTEL ||
1460+
CoopOperands &
1461+
SPIRV::CooperativeMatrixOperands::MatrixCBFloat16ComponentsINTEL ||
14611462
CoopOperands & SPIRV::CooperativeMatrixOperands::
1462-
MatrixResultBFloat16ComponentsINTEL) {
1463+
MatrixResultBFloat16ComponentsINTEL) {
14631464
Reqs.addExtension(SPIRV::Extension::SPV_INTEL_joint_matrix);
14641465
Reqs.addCapability(
14651466
SPIRV::Capability::CooperativeMatrixBFloat16ComponentTypeINTEL);
@@ -1474,19 +1475,19 @@ void addInstrRequirements(const MachineInstr &MI,
14741475
if (!ST.canUseExtension(SPIRV::Extension::SPV_KHR_cooperative_matrix))
14751476
report_fatal_error("Cooperative matrix instructions require the "
14761477
"following SPIR-V extension: "
1477-
"SPV_KHR_cooperative_matrix", false);
1478+
"SPV_KHR_cooperative_matrix",
1479+
false);
14781480
Reqs.addExtension(SPIRV::Extension::SPV_KHR_cooperative_matrix);
14791481
Reqs.addCapability(SPIRV::Capability::CooperativeMatrixKHR);
14801482

14811483
// Check Layout operand in case if it's not a standart one and add the
14821484
// appropriate capability.
14831485
std::unordered_map<unsigned, unsigned> LayoutToInstMap = {
1484-
{SPIRV::OpCooperativeMatrixLoadKHR, 3},
1485-
{SPIRV::OpCooperativeMatrixStoreKHR, 2},
1486-
{SPIRV::OpCooperativeMatrixLoadCheckedINTEL, 5},
1487-
{SPIRV::OpCooperativeMatrixStoreCheckedINTEL, 4},
1488-
{SPIRV::OpCooperativeMatrixPrefetchINTEL, 4}
1489-
};
1486+
{SPIRV::OpCooperativeMatrixLoadKHR, 3},
1487+
{SPIRV::OpCooperativeMatrixStoreKHR, 2},
1488+
{SPIRV::OpCooperativeMatrixLoadCheckedINTEL, 5},
1489+
{SPIRV::OpCooperativeMatrixStoreCheckedINTEL, 4},
1490+
{SPIRV::OpCooperativeMatrixPrefetchINTEL, 4}};
14901491

14911492
const auto OpCode = MI.getOpcode();
14921493
const unsigned LayoutNum = LayoutToInstMap[OpCode];
@@ -1495,11 +1496,12 @@ void addInstrRequirements(const MachineInstr &MI,
14951496
MachineInstr *MILayout = MRI.getUniqueVRegDef(RegLayout);
14961497
if (MILayout->getOpcode() == SPIRV::OpConstantI) {
14971498
const unsigned LayoutVal = MILayout->getOperand(2).getImm();
1498-
if (LayoutVal == static_cast<unsigned>(
1499-
SPIRV::CooperativeMatrixLayout::PackedINTEL)) {
1499+
if (LayoutVal ==
1500+
static_cast<unsigned>(SPIRV::CooperativeMatrixLayout::PackedINTEL)) {
15001501
if (!ST.canUseExtension(SPIRV::Extension::SPV_INTEL_joint_matrix))
15011502
report_fatal_error("PackedINTEL layout require the following SPIR-V "
1502-
"extension: SPV_INTEL_joint_matrix", false);
1503+
"extension: SPV_INTEL_joint_matrix",
1504+
false);
15031505
Reqs.addExtension(SPIRV::Extension::SPV_INTEL_joint_matrix);
15041506
Reqs.addCapability(SPIRV::Capability::PackedCooperativeMatrixINTEL);
15051507
}
@@ -1513,7 +1515,8 @@ void addInstrRequirements(const MachineInstr &MI,
15131515
if (!ST.canUseExtension(SPIRV::Extension::SPV_INTEL_joint_matrix))
15141516
report_fatal_error("OpCooperativeMatrix[Load/Store]CheckedINTEL "
15151517
"instructions require the following SPIR-V extension: "
1516-
"SPV_INTEL_joint_matrix", false);
1518+
"SPV_INTEL_joint_matrix",
1519+
false);
15171520
Reqs.addExtension(SPIRV::Extension::SPV_INTEL_joint_matrix);
15181521
if (OpCode == SPIRV::OpCooperativeMatrixPrefetchINTEL) {
15191522
Reqs.addCapability(SPIRV::Capability::CooperativeMatrixPrefetchINTEL);
@@ -1527,7 +1530,8 @@ void addInstrRequirements(const MachineInstr &MI,
15271530
if (!ST.canUseExtension(SPIRV::Extension::SPV_INTEL_joint_matrix))
15281531
report_fatal_error("OpCooperativeMatrixConstructCheckedINTEL"
15291532
" instructions require the following SPIR-V extension:"
1530-
" SPV_INTEL_joint_matrix", false);
1533+
" SPV_INTEL_joint_matrix",
1534+
false);
15311535
Reqs.addExtension(SPIRV::Extension::SPV_INTEL_joint_matrix);
15321536
Reqs.addCapability(
15331537
SPIRV::Capability::CooperativeMatrixCheckedInstructionsINTEL);

0 commit comments

Comments
 (0)