Skip to content

Commit f3a7f2c

Browse files
wooyoungqcomjeremy-lunarg
authored andcommitted
Add support for GLSL_QCOM_cooperative_matrix_conversion
1 parent fcf4e92 commit f3a7f2c

19 files changed

+1746
-5
lines changed

SPIRV/GLSL.ext.QCOM.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ static const int GLSLextQCOMRevision = 1;
3939
const char* const E_SPV_QCOM_image_processing = "SPV_QCOM_image_processing";
4040
//SPV_QCOM_image_processing2
4141
const char* const E_SPV_QCOM_image_processing2 = "SPV_QCOM_image_processing2";
42+
//SPV_QCOM_cooperative_matrix_conversion
43+
const char* const E_SPV_QCOM_cooperative_matrix_conversion = "SPV_QCOM_cooperative_matrix_conversion";
4244

4345
//SPV_QCOM_tile_shading
4446
const char* const E_SPV_QCOM_tile_shading = "SPV_QCOM_tile_shading";

SPIRV/GlslangToSpv.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4262,6 +4262,24 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
42624262
// store the result to the pointer
42634263
builder.createStore(result, operands[0]);
42644264
result = 0;
4265+
} else if (node->getOp() == glslang::EOpBitCastArrayQCOM) {
4266+
builder.addCapability(spv::Capability::CooperativeMatrixConversionQCOM);
4267+
builder.addExtension(spv::E_SPV_QCOM_cooperative_matrix_conversion);
4268+
result = builder.createUnaryOp(spv::Op::OpBitCastArrayQCOM, resultType(), operands[0]);
4269+
} else if (node->getOp() == glslang::EOpCompositeConstructCoopMatQCOM) {
4270+
builder.addCapability(spv::Capability::CooperativeMatrixConversionQCOM);
4271+
builder.addExtension(spv::E_SPV_QCOM_cooperative_matrix_conversion);
4272+
result = builder.createUnaryOp(spv::Op::OpCompositeConstructCoopMatQCOM, resultType(), operands[0]);
4273+
} else if (node->getOp() == glslang::EOpCompositeExtractCoopMatQCOM) {
4274+
builder.addCapability(spv::Capability::CooperativeMatrixConversionQCOM);
4275+
builder.addExtension(spv::E_SPV_QCOM_cooperative_matrix_conversion);
4276+
result = builder.createUnaryOp(spv::Op::OpCompositeExtractCoopMatQCOM, resultType(), operands[0]);
4277+
} else if (node->getOp() == glslang::EOpExtractSubArrayQCOM) {
4278+
builder.addCapability(spv::Capability::CooperativeMatrixConversionQCOM);
4279+
builder.addExtension(spv::E_SPV_QCOM_cooperative_matrix_conversion);
4280+
4281+
std::vector<spv::Id> arguments { operands[0], operands[1] };;
4282+
result = builder.createOp(spv::Op::OpExtractSubArrayQCOM, resultType(), arguments);
42654283
} else if (node->getOp() == glslang::EOpCooperativeVectorMatMulNV ||
42664284
node->getOp() == glslang::EOpCooperativeVectorMatMulAddNV) {
42674285
auto matrixOperands = spv::CooperativeMatrixOperandsMask::MaskNone;

SPIRV/doc.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,8 @@ const char* CapabilityString(int info)
11141114
case (int)Capability::TileShadingQCOM: return "TileShadingQCOM";
11151115
case (int)Capability::TextureBlockMatch2QCOM: return "TextureBlockMatch2QCOM";
11161116

1117+
case (int)Capability::CooperativeMatrixConversionQCOM: return "CooperativeMatrixConversionQCOM";
1118+
11171119
case (int)Capability::ReplicatedCompositesEXT: return "CapabilityReplicatedCompositesEXT";
11181120

11191121
case (int)Capability::DotProductKHR: return "DotProductKHR";
@@ -1700,6 +1702,11 @@ const char* OpcodeString(int op)
17001702
case (int)Op::OpImageBlockMatchGatherSSDQCOM: return "OpImageBlockMatchGatherSSDQCOM";
17011703
case (int)Op::OpImageBlockMatchGatherSADQCOM: return "OpImageBlockMatchGatherSADQCOM";
17021704

1705+
case (int)Op::OpBitCastArrayQCOM: return "OpBitCastArrayQCOM";
1706+
case (int)Op::OpCompositeConstructCoopMatQCOM: return "OpCompositeConstructCoopMatQCOM";
1707+
case (int)Op::OpCompositeExtractCoopMatQCOM: return "OpCompositeExtractCoopMatQCOM";
1708+
case (int)Op::OpExtractSubArrayQCOM: return "OpExtractSubArrayQCOM";
1709+
17031710
case (int)Op::OpConstantCompositeReplicateEXT: return "OpConstantCompositeReplicateEXT";
17041711
case (int)Op::OpSpecConstantCompositeReplicateEXT: return "OpSpecConstantCompositeReplicateEXT";
17051712
case (int)Op::OpCompositeConstructReplicateEXT: return "OpCompositeConstructReplicateEXT";
@@ -3724,6 +3731,19 @@ void Parameterize()
37243731
InstructionDesc[enumCast(Op::OpImageBlockMatchGatherSADQCOM)].operands.push(OperandImageOperands, "", true);
37253732
InstructionDesc[enumCast(Op::OpImageBlockMatchGatherSADQCOM)].setResultAndType(true, true);
37263733

3734+
InstructionDesc[enumCast(Op::OpBitCastArrayQCOM)].operands.push(OperandId, "'source array'");
3735+
InstructionDesc[enumCast(Op::OpBitCastArrayQCOM)].setResultAndType(true, true);
3736+
3737+
InstructionDesc[enumCast(Op::OpCompositeConstructCoopMatQCOM)].operands.push(OperandId, "'source array'");
3738+
InstructionDesc[enumCast(Op::OpCompositeConstructCoopMatQCOM)].setResultAndType(true, true);
3739+
3740+
InstructionDesc[enumCast(Op::OpCompositeExtractCoopMatQCOM)].operands.push(OperandId, "'source cooperative matrix'");
3741+
InstructionDesc[enumCast(Op::OpCompositeExtractCoopMatQCOM)].setResultAndType(true, true);
3742+
3743+
InstructionDesc[enumCast(Op::OpExtractSubArrayQCOM)].operands.push(OperandId, "'source array'");
3744+
InstructionDesc[enumCast(Op::OpExtractSubArrayQCOM)].operands.push(OperandId, "'start index'");
3745+
InstructionDesc[enumCast(Op::OpExtractSubArrayQCOM)].setResultAndType(true, true);
3746+
37273747
InstructionDesc[enumCast(Op::OpConstantCompositeReplicateEXT)].operands.push(OperandId, "'Value'");
37283748
InstructionDesc[enumCast(Op::OpSpecConstantCompositeReplicateEXT)].operands.push(OperandId, "'Value'");
37293749
InstructionDesc[enumCast(Op::OpCompositeConstructReplicateEXT)].operands.push(OperandId, "'Value'");

SPIRV/spirv.hpp11

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,7 @@ enum class Capability : unsigned {
11101110
TextureBoxFilterQCOM = 4485,
11111111
TextureBlockMatchQCOM = 4486,
11121112
TileShadingQCOM = 4495,
1113+
CooperativeMatrixConversionQCOM = 4496,
11131114
TextureBlockMatch2QCOM = 4498,
11141115
Float16ImageAMD = 5008,
11151116
ImageGatherBiasLodAMD = 5009,
@@ -1996,10 +1997,14 @@ enum class Op : unsigned {
19961997
OpImageBoxFilterQCOM = 4481,
19971998
OpImageBlockMatchSSDQCOM = 4482,
19981999
OpImageBlockMatchSADQCOM = 4483,
2000+
OpBitCastArrayQCOM = 4497,
19992001
OpImageBlockMatchWindowSSDQCOM = 4500,
20002002
OpImageBlockMatchWindowSADQCOM = 4501,
20012003
OpImageBlockMatchGatherSSDQCOM = 4502,
20022004
OpImageBlockMatchGatherSADQCOM = 4503,
2005+
OpCompositeConstructCoopMatQCOM = 4540,
2006+
OpCompositeExtractCoopMatQCOM = 4541,
2007+
OpExtractSubArrayQCOM = 4542,
20032008
OpGroupIAddNonUniformAMD = 5000,
20042009
OpGroupFAddNonUniformAMD = 5001,
20052010
OpGroupFMinNonUniformAMD = 5002,
@@ -2803,10 +2808,14 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
28032808
case Op::OpImageBoxFilterQCOM: *hasResult = true; *hasResultType = true; break;
28042809
case Op::OpImageBlockMatchSSDQCOM: *hasResult = true; *hasResultType = true; break;
28052810
case Op::OpImageBlockMatchSADQCOM: *hasResult = true; *hasResultType = true; break;
2811+
case Op::OpBitCastArrayQCOM: *hasResult = true; *hasResultType = true; break;
28062812
case Op::OpImageBlockMatchWindowSSDQCOM: *hasResult = true; *hasResultType = true; break;
28072813
case Op::OpImageBlockMatchWindowSADQCOM: *hasResult = true; *hasResultType = true; break;
28082814
case Op::OpImageBlockMatchGatherSSDQCOM: *hasResult = true; *hasResultType = true; break;
28092815
case Op::OpImageBlockMatchGatherSADQCOM: *hasResult = true; *hasResultType = true; break;
2816+
case Op::OpCompositeConstructCoopMatQCOM: *hasResult = true; *hasResultType = true; break;
2817+
case Op::OpCompositeExtractCoopMatQCOM: *hasResult = true; *hasResultType = true; break;
2818+
case Op::OpExtractSubArrayQCOM: *hasResult = true; *hasResultType = true; break;
28102819
case Op::OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
28112820
case Op::OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
28122821
case Op::OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break;
@@ -4003,6 +4012,7 @@ inline const char* CapabilityToString(Capability value) {
40034012
case Capability::TextureBoxFilterQCOM: return "TextureBoxFilterQCOM";
40044013
case Capability::TextureBlockMatchQCOM: return "TextureBlockMatchQCOM";
40054014
case Capability::TileShadingQCOM: return "TileShadingQCOM";
4015+
case Capability::CooperativeMatrixConversionQCOM: return "CooperativeMatrixConversionQCOM";
40064016
case Capability::TextureBlockMatch2QCOM: return "TextureBlockMatch2QCOM";
40074017
case Capability::Float16ImageAMD: return "Float16ImageAMD";
40084018
case Capability::ImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD";
@@ -4744,10 +4754,14 @@ inline const char* OpToString(Op value) {
47444754
case Op::OpImageBoxFilterQCOM: return "OpImageBoxFilterQCOM";
47454755
case Op::OpImageBlockMatchSSDQCOM: return "OpImageBlockMatchSSDQCOM";
47464756
case Op::OpImageBlockMatchSADQCOM: return "OpImageBlockMatchSADQCOM";
4757+
case Op::OpBitCastArrayQCOM: return "OpBitCastArrayQCOM";
47474758
case Op::OpImageBlockMatchWindowSSDQCOM: return "OpImageBlockMatchWindowSSDQCOM";
47484759
case Op::OpImageBlockMatchWindowSADQCOM: return "OpImageBlockMatchWindowSADQCOM";
47494760
case Op::OpImageBlockMatchGatherSSDQCOM: return "OpImageBlockMatchGatherSSDQCOM";
47504761
case Op::OpImageBlockMatchGatherSADQCOM: return "OpImageBlockMatchGatherSADQCOM";
4762+
case Op::OpCompositeConstructCoopMatQCOM: return "OpCompositeConstructCoopMatQCOM";
4763+
case Op::OpCompositeExtractCoopMatQCOM: return "OpCompositeExtractCoopMatQCOM";
4764+
case Op::OpExtractSubArrayQCOM: return "OpExtractSubArrayQCOM";
47514765
case Op::OpGroupIAddNonUniformAMD: return "OpGroupIAddNonUniformAMD";
47524766
case Op::OpGroupFAddNonUniformAMD: return "OpGroupFAddNonUniformAMD";
47534767
case Op::OpGroupFMinNonUniformAMD: return "OpGroupFMinNonUniformAMD";

0 commit comments

Comments
 (0)