Name Strings

SPV_EXT_cooperative_matrix_maintenance1

Contact

To report problems with this extension, please open a new issue at:

Contributors

  • Jeff Bolz, NVIDIA

  • Karthik Vaidyanathan, NVIDIA

  • Kevin Petit, Arm Ltd.

  • Stuart Brady, Arm Ltd.

  • Hans-Kristian Arntzen, Valve

  • Georg Lehmann, Valve

  • Vikram Tarikere, Imagination Technologies

Notice

Copyright (c) 2025-2026 The Khronos Group Inc. Copyright terms at http://www.khronos.org/registry/speccopyright.html

Status

  • Approved by the SPIR-V Working Group: 2026-06-17

  • Approved by the Khronos Board of Promoters: 2026-07-31

Version

Last Modified Date

2026-05-11

Revision

1

Dependencies

This extension is written against the SPIR-V Specification, Version 1.6, Revision 3, Unified.

This extension requires SPIR-V 1.3.

This extension requires SPV_KHR_cooperative_matrix.

Overview

This extension adds several new features building on the cooperative matrix types added in SPV_KHR_cooperative_matrix. The goal is to add and accelerate features beyond just simple GEMM kernels, including adding support for type/use conversions, reductions, per-element operations, and conversion of an element index to a matrix coordinate.

Extension Name

To use this extension within a SPIR-V module, the following OpExtension must be present in the module:

OpExtension "SPV_EXT_cooperative_matrix_maintenance1"

Modifications to the SPIR-V Specification, Version 1.6

2.2 Terms

Add to the list of Tangled Instructions in section 2.2.5 Control Flow:

  • OpCooperativeMatrixReduceEXT, OpCooperativeMatrixConvertUseEXT, and OpCooperativeMatrixPerElementOpEXT.

3.2.19 Decoration

Modify Section 3.2.19, "Decoration", adding these rows to the Decoration table:

Decoration Extra Operands Enabling Capabilities

5440

CooperativeMatrixTransposeEXT
Modifies a conversion instruction to also transpose the matrix.

CooperativeMatrixConversionsEXT

3.31 Capabilities

Modify Section 3.31, "Capability", adding these rows to the Capability table:

Capability Enabling Capabilities

5430

CooperativeMatrixReductionsEXT
Enables cooperative matrix reduction instructions.

5429

CooperativeMatrixConversionsEXT
Enables cooperative matrix conversion/transpose instructions.

5432

CooperativeMatrixPerElementOperationsEXT
Enables cooperative matrix per-element operations.

5438

CooperativeMatrixGetCoordinateEXT
Enables cooperative matrix index to coordinate conversion.

3.X Cooperative Matrix Reduce Mode

New section in 3 "Binary Form".

Cooperative Matrix Reduce Mode Enabling Capabilities

0x1

Row
Elements within each row of a matrix are reduced.

0x2

Column
Elements within each column of a matrix are reduced.

0x4

2x2
Elements within an aligned 2x2 neighborhood are reduced.

It is invalid to combine 2x2 with Row or Column. Row and Column can be used together.

3.49.1 Miscellaneous Instructions

OpCooperativeMatrixGetCoordinateEXT

Converts an index in range [0, OpCooperativeMatrixLengthKHR - 1] to a (row,column) coordinate. The element of the matrix at that index (when treated as a composite) is the element located at (row,column) in the matrix. If Index is out of bounds, the resulting value is undefined.

Result Type must be a vector type with two 32-bit integer components.

Matrix must have an OpTypeCooperativeMatrixKHR type.

Index must have a 32-bit integer type.

Capability:
CooperativeMatrixGetCoordinateEXT

5

5363

<id>
Result Type

Result <id>

<id>
Matrix

<id>
Index

3.49.11 Conversion Instructions

Relax the restrictions on Op{F,S,U,etc.}Convert from SPV_KHR_cooperative_matrix if CooperativeMatrixConversionsEXT is enabled to allow Use to mismatch, where either the Use of the operand can be MatrixAccumulatorKHR and the Use of the result type can be MatrixAKHR or MatrixBKHR, or the Use of the result type can be MatrixAccumulatorKHR and the Use of the operand can be MatrixAKHR or MatrixBKHR. Also allow the instructions to be decorated with CooperativeMatrixTransposeEXT. The restriction on OpBitcast is not relaxed.

If the conversion instruction is decorated with CooperativeMatrixTransposeEXT, the operand must have the same Rows as Result Type has Columns, and vice versa, and the Use of Result Type must be MatrixAKHR or MatrixBKHR and the Use of the operand must be MatrixAccumulatorKHR. The elements of the matrix are transposed as part of the conversion, i.e. element (r,c) of the source is converted and stored in result element (c,r).

OpCooperativeMatrixConvertUseEXT

Converts a cooperative matrix to another cooperative matrix with different Use.

Result Type must be an OpTypeCooperativeMatrixKHR.

The type of Matrix must be an OpTypeCooperativeMatrixKHR with the same Scope as Result Type. The Component Type of Matrix and Result Type must either be the same or be scalar integer types that differ only in Signedness.

If the instruction is not decorated with CooperativeMatrixTransposeEXT, Matrix must have the same Rows and Columns as Result Type.

If the instruction is decorated with CooperativeMatrixTransposeEXT, Matrix must have the same Rows as Result Type has Columns, and vice versa.

If the Use of Matrix is MatrixAccumulatorKHR, then the Use of Result Type must be MatrixAKHR or MatrixBKHR.

If the Use of Matrix is MatrixAKHR or MatrixBKHR, then the Use of Result Type must be MatrixAccumulatorKHR.

For conversions that change both Component Type and Use, use Op{F,S,U,etc.}Convert instead.

Capability:
CooperativeMatrixConversionsEXT

4

5293

<id>
Result Type

Result <id>

<id>
Matrix

3.49.9 Function Instructions

OpCooperativeMatrixPerElementOpEXT

Applies an operation to each element of a cooperative matrix.

The type of Matrix must be an OpTypeCooperativeMatrixKHR.

Result Type must match the type of Matrix.

Func must be an OpFunction whose return type matches the component type of Matrix, whose first two parameters must be 32-bit integer types, whose third parameter type must match the component type of Matrix, and which may have additional parameters. The function is called for each element of the matrix where the element is passed as the third parameter to the function, the row and column number of the matrix are passed as the first and second parameters, and any optional operands are passed in order as the remaining parameters.

The number of optional operands must match the number of additional parameters of Func. The type of each optional operand that does not have a cooperative matrix type must match the type of the corresponding parameter of Func.

For each optional operand with a cooperative matrix type, the corresponding matrix element is passed to the function. The matrix type must match the type of Matrix, and the component type of the matrix must match the type of the corresponding parameter of Func.

The return value of Func is the corresponding element of Result.

The calls are considered unordered against each other, and calls may occur more than once.

Within Func and any functions called directly or indirectly by Func, tangled instructions are not allowed.

Capability:
CooperativeMatrixPerElementOperationsEXT

5+variable

5369

<id>
Result Type

Result <id>

<id>
Matrix

<id>
Func

Optional
<id>, <id>, …​

OpCooperativeMatrixReduceEXT

Computes a matrix where each element of the result matrix is computed from a row, column, or neighborhood of the source matrix.

Result Type must be an OpTypeCooperativeMatrixKHR type.

The type of Matrix must be an OpTypeCooperativeMatrixKHR with the same Component Type as Result Type.

The type of Matrix and Result Type must each have Use of MatrixAccumulatorKHR and must have matching Scope.

Reduce must be Row, Column, 2x2, or the combination of Row and Column.

If Reduce includes 2x2, the dimensions of Result Type must be half of the dimensions of Matrix. Each element (r,c) of the result matrix is calculated by combining elements (2*r, 2*c), (2*r+1, 2*c), (2*r, 2*c+1), and (2*r+1, 2*c+1) of Matrix.

If Reduce equals Row, then Result Type must have the same number of rows as Matrix but can have any supported number of columns. All elements of a row in the result matrix have the same value, which is computed by combining all elements of the corresponding row of Matrix.

If Reduce equals Column, then Result Type must have the same number of columns as Matrix but can have any supported number of rows. All elements of a column in the result matrix have the same value, which is computed by combining all elements of the corresponding column of Matrix.

If Reduce includes Row and Column, Result Type can have any number of rows and columns. All elements of the result matrix have the same value, which is computed by combining all elements of Matrix.

CombineFunc must be an OpFunction with two parameters whose types and result type all match the component type of Matrix. This function is called to combine pairs of elements (or intermediate results) when computing the reduction. This function should be mathematically commutative and associative (though in practice, with floating point numbers, may not be exactly commutative/associative).

Within CombineFunc and any functions called directly or indirectly by CombineFunc, tangled instructions are not allowed.

Capability:
CooperativeMatrixReductionsEXT

6

5366

<id>
Result Type

Result <id>

<id>
Matrix

Literal
Reduce

<id>
CombineFunc

Issues

  1. How are matrix type conversions with Use change handled?

    Discussion: RESOLVED. We need to support conversions that change both Component Type and Use at the same time, because there is often not a supported intermediate type that matches one but not the other. For example, if converting from f32 MatrixAccumulatorKHR to u8 MatrixAKHR, there may not be support for u8 MatrixAccumulatorKHR or f32 MatrixAKHR. Conversions that change the Component Type should use Op{F,S,U,etc.}Convert even if the Use changes.

    We also need to support conversions that only change the Use, for example converting from f16 MatrixAccumulatorKHR to f16 MatrixAKHR. For this, OpFConvert could be confusing/misleading so we add a new OpCooperativeMatrixConvertUseEXT instruction for this case.

Revision History

Rev Date Author Changes

1

2026-05-11

Jeff Bolz

Initial revision of SPV_EXT_cooperative_matrix_maintenance1