Name Strings
SPV_QCOM_cooperative_matrix_conversion
Contact
To report problems with this extension, please open a new issue at:
Contributors
-
Alex Bourd, Qualcomm (abourd at qti.qualcomm.com)
-
Elina Kamenetskaya, Qualcomm (elinak at qti.qualcomm.com)
-
Wooyoung Kim, Qualcomm (wooykim at qti.qualcomm.com)
Notice
Copyright (c) 2025 The Khronos Group Inc. Copyright terms at http://www.khronos.org/registry/speccopyright.html
Status
-
Final
Version
Last Modified Date |
2025-05-23 |
Revision |
1 |
Dependencies
This extension is written against the Unified SPIR-V Specification, Version 1.6 Revision 5.
This extension requires SPIR-V 1.3. This extension requires SPV_KHR_cooperative_matrix.
Overview
This extension adds support for three conversion operations:
-
bitcast conversion between compatible one-dimensional arrays
-
(cooperative) construction of a cooperative matrix using one-dimensional arrays from invocations in a subgroup
-
concurrent extraction of rows or columns of a cooperative matrix into invocations in a subgroup
In addition, it adds a utility instruction that extracts a subarray from the source array.
Extension Name
To use this extension within a SPIR-V module, the following OpExtension must be present in the module:
OpExtension "SPV_QCOM_cooperative_matrix_conversion"
New Capabilities
This extension introduces a new capability:
CooperativeMatrixConversionQCOM
New Instructions
Instructions added under the CooperativeMatrixConversionQCOM capability:
OpBitCastArrayQCOM OpCompositeConstructCoopMatQCOM OpCompositeExtractCoopMatQCOM OpExtractSubArrayQCOM
Modifications to the SPIR-V Specification, Version 1.6
Capabilities
Modify Section 3.31, "Capability", adding the following row to the Capability table after TextureBlockMatchQCOM:
Capability | Implicitly Declares | |
---|---|---|
4496 |
CooperativeMatrixConversionQCOM To do bitcast conversion between compatible one-dimensional arrays, to construct (cooperatively) a cooperative matrix using one-dimensional arrays, to extract rows/columns of a cooperative matrix, and to extract a sub-array from a larger array. |
CooperativeMatrixKHR |
Instructions
Modify Section 3.56.11. "Conversion Instructions" adding the following row before OpCooperativeMatrixConvertNV:
OpBitCastArrayQCOM Array conversion operation Result Type is the type of a result of the array conversion operation and it must be a one-dimensional array type whose element type is either a 32-bit OpTypeInt (unsigned/signed) or an OpTypeFloat with the default IEEE 754 encoding (32-bit or 16-bit). Source Array must be a one-dimensional array whose element type is either a 32-bit OpTypeInt (unsigned/signed) or an OpTypeFloat with the default IEEE 754 encoding (32-bit or 16-bit). The size of Result Type must be equal to the size of the Source Array's type. |
Capability: |
|||
4 |
4497 |
<id> Result Type |
<id> Source Array |
Modify Section 3.56.12. "Composite Instructions" adding the following row after OpCompositeConstruct:
OpCompositeConstructCoopMatQCOM Cooperatively construct a cooperative matrix object from array objects from invocations in a subgroup. SubgroupSize must be a power of 2. For non power of two SubgroupSize, the behaviors are undefined. Result Type is the type of a cooperative matrix being constructed whose Scope is Subgroup and Source Array is the one-dimensional array that is used to construct the cooperative matrix. The Source Array's Element Type must be either the same as the Result Type's Component Type or unsigned 32-bit OpTypeInt. The array from invocation with SubgroupLocalInvocationID i goes to the i-th row of the resulting cooperative matrix if the cooperative matrix object’s Use is MatrixAKHR or MatrixAccumulatorKHR and to the i-th column if MatrixBKHR. If the Result Type's number of rows (for MatrixAKHR or MatrixAccumulatorKHR) or columns (for MatrixBKHR) is less than SubgroupSize, the value from any invocation whose SubgroupLocalInvocationID is greater than or equal to the number are ignored.
Its Component Type is one of a 8-bit OpTypeInt (unsigned/signed), or an OpTypeFloat with the default IEEE 754 encoding (32-bit or 16-bit), its Rows must be one of the supported cooperative matrix row sizes that are less than or equal to SubgroupSize, and Columns must be 8, 16, 32 and 32 when its Component Type is the 32-bit OpTypeFloat, the 16-bit OpTypeFloat, the signed 8-bit OpTypeInt, and the unsigned 8-bit OpTypeInt, respectively. The Source Array's Length must be 8 if its Element Type is unsigned 32-bit OpTypeInt and must match the Result Type's Columns otherwise.
Its Component Type is one of a 8-bit OpTypeInt (unsigned/signed), or an OpTypeFloat with the default IEEE 754 encoding (32-bit or 16-bit), its Rows must be 8, 16, 32 and 32 when its Component Type is the 32-bit OpTypeFloat, the 16-bit OpTypeFloat, the signed 8-bit OpTypeInt, and the unsigned 8-bit OpTypeInt, respectively, and its Columns must be one of the supported cooperative matrix column sizes that are less than or equal to SubgroupSize. The Source Array's Length must be 8 if its Element Type is unsigned 32-bit OpTypeInt and must match the Result Type's Rows otherwise.
Its Component Type is one of a 32-bit OpTypeInt (unsigned/signed), or an OpTypeFloat with the default IEEE 754 encoding (32-bit or 16-bit), its Rows and Columns must be one of the supported cooperative matrix row and column sizes, respectively, that are less than or equal to SubgroupSize. The Source Array's Length must be (Result Type's Columns/2) if its Element Type is unsigned 32-bit OpTypeInt and Result Type's Component Type is the 16-bit OpTypeFloat or Result Type's Columns if its Element Type is unsigned 32-bit OpTypeInt and Result Type's Component Type is the 32-bit OpTypeFloat, and must match the Result Type's Columns otherwise. |
Capability: |
|||
4 |
4540 |
<id> Result Type |
<id> Source Array |
Modify Section 3.56.12. "Composite Instructions" adding the following row after OpCompositeExtract:
OpCompositeExtractCoopMatQCOM Cooperatively extract rows or columns from a cooperative matrix object and distribute them among invocations in a subgroup. SubgroupSize must be a power of 2. For non power of two SubgroupSize, the behaviors are undefined. Result Type is an OpTypeArray and Source CoopMat is a cooperative matrix from which arrays for invocations in a subgroup are extracted. Invocation with SubgroupLocalInvocationID i gets the i-th row of the cooperative matrix if the cooperative matrix object’s Use is MatrixAKHR or MatrixAccumulatorKHR and the i-th column if MatrixBKHR. If the Source CoopMat's number of rows (for MatrixAKHR or MatrixAccumulatorKHR) or columns (for MatrixBKHR) is less than SubgroupSize, any invocation whose SubgroupLocalInvocationID is greater than or equal to the number gets an OpUndef value of the Result Type.
Either Result Type's Element Type must be the same as Source CoopMat's Component Type and its Length must be Source CoopMat's Columns, or the Element Type must be unsigned 32-bit OpTypeInt and the Length must be 8. Source CoopMat's Component Type must be a 8-bit OpTypeInt (unsigned/signed) or an OpTypeFloat with the default IEEE 754 encoding (32-bit or 16-bit), its Rows must be one of the supported cooperative matrix row sizes that are less than or equal to SubgroupSize, and Columns must be 8, 16, 32 and 32 when its Component Type is the 32-bit OpTypeFloat, the 16-bit OpTypeFloat, the signed 8-bit OpTypeInt, and the unsigned 8-bit OpTypeInt, respectively.
Either Result Type's Element Type must be the same as Source CoopMat's Component Type and its Length must be Source CoopMat's Rows, or the Element Type must be unsigned 32-bit OpTypeInt and the Length must be 8. Source CoopMat's Component Type must be a 8-bit OpTypeInt (unsigned/signed) or an OpTypeFloat with the default IEEE 754 encoding (32-bit or 16-bit), its Rows must be 8, 16, 32 and 32 when its Component Type is the 32-bit OpTypeFloat, the 16-bit OpTypeFloat, the signed 8-bit OpTypeInt, and the unsigned 8-bit OpTypeInt, respectively, and its Columns must be one of the supported cooperative matrix column sizes that are less than or equal to SubgroupSize.
Either Result Type's Element Type must be the same as Source CoopMat's Component Type and its Length must be Source CoopMat's Columns, or the Element Type must be unsigned 32-bit OpTypeInt and the Length must be Source CoopMat's Columns if Source CoopMat's Component Type is 32-bit OpTypeFloat and Source CoopMat's Columns / 2 if the Component Type is 16-bit OpTypeFloat. Source CoopMat's Component Type must be a 32-bit OpTypeInt (unsigned/signed) or an OpTypeFloat with the default IEEE 754 encoding (32-bit or 16-bit), its Rows and Columns must be one of the supported cooperative matrix row and column sizes, respectively, that are less than or equal to SubgroupSize. |
Capability: |
|||
4 |
4541 |
<id> Result Type |
<id> Source CoopMat |
OpExtractSubArrayQCOM Extracts a sub-array from a larger source array. Result Type must be a one-dimensional array type whose element type is the same as the element type of Source Array. Source Array must be a one-dimensional array whose element type is either a 32-bit OpTypeInt (unsigned/signed) or an OpTypeFloat with the default IEEE 754 encoding (32-bit or 16-bit). Start Index is a signed 32-bit OpTypeInt value. (Start Index + Result Type's Length) must not be greater than Source Array's Length. Otherwise, the behaviors are undefined. If the result is to be used as inputs to any subsequent cooperative matrix operations, Start Index must be a multiple of one of the lengths supported for MatrixUseA cooperative matrices' columns or MatrixUseB cooperative matrices' rows (i.e., input channel K). |
Capability: |
||||
5 |
4542 |
<id> Result Type |
<id> Source Array |
<id> Start Index |
Validation Rules
An OpExtension must be added to the SPIR-V for validation layers to check legal use of this extension:
OpExtension "SPV_QCOM_cooperative_matrix_conversion"
Issues
Revision History
Rev | Date | Author | Changes |
---|---|---|---|
1 |
2025-05-23 |
Wooyoung Kim |
Initial version |