Skip to content

Commit

Permalink
Align spirv.hpp to SPIRV-Headers for SPV_KHR_cooperative_matrix
Browse files Browse the repository at this point in the history
Some of the enumerants used by this extension were missing a KHR suffix.
  • Loading branch information
kpet authored Oct 25, 2023
1 parent ffac211 commit a9e6983
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions SPIRV/GlslangToSpv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3715,13 +3715,13 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt

// Determine Cooperative Matrix Operands bits from the signedness of the types.
if (isTypeSignedInt(glslangOperands[0]->getAsTyped()->getBasicType()))
matrixOperands |= spv::CooperativeMatrixOperandsMatrixASignedComponentsMask;
matrixOperands |= spv::CooperativeMatrixOperandsMatrixASignedComponentsKHRMask;
if (isTypeSignedInt(glslangOperands[1]->getAsTyped()->getBasicType()))
matrixOperands |= spv::CooperativeMatrixOperandsMatrixBSignedComponentsMask;
matrixOperands |= spv::CooperativeMatrixOperandsMatrixBSignedComponentsKHRMask;
if (isTypeSignedInt(glslangOperands[2]->getAsTyped()->getBasicType()))
matrixOperands |= spv::CooperativeMatrixOperandsMatrixCSignedComponentsMask;
matrixOperands |= spv::CooperativeMatrixOperandsMatrixCSignedComponentsKHRMask;
if (isTypeSignedInt(node->getBasicType()))
matrixOperands |= spv::CooperativeMatrixOperandsMatrixResultSignedComponentsMask;
matrixOperands |= spv::CooperativeMatrixOperandsMatrixResultSignedComponentsKHRMask;

std::vector<spv::IdImmediate> idImmOps;
idImmOps.push_back(spv::IdImmediate(true, operands[0]));
Expand Down
10 changes: 5 additions & 5 deletions SPIRV/doc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,11 @@ const int CooperativeMatrixOperandsCeiling = 6;
const char* CooperativeMatrixOperandsString(int op)
{
switch (op) {
case CooperativeMatrixOperandsMatrixASignedComponentsShift: return "ASignedComponents";
case CooperativeMatrixOperandsMatrixBSignedComponentsShift: return "BSignedComponents";
case CooperativeMatrixOperandsMatrixCSignedComponentsShift: return "CSignedComponents";
case CooperativeMatrixOperandsMatrixResultSignedComponentsShift: return "ResultSignedComponents";
case CooperativeMatrixOperandsSaturatingAccumulationShift: return "SaturatingAccumulation";
case CooperativeMatrixOperandsMatrixASignedComponentsKHRShift: return "ASignedComponentsKHR";
case CooperativeMatrixOperandsMatrixBSignedComponentsKHRShift: return "BSignedComponentsKHR";
case CooperativeMatrixOperandsMatrixCSignedComponentsKHRShift: return "CSignedComponentsKHR";
case CooperativeMatrixOperandsMatrixResultSignedComponentsKHRShift: return "ResultSignedComponentsKHR";
case CooperativeMatrixOperandsSaturatingAccumulationKHRShift: return "SaturatingAccumulationKHR";

default: return "Bad";
}
Expand Down
24 changes: 12 additions & 12 deletions SPIRV/spirv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,26 +1274,26 @@ enum PackedVectorFormat {
};

enum CooperativeMatrixOperandsShift {
CooperativeMatrixOperandsMatrixASignedComponentsShift = 0,
CooperativeMatrixOperandsMatrixBSignedComponentsShift = 1,
CooperativeMatrixOperandsMatrixCSignedComponentsShift = 2,
CooperativeMatrixOperandsMatrixResultSignedComponentsShift = 3,
CooperativeMatrixOperandsSaturatingAccumulationShift = 4,
CooperativeMatrixOperandsMatrixASignedComponentsKHRShift = 0,
CooperativeMatrixOperandsMatrixBSignedComponentsKHRShift = 1,
CooperativeMatrixOperandsMatrixCSignedComponentsKHRShift = 2,
CooperativeMatrixOperandsMatrixResultSignedComponentsKHRShift = 3,
CooperativeMatrixOperandsSaturatingAccumulationKHRShift = 4,
CooperativeMatrixOperandsMax = 0x7fffffff,
};

enum CooperativeMatrixOperandsMask {
CooperativeMatrixOperandsMaskNone = 0,
CooperativeMatrixOperandsMatrixASignedComponentsMask = 0x00000001,
CooperativeMatrixOperandsMatrixBSignedComponentsMask = 0x00000002,
CooperativeMatrixOperandsMatrixCSignedComponentsMask = 0x00000004,
CooperativeMatrixOperandsMatrixResultSignedComponentsMask = 0x00000008,
CooperativeMatrixOperandsSaturatingAccumulationMask = 0x00000010,
CooperativeMatrixOperandsMatrixASignedComponentsKHRMask = 0x00000001,
CooperativeMatrixOperandsMatrixBSignedComponentsKHRMask = 0x00000002,
CooperativeMatrixOperandsMatrixCSignedComponentsKHRMask = 0x00000004,
CooperativeMatrixOperandsMatrixResultSignedComponentsKHRMask = 0x00000008,
CooperativeMatrixOperandsSaturatingAccumulationKHRMask = 0x00000010,
};

enum CooperativeMatrixLayout {
CooperativeMatrixLayoutCooperativeMatrixRowMajorKHR = 0,
CooperativeMatrixLayoutCooperativeMatrixColumnMajorKHR = 1,
CooperativeMatrixLayoutRowMajorKHR = 0,
CooperativeMatrixLayoutColumnMajorKHR = 1,
CooperativeMatrixLayoutMax = 0x7fffffff,
};

Expand Down
6 changes: 3 additions & 3 deletions Test/baseResults/spv.coopmatKHR.comp.out
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,15 @@ spv.coopmatKHR.comp
205: 202 Load 204(ms8A)
209: 206 Load 208(ms8B)
213: 210 Load 212(ms8C)
214: 210 CooperativeMatrixMulAddKHR 205 209 213 ASignedComponents BSignedComponents CSignedComponents ResultSignedComponents
214: 210 CooperativeMatrixMulAddKHR 205 209 213 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR
215: 202 Load 204(ms8A)
216: 206 Load 208(ms8B)
217: 210 Load 212(ms8C)
218: 210 CooperativeMatrixMulAddKHR 215 216 217 ASignedComponents BSignedComponents CSignedComponents ResultSignedComponents
218: 210 CooperativeMatrixMulAddKHR 215 216 217 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR
219: 202 Load 204(ms8A)
220: 206 Load 208(ms8B)
221: 210 Load 212(ms8C)
223: 210 CooperativeMatrixMulAddKHR 219 220 221 ASignedComponents BSignedComponents CSignedComponents ResultSignedComponents SaturatingAccumulation
223: 210 CooperativeMatrixMulAddKHR 219 220 221 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR SaturatingAccumulationKHR
228: 225 Load 227(m16)
229: 194(ptr) AccessChain 193(shmatrix) 82
CooperativeMatrixStoreKHR 229 228 62 10 MakePointerAvailableKHR NonPrivatePointerKHR 10
Expand Down

0 comments on commit a9e6983

Please sign in to comment.