Skip to content

Commit

Permalink
Add SPV_NV_cooperative_vector (#482)
Browse files Browse the repository at this point in the history
* Add SPV_NV_cooperative_vector

* Apply suggestions from code review

Co-authored-by: Victor Lomuller <victor@codeplay.com>

---------

Co-authored-by: Victor Lomuller <victor@codeplay.com>
  • Loading branch information
jeffbolznv and Naghasan authored Jan 29, 2025
1 parent 2b2e05e commit 767e901
Show file tree
Hide file tree
Showing 12 changed files with 720 additions and 0 deletions.
38 changes: 38 additions & 0 deletions include/spirv/unified1/spirv.bf
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ namespace Spv
ShaderInvocationReorderNV = 5383,
BindlessTextureNV = 5390,
RayQueryPositionFetchKHR = 5391,
CooperativeVectorNV = 5394,
AtomicFloat16VectorNV = 5404,
RayTracingDisplacementMicromapNV = 5409,
RawAccessChainsNV = 5414,
Expand All @@ -1210,6 +1211,7 @@ namespace Spv
CooperativeMatrixPerElementOperationsNV = 5432,
CooperativeMatrixTensorAddressingNV = 5433,
CooperativeMatrixBlockLoadsNV = 5434,
CooperativeVectorTrainingNV = 5435,
TensorAddressingNV = 5439,
SubgroupShuffleINTEL = 5568,
SubgroupBufferBlockIOINTEL = 5569,
Expand Down Expand Up @@ -1586,6 +1588,35 @@ namespace Spv
Max = 0x7fffffff,
}

[AllowDuplicates, CRepr] public enum CooperativeVectorMatrixLayout
{
RowMajorNV = 0,
ColumnMajorNV = 1,
InferencingOptimalNV = 2,
TrainingOptimalNV = 3,
Max = 0x7fffffff,
}

[AllowDuplicates, CRepr] public enum ComponentType
{
Float16NV = 0,
Float32NV = 1,
Float64NV = 2,
SignedInt8NV = 3,
SignedInt16NV = 4,
SignedInt32NV = 5,
SignedInt64NV = 6,
UnsignedInt8NV = 7,
UnsignedInt16NV = 8,
UnsignedInt32NV = 9,
UnsignedInt64NV = 10,
SignedInt8PackedNV = 1000491000,
UnsignedInt8PackedNV = 1000491001,
FloatE4M3NV = 1000491002,
FloatE5M2NV = 1000491003,
Max = 0x7fffffff,
}

[AllowDuplicates, CRepr] public enum Op
{
OpNop = 0,
Expand Down Expand Up @@ -2047,13 +2078,20 @@ namespace Spv
OpReorderThreadWithHintNV = 5280,
OpTypeHitObjectNV = 5281,
OpImageSampleFootprintNV = 5283,
OpTypeCooperativeVectorNV = 5288,
OpCooperativeVectorMatrixMulNV = 5289,
OpCooperativeVectorOuterProductAccumulateNV = 5290,
OpCooperativeVectorReduceSumAccumulateNV = 5291,
OpCooperativeVectorMatrixMulAddNV = 5292,
OpCooperativeMatrixConvertNV = 5293,
OpEmitMeshTasksEXT = 5294,
OpSetMeshOutputsEXT = 5295,
OpGroupNonUniformPartitionNV = 5296,
OpWritePackedPrimitiveIndices4x8NV = 5299,
OpFetchMicroTriangleVertexPositionNV = 5300,
OpFetchMicroTriangleVertexBarycentricNV = 5301,
OpCooperativeVectorLoadNV = 5302,
OpCooperativeVectorStoreNV = 5303,
OpReportIntersectionKHR = 5334,
OpReportIntersectionNV = 5334,
OpIgnoreIntersectionNV = 5335,
Expand Down
233 changes: 233 additions & 0 deletions include/spirv/unified1/spirv.core.grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -5967,6 +5967,93 @@
"extensions" : [ "SPV_NV_shader_image_footprint" ],
"version" : "None"
},
{
"opname" : "OpTypeCooperativeVectorNV",
"class" : "Type-Declaration",
"opcode" : 5288,
"operands" : [
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Component Type'" },
{ "kind" : "IdRef", "name" : "'Component Count'" }
],
"capabilities" : [ "CooperativeVectorNV" ],
"version" : "None"
},
{
"opname" : "OpCooperativeVectorMatrixMulNV",
"class" : "Reserved",
"opcode" : 5289,
"operands" : [
{ "kind" : "IdResultType" },
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Input'" },
{ "kind" : "IdRef", "name" : "'InputInterpretation'" },
{ "kind" : "IdRef", "name" : "'Matrix'" },
{ "kind" : "IdRef", "name" : "'MatrixOffset'" },
{ "kind" : "IdRef", "name" : "'MatrixInterpretation'" },
{ "kind" : "IdRef", "name" : "'M'" },
{ "kind" : "IdRef", "name" : "'K'" },
{ "kind" : "IdRef", "name" : "'MemoryLayout'" },
{ "kind" : "IdRef", "name" : "'Transpose'" },
{ "kind" : "IdRef", "name" : "'MatrixStride'", "quantifier": "?" },
{ "kind" : "CooperativeMatrixOperands", "quantifier" : "?" }
],
"capabilities" : [ "CooperativeVectorNV" ],
"version" : "None"
},
{
"opname" : "OpCooperativeVectorOuterProductAccumulateNV",
"class" : "Reserved",
"opcode" : 5290,
"operands" : [
{ "kind" : "IdRef", "name" : "'Pointer'" },
{ "kind" : "IdRef", "name" : "'Offset'" },
{ "kind" : "IdRef", "name" : "'A'" },
{ "kind" : "IdRef", "name" : "'B'" },
{ "kind" : "IdRef", "name" : "'MemoryLayout'" },
{ "kind" : "IdRef", "name" : "'MatrixInterpretation'" },
{ "kind" : "IdRef", "name" : "'MatrixStride'", "quantifier": "?" }
],
"capabilities" : [ "CooperativeVectorTrainingNV" ],
"version" : "None"
},
{
"opname" : "OpCooperativeVectorReduceSumAccumulateNV",
"class" : "Reserved",
"opcode" : 5291,
"operands" : [
{ "kind" : "IdRef", "name" : "'Pointer'" },
{ "kind" : "IdRef", "name" : "'Offset'" },
{ "kind" : "IdRef", "name" : "'V'" }
],
"capabilities" : [ "CooperativeVectorTrainingNV" ],
"version" : "None"
},
{
"opname" : "OpCooperativeVectorMatrixMulAddNV",
"class" : "Reserved",
"opcode" : 5292,
"operands" : [
{ "kind" : "IdResultType" },
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Input'" },
{ "kind" : "IdRef", "name" : "'InputInterpretation'" },
{ "kind" : "IdRef", "name" : "'Matrix'" },
{ "kind" : "IdRef", "name" : "'MatrixOffset'" },
{ "kind" : "IdRef", "name" : "'MatrixInterpretation'" },
{ "kind" : "IdRef", "name" : "'Bias'" },
{ "kind" : "IdRef", "name" : "'BiasOffset'" },
{ "kind" : "IdRef", "name" : "'BiasInterpretation'" },
{ "kind" : "IdRef", "name" : "'M'" },
{ "kind" : "IdRef", "name" : "'K'" },
{ "kind" : "IdRef", "name" : "'MemoryLayout'" },
{ "kind" : "IdRef", "name" : "'Transpose'" },
{ "kind" : "IdRef", "name" : "'MatrixStride'", "quantifier": "?" },
{ "kind" : "CooperativeMatrixOperands", "quantifier" : "?" }
],
"capabilities" : [ "CooperativeVectorNV" ],
"version" : "None"
},
{
"opname" : "OpCooperativeMatrixConvertNV",
"class" : "Conversion",
Expand Down Expand Up @@ -6060,6 +6147,33 @@
"capabilities" : [ "DisplacementMicromapNV" ],
"version" : "None"
},
{
"opname" : "OpCooperativeVectorLoadNV",
"class" : "Memory",
"opcode" : 5302,
"operands" : [
{ "kind" : "IdResultType" },
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Pointer'" },
{ "kind" : "IdRef", "name" : "'Offset'" },
{ "kind" : "MemoryAccess", "quantifier" : "?" }
],
"capabilities" : [ "CooperativeVectorNV" ],
"version" : "None"
},
{
"opname" : "OpCooperativeVectorStoreNV",
"class" : "Memory",
"opcode" : 5303,
"operands" : [
{ "kind" : "IdRef", "name" : "'Pointer'" },
{ "kind" : "IdRef", "name" : "'Offset'" },
{ "kind" : "IdRef", "name" : "'Object'" },
{ "kind" : "MemoryAccess", "quantifier" : "?" }
],
"capabilities" : [ "CooperativeVectorNV" ],
"version" : "None"
},
{
"opname" : "OpReportIntersectionKHR",
"class" : "Reserved",
Expand Down Expand Up @@ -16221,6 +16335,12 @@
"extensions" : [ "SPV_KHR_ray_tracing_position_fetch" ],
"version" : "None"
},
{
"enumerant" : "CooperativeVectorNV",
"value" : 5394,
"extensions" : [ "SPV_NV_cooperative_vector" ],
"version" : "None"
},
{
"enumerant" : "AtomicFloat16VectorNV",
"value" : 5404,
Expand Down Expand Up @@ -16270,6 +16390,12 @@
"extensions" : [ "SPV_NV_cooperative_matrix2" ],
"version" : "None"
},
{
"enumerant" : "CooperativeVectorTrainingNV",
"value" : 5435,
"extensions" : [ "SPV_NV_cooperative_vector" ],
"version" : "None"
},
{
"enumerant" : "TensorAddressingNV",
"value" : 5439,
Expand Down Expand Up @@ -17174,6 +17300,113 @@
"enumerants" : [
]
},
{
"category" : "ValueEnum",
"kind" : "CooperativeVectorMatrixLayout",
"enumerants" : [
{
"enumerant" : "RowMajorNV",
"value" : 0,
"version" : "None"
},
{
"enumerant" : "ColumnMajorNV",
"value" : 1,
"version" : "None"
},
{
"enumerant" : "InferencingOptimalNV",
"value" : 2,
"version" : "None"
},
{
"enumerant" : "TrainingOptimalNV",
"value" : 3,
"version" : "None"
}
]
},
{
"category" : "ValueEnum",
"kind" : "ComponentType",
"enumerants" : [
{
"enumerant" : "Float16NV",
"value" : 0,
"version" : "None"
},
{
"enumerant" : "Float32NV",
"value" : 1,
"version" : "None"
},
{
"enumerant" : "Float64NV",
"value" : 2,
"version" : "None"
},
{
"enumerant" : "SignedInt8NV",
"value" : 3,
"version" : "None"
},
{
"enumerant" : "SignedInt16NV",
"value" : 4,
"version" : "None"
},
{
"enumerant" : "SignedInt32NV",
"value" : 5,
"version" : "None"
},
{
"enumerant" : "SignedInt64NV",
"value" : 6,
"version" : "None"
},
{
"enumerant" : "UnsignedInt8NV",
"value" : 7,
"version" : "None"
},
{
"enumerant" : "UnsignedInt16NV",
"value" : 8,
"version" : "None"
},
{
"enumerant" : "UnsignedInt32NV",
"value" : 9,
"version" : "None"
},
{
"enumerant" : "UnsignedInt64NV",
"value" : 10,
"version" : "None"
},
{
"enumerant" : "SignedInt8PackedNV",
"value" : 1000491000,
"version" : "None"
},
{
"enumerant" : "UnsignedInt8PackedNV",
"value" : 1000491001,
"version" : "None"
},
{
"enumerant" : "FloatE4M3NV",
"value" : 1000491002,
"version" : "None"
},
{
"enumerant" : "FloatE5M2NV",
"value" : 1000491003,
"version" : "None"
}
]
},
{
"category" : "Id",
"kind" : "IdResultType",
Expand Down
Loading

0 comments on commit 767e901

Please sign in to comment.