Add support for the ARM extended matrix layout

This commit is contained in:
Pedro Olsen Ferreira 2024-06-07 12:48:05 +01:00 committed by arcady-lunarg
parent 68821c4da8
commit 02263efcd6
8 changed files with 548 additions and 0 deletions

View file

@ -41,5 +41,6 @@ static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader
static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64";
static const char* const E_SPV_EXT_shader_tile_image = "SPV_EXT_shader_tile_image";
static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader";
static const char* const E_SPV_ARM_cooperative_matrix_layouts = "SPV_ARM_cooperative_matrix_layouts";
#endif // #ifndef GLSLextEXT_H

View file

@ -3705,6 +3705,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
idImmOps.push_back(spv::IdImmediate(true, operands[1])); // buf
if (node->getOp() == glslang::EOpCooperativeMatrixLoad) {
idImmOps.push_back(spv::IdImmediate(true, operands[3])); // matrixLayout
auto layout = builder.getConstantScalar(operands[3]);
if (layout == spv::CooperativeMatrixLayoutRowBlockedInterleavedARM ||
layout == spv::CooperativeMatrixLayoutColumnBlockedInterleavedARM) {
builder.addExtension(spv::E_SPV_ARM_cooperative_matrix_layouts);
builder.addCapability(spv::CapabilityCooperativeMatrixLayoutsARM);
}
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride
} else {
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride
@ -3729,6 +3735,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
idImmOps.push_back(spv::IdImmediate(true, operands[0])); // object
if (node->getOp() == glslang::EOpCooperativeMatrixStore) {
idImmOps.push_back(spv::IdImmediate(true, operands[3])); // matrixLayout
auto layout = builder.getConstantScalar(operands[3]);
if (layout == spv::CooperativeMatrixLayoutRowBlockedInterleavedARM ||
layout == spv::CooperativeMatrixLayoutColumnBlockedInterleavedARM) {
builder.addExtension(spv::E_SPV_ARM_cooperative_matrix_layouts);
builder.addCapability(spv::CapabilityCooperativeMatrixLayoutsARM);
}
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride
} else {
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride

View file

@ -1035,6 +1035,8 @@ const char* CapabilityString(int info)
case CapabilityTileImageDepthReadAccessEXT: return "TileImageDepthReadAccessEXT";
case CapabilityTileImageStencilReadAccessEXT: return "TileImageStencilReadAccessEXT";
case CapabilityCooperativeMatrixLayoutsARM: return "CooperativeMatrixLayoutsARM";
case CapabilityFragmentShadingRateKHR: return "FragmentShadingRateKHR";
case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT";

View file

@ -1002,6 +1002,7 @@ enum Capability {
CapabilityTileImageColorReadAccessEXT = 4166,
CapabilityTileImageDepthReadAccessEXT = 4167,
CapabilityTileImageStencilReadAccessEXT = 4168,
CapabilityCooperativeMatrixLayoutsARM = 4201,
CapabilityFragmentShadingRateKHR = 4422,
CapabilitySubgroupBallotKHR = 4423,
CapabilityDrawParameters = 4427,
@ -1302,6 +1303,8 @@ enum CooperativeMatrixOperandsMask {
enum CooperativeMatrixLayout {
CooperativeMatrixLayoutRowMajorKHR = 0,
CooperativeMatrixLayoutColumnMajorKHR = 1,
CooperativeMatrixLayoutRowBlockedInterleavedARM = 4202,
CooperativeMatrixLayoutColumnBlockedInterleavedARM = 4203,
CooperativeMatrixLayoutMax = 0x7fffffff,
};