Skip to content

Commit 3469b16

Browse files
authored
Merge pull request KhronosGroup#355 from kpet/spv-khr-cooperative-matrix
Add definitions for SPV_KHR_cooperative_matrix
2 parents 10db9d4 + 6b5af05 commit 3469b16

File tree

12 files changed

+532
-0
lines changed

12 files changed

+532
-0
lines changed

include/spirv/unified1/spirv.bf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,7 @@ namespace Spv
11601160
DotProduct = 6019,
11611161
DotProductKHR = 6019,
11621162
RayCullMaskKHR = 6020,
1163+
CooperativeMatrixKHR = 6022,
11631164
BitInstructions = 6025,
11641165
GroupNonUniformRotateKHR = 6026,
11651166
AtomicFloat32AddEXT = 6033,
@@ -1281,6 +1282,38 @@ namespace Spv
12811282
PackedVectorFormat4x8BitKHR = 0,
12821283
}
12831284

1285+
[AllowDuplicates, CRepr] public enum CooperativeMatrixOperandsShift
1286+
{
1287+
MatrixASignedComponents = 0,
1288+
MatrixBSignedComponents = 1,
1289+
MatrixCSignedComponents = 2,
1290+
MatrixResultSignedComponents = 3,
1291+
SaturatingAccumulation = 4,
1292+
}
1293+
1294+
[AllowDuplicates, CRepr] public enum CooperativeMatrixOperandsMask
1295+
{
1296+
MaskNone = 0,
1297+
MatrixASignedComponents = 0x00000001,
1298+
MatrixBSignedComponents = 0x00000002,
1299+
MatrixCSignedComponents = 0x00000004,
1300+
MatrixResultSignedComponents = 0x00000008,
1301+
SaturatingAccumulation = 0x00000010,
1302+
}
1303+
1304+
[AllowDuplicates, CRepr] public enum CooperativeMatrixLayout
1305+
{
1306+
RowMajorKHR = 0,
1307+
ColumnMajorKHR = 1,
1308+
}
1309+
1310+
[AllowDuplicates, CRepr] public enum CooperativeMatrixUse
1311+
{
1312+
MatrixAKHR = 0,
1313+
MatrixBKHR = 1,
1314+
MatrixAccumulatorKHR = 2,
1315+
}
1316+
12841317
[AllowDuplicates, CRepr] public enum Op
12851318
{
12861319
OpNop = 0,
@@ -1655,6 +1688,11 @@ namespace Spv
16551688
OpUDotAccSatKHR = 4454,
16561689
OpSUDotAccSat = 4455,
16571690
OpSUDotAccSatKHR = 4455,
1691+
OpTypeCooperativeMatrixKHR = 4456,
1692+
OpCooperativeMatrixLoadKHR = 4457,
1693+
OpCooperativeMatrixStoreKHR = 4458,
1694+
OpCooperativeMatrixMulAddKHR = 4459,
1695+
OpCooperativeMatrixLengthKHR = 4460,
16581696
OpTypeRayQueryKHR = 4472,
16591697
OpRayQueryInitializeKHR = 4473,
16601698
OpRayQueryTerminateKHR = 4474,

include/spirv/unified1/spirv.core.grammar.json

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4493,6 +4493,77 @@
44934493
"extensions" : [ "SPV_KHR_integer_dot_product" ],
44944494
"version" : "1.6"
44954495
},
4496+
{
4497+
"opname" : "OpTypeCooperativeMatrixKHR",
4498+
"class" : "Type-Declaration",
4499+
"opcode" : 4456,
4500+
"operands" : [
4501+
{ "kind" : "IdResult" },
4502+
{ "kind" : "IdRef", "name" : "'Component Type'" },
4503+
{ "kind" : "IdScope", "name" : "'Scope'" },
4504+
{ "kind" : "IdRef", "name" : "'Rows'" },
4505+
{ "kind" : "IdRef", "name" : "'Columns'" },
4506+
{ "kind" : "IdRef", "name" : "'Use'" }
4507+
],
4508+
"capabilities" : [ "CooperativeMatrixKHR" ],
4509+
"version" : "None"
4510+
},
4511+
{
4512+
"opname" : "OpCooperativeMatrixLoadKHR",
4513+
"class" : "Memory",
4514+
"opcode" : 4457,
4515+
"operands" : [
4516+
{ "kind" : "IdResultType" },
4517+
{ "kind" : "IdResult" },
4518+
{ "kind" : "IdRef", "name" : "'Pointer'" },
4519+
{ "kind" : "IdRef", "name" : "'MemoryLayout'" },
4520+
{ "kind" : "IdRef", "name" : "'Stride'", "quantifier": "?" },
4521+
{ "kind" : "MemoryAccess", "name" : "'Memory Operand'", "quantifier" : "?" }
4522+
],
4523+
"capabilities" : [ "CooperativeMatrixKHR" ],
4524+
"version" : "None"
4525+
},
4526+
{
4527+
"opname" : "OpCooperativeMatrixStoreKHR",
4528+
"class" : "Memory",
4529+
"opcode" : 4458,
4530+
"operands" : [
4531+
{ "kind" : "IdRef", "name" : "'Pointer'" },
4532+
{ "kind" : "IdRef", "name" : "'Object'" },
4533+
{ "kind" : "IdRef", "name" : "'MemoryLayout'" },
4534+
{ "kind" : "IdRef", "name" : "'Stride'", "quantifier": "?" },
4535+
{ "kind" : "MemoryAccess", "name" : "'Memory Operand'", "quantifier" : "?" }
4536+
],
4537+
"capabilities" : [ "CooperativeMatrixKHR" ],
4538+
"version" : "None"
4539+
},
4540+
{
4541+
"opname" : "OpCooperativeMatrixMulAddKHR",
4542+
"class" : "Arithmetic",
4543+
"opcode" : 4459,
4544+
"operands" : [
4545+
{ "kind" : "IdResultType" },
4546+
{ "kind" : "IdResult" },
4547+
{ "kind" : "IdRef", "name" : "'A'" },
4548+
{ "kind" : "IdRef", "name" : "'B'" },
4549+
{ "kind" : "IdRef", "name" : "'C'" },
4550+
{ "kind" : "CooperativeMatrixOperands", "name" : "'Cooperative Matrix Operands'", "quantifier" : "?" }
4551+
],
4552+
"capabilities" : [ "CooperativeMatrixKHR" ],
4553+
"version" : "None"
4554+
},
4555+
{
4556+
"opname" : "OpCooperativeMatrixLengthKHR",
4557+
"class" : "Miscellaneous",
4558+
"opcode" : 4460,
4559+
"operands" : [
4560+
{ "kind" : "IdResultType" },
4561+
{ "kind" : "IdResult" },
4562+
{ "kind" : "IdRef", "name" : "'Type'" }
4563+
],
4564+
"capabilities" : [ "CooperativeMatrixKHR" ],
4565+
"version" : "None"
4566+
},
44964567
{
44974568
"opname" : "OpTypeRayQueryKHR",
44984569
"class" : "Reserved",
@@ -15118,6 +15189,12 @@
1511815189
"extensions" : [ "SPV_KHR_ray_cull_mask" ],
1511915190
"version" : "None"
1512015191
},
15192+
{
15193+
"enumerant" : "CooperativeMatrixKHR",
15194+
"value" : 6022,
15195+
"extensions" : [ "SPV_KHR_cooperative_matrix" ],
15196+
"version" : "None"
15197+
},
1512115198
{
1512215199
"enumerant" : "BitInstructions",
1512315200
"value" : 6025,
@@ -15283,6 +15360,90 @@
1528315360
}
1528415361
]
1528515362
},
15363+
{
15364+
"category" : "BitEnum",
15365+
"kind" : "CooperativeMatrixOperands",
15366+
"enumerants" : [
15367+
{
15368+
"enumerant" : "None",
15369+
"value" : "0x0000",
15370+
"capabilities" : [ "CooperativeMatrixKHR" ],
15371+
"version" : "None"
15372+
},
15373+
{
15374+
"enumerant" : "MatrixASignedComponents",
15375+
"value" : "0x0001",
15376+
"capabilities" : [ "CooperativeMatrixKHR" ],
15377+
"version" : "None"
15378+
},
15379+
{
15380+
"enumerant" : "MatrixBSignedComponents",
15381+
"value" : "0x0002",
15382+
"capabilities" : [ "CooperativeMatrixKHR" ],
15383+
"version" : "None"
15384+
},
15385+
{
15386+
"enumerant" : "MatrixCSignedComponents",
15387+
"value" : "0x0004",
15388+
"capabilities" : [ "CooperativeMatrixKHR" ],
15389+
"version" : "None"
15390+
},
15391+
{
15392+
"enumerant" : "MatrixResultSignedComponents",
15393+
"value" : "0x0008",
15394+
"capabilities" : [ "CooperativeMatrixKHR" ],
15395+
"version" : "None"
15396+
},
15397+
{
15398+
"enumerant" : "SaturatingAccumulation",
15399+
"value" : "0x0010",
15400+
"capabilities" : [ "CooperativeMatrixKHR" ],
15401+
"version" : "None"
15402+
}
15403+
]
15404+
},
15405+
{
15406+
"category" : "ValueEnum",
15407+
"kind" : "CooperativeMatrixLayout",
15408+
"enumerants" : [
15409+
{
15410+
"enumerant" : "RowMajorKHR",
15411+
"value" : 0,
15412+
"capabilities" : [ "CooperativeMatrixKHR" ],
15413+
"version" : "None"
15414+
},
15415+
{
15416+
"enumerant" : "ColumnMajorKHR",
15417+
"value" : 1,
15418+
"capabilities" : [ "CooperativeMatrixKHR" ],
15419+
"version" : "None"
15420+
}
15421+
]
15422+
},
15423+
{
15424+
"category" : "ValueEnum",
15425+
"kind" : "CooperativeMatrixUse",
15426+
"enumerants" : [
15427+
{
15428+
"enumerant" : "MatrixAKHR",
15429+
"value" : 0,
15430+
"capabilities" : [ "CooperativeMatrixKHR" ],
15431+
"version" : "None"
15432+
},
15433+
{
15434+
"enumerant" : "MatrixBKHR",
15435+
"value" : 1,
15436+
"capabilities" : [ "CooperativeMatrixKHR" ],
15437+
"version" : "None"
15438+
},
15439+
{
15440+
"enumerant" : "MatrixAccumulatorKHR",
15441+
"value" : 2,
15442+
"capabilities" : [ "CooperativeMatrixKHR" ],
15443+
"version" : "None"
15444+
}
15445+
]
15446+
},
1528615447
{
1528715448
"category" : "Id",
1528815449
"kind" : "IdResultType",

include/spirv/unified1/spirv.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ public enum Capability
11591159
DotProduct = 6019,
11601160
DotProductKHR = 6019,
11611161
RayCullMaskKHR = 6020,
1162+
CooperativeMatrixKHR = 6022,
11621163
BitInstructions = 6025,
11631164
GroupNonUniformRotateKHR = 6026,
11641165
AtomicFloat32AddEXT = 6033,
@@ -1280,6 +1281,38 @@ public enum PackedVectorFormat
12801281
PackedVectorFormat4x8BitKHR = 0,
12811282
}
12821283

1284+
public enum CooperativeMatrixOperandsShift
1285+
{
1286+
MatrixASignedComponents = 0,
1287+
MatrixBSignedComponents = 1,
1288+
MatrixCSignedComponents = 2,
1289+
MatrixResultSignedComponents = 3,
1290+
SaturatingAccumulation = 4,
1291+
}
1292+
1293+
public enum CooperativeMatrixOperandsMask
1294+
{
1295+
MaskNone = 0,
1296+
MatrixASignedComponents = 0x00000001,
1297+
MatrixBSignedComponents = 0x00000002,
1298+
MatrixCSignedComponents = 0x00000004,
1299+
MatrixResultSignedComponents = 0x00000008,
1300+
SaturatingAccumulation = 0x00000010,
1301+
}
1302+
1303+
public enum CooperativeMatrixLayout
1304+
{
1305+
RowMajorKHR = 0,
1306+
ColumnMajorKHR = 1,
1307+
}
1308+
1309+
public enum CooperativeMatrixUse
1310+
{
1311+
MatrixAKHR = 0,
1312+
MatrixBKHR = 1,
1313+
MatrixAccumulatorKHR = 2,
1314+
}
1315+
12831316
public enum Op
12841317
{
12851318
OpNop = 0,
@@ -1654,6 +1687,11 @@ public enum Op
16541687
OpUDotAccSatKHR = 4454,
16551688
OpSUDotAccSat = 4455,
16561689
OpSUDotAccSatKHR = 4455,
1690+
OpTypeCooperativeMatrixKHR = 4456,
1691+
OpCooperativeMatrixLoadKHR = 4457,
1692+
OpCooperativeMatrixStoreKHR = 4458,
1693+
OpCooperativeMatrixMulAddKHR = 4459,
1694+
OpCooperativeMatrixLengthKHR = 4460,
16571695
OpTypeRayQueryKHR = 4472,
16581696
OpRayQueryInitializeKHR = 4473,
16591697
OpRayQueryTerminateKHR = 4474,

include/spirv/unified1/spirv.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ typedef enum SpvCapability_ {
11591159
SpvCapabilityDotProduct = 6019,
11601160
SpvCapabilityDotProductKHR = 6019,
11611161
SpvCapabilityRayCullMaskKHR = 6020,
1162+
SpvCapabilityCooperativeMatrixKHR = 6022,
11621163
SpvCapabilityBitInstructions = 6025,
11631164
SpvCapabilityGroupNonUniformRotateKHR = 6026,
11641165
SpvCapabilityAtomicFloat32AddEXT = 6033,
@@ -1279,6 +1280,37 @@ typedef enum SpvPackedVectorFormat_ {
12791280
SpvPackedVectorFormatMax = 0x7fffffff,
12801281
} SpvPackedVectorFormat;
12811282

1283+
typedef enum SpvCooperativeMatrixOperandsShift_ {
1284+
SpvCooperativeMatrixOperandsMatrixASignedComponentsShift = 0,
1285+
SpvCooperativeMatrixOperandsMatrixBSignedComponentsShift = 1,
1286+
SpvCooperativeMatrixOperandsMatrixCSignedComponentsShift = 2,
1287+
SpvCooperativeMatrixOperandsMatrixResultSignedComponentsShift = 3,
1288+
SpvCooperativeMatrixOperandsSaturatingAccumulationShift = 4,
1289+
SpvCooperativeMatrixOperandsMax = 0x7fffffff,
1290+
} SpvCooperativeMatrixOperandsShift;
1291+
1292+
typedef enum SpvCooperativeMatrixOperandsMask_ {
1293+
SpvCooperativeMatrixOperandsMaskNone = 0,
1294+
SpvCooperativeMatrixOperandsMatrixASignedComponentsMask = 0x00000001,
1295+
SpvCooperativeMatrixOperandsMatrixBSignedComponentsMask = 0x00000002,
1296+
SpvCooperativeMatrixOperandsMatrixCSignedComponentsMask = 0x00000004,
1297+
SpvCooperativeMatrixOperandsMatrixResultSignedComponentsMask = 0x00000008,
1298+
SpvCooperativeMatrixOperandsSaturatingAccumulationMask = 0x00000010,
1299+
} SpvCooperativeMatrixOperandsMask;
1300+
1301+
typedef enum SpvCooperativeMatrixLayout_ {
1302+
SpvCooperativeMatrixLayoutRowMajorKHR = 0,
1303+
SpvCooperativeMatrixLayoutColumnMajorKHR = 1,
1304+
SpvCooperativeMatrixLayoutMax = 0x7fffffff,
1305+
} SpvCooperativeMatrixLayout;
1306+
1307+
typedef enum SpvCooperativeMatrixUse_ {
1308+
SpvCooperativeMatrixUseMatrixAKHR = 0,
1309+
SpvCooperativeMatrixUseMatrixBKHR = 1,
1310+
SpvCooperativeMatrixUseMatrixAccumulatorKHR = 2,
1311+
SpvCooperativeMatrixUseMax = 0x7fffffff,
1312+
} SpvCooperativeMatrixUse;
1313+
12821314
typedef enum SpvOp_ {
12831315
SpvOpNop = 0,
12841316
SpvOpUndef = 1,
@@ -1652,6 +1684,11 @@ typedef enum SpvOp_ {
16521684
SpvOpUDotAccSatKHR = 4454,
16531685
SpvOpSUDotAccSat = 4455,
16541686
SpvOpSUDotAccSatKHR = 4455,
1687+
SpvOpTypeCooperativeMatrixKHR = 4456,
1688+
SpvOpCooperativeMatrixLoadKHR = 4457,
1689+
SpvOpCooperativeMatrixStoreKHR = 4458,
1690+
SpvOpCooperativeMatrixMulAddKHR = 4459,
1691+
SpvOpCooperativeMatrixLengthKHR = 4460,
16551692
SpvOpTypeRayQueryKHR = 4472,
16561693
SpvOpRayQueryInitializeKHR = 4473,
16571694
SpvOpRayQueryTerminateKHR = 4474,
@@ -2370,6 +2407,11 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy
23702407
case SpvOpSDotAccSat: *hasResult = true; *hasResultType = true; break;
23712408
case SpvOpUDotAccSat: *hasResult = true; *hasResultType = true; break;
23722409
case SpvOpSUDotAccSat: *hasResult = true; *hasResultType = true; break;
2410+
case SpvOpTypeCooperativeMatrixKHR: *hasResult = true; *hasResultType = false; break;
2411+
case SpvOpCooperativeMatrixLoadKHR: *hasResult = true; *hasResultType = true; break;
2412+
case SpvOpCooperativeMatrixStoreKHR: *hasResult = false; *hasResultType = false; break;
2413+
case SpvOpCooperativeMatrixMulAddKHR: *hasResult = true; *hasResultType = true; break;
2414+
case SpvOpCooperativeMatrixLengthKHR: *hasResult = true; *hasResultType = true; break;
23732415
case SpvOpTypeRayQueryKHR: *hasResult = true; *hasResultType = false; break;
23742416
case SpvOpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break;
23752417
case SpvOpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break;

0 commit comments

Comments
 (0)