-
Notifications
You must be signed in to change notification settings - Fork 126
WIP cl_khr_cooperative_matrix #1533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kpet
wants to merge
1
commit into
main
Choose a base branch
from
cl-khr-cooperative-matrix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Copyright 2023-2026 The Khronos Group Inc. | ||
| // SPDX-License-Identifier: CC-BY-4.0 | ||
|
|
||
| include::{generated}/meta/{refprefix}cl_khr_cooperative_matrix.txt[] | ||
|
|
||
| === Other Extension Metadata | ||
|
|
||
| *Last Modified Date*:: | ||
| 2026-01-23 | ||
| *IP Status*:: | ||
| No known IP claims. | ||
| *Contributors*:: | ||
| * Kévin Petit, Arm Ltd. | ||
| * Ben Ashbaugh, Intel | ||
| * Sven van Haastregt, Arm Ltd. | ||
| * Jose Lopez, Qualcomm | ||
| * Nico Reissmann, Arm Ltd. | ||
| * Martin Fredin, Arm Ltd. | ||
|
|
||
| === Description | ||
|
|
||
| {cl_khr_cooperative_matrix_EXT} adds support for matrix multiplication | ||
| operations in which multiple work-items cooperate. | ||
|
|
||
| This extension depends on `SPV_KHR_cooperative_matrix`. | ||
|
|
||
| include::{generated}/meta/interfaces/cl_khr_cooperative_matrix.txt[] | ||
|
|
||
| === Version History | ||
|
|
||
| * Revision 1.0.0, 2026-01-23 | ||
| ** First assigned version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -412,6 +412,75 @@ If the OpenCL environment supports the extension `cl_khr_spirv_queries`, then: | |||||
| * For each of the capabilities returned by the query `CL_DEVICE_SPIRV_CAPABILITIES_KHR`, it is valid to declare the SPIR-V capability in a SPIR-V module using *OpCapability*. | ||||||
| Some capabilities may additionally require a specific SPIR-V version, or a SPIR-V extension to be declared via *OpExtension*. | ||||||
|
|
||||||
| ==== `cl_khr_cooperative_matrix` | ||||||
|
|
||||||
| If the OpenCL environment supports the extension `cl_khr_cooperative_matrix`, then the environment must | ||||||
| accept modules that declare use of the extension `SPV_KHR_cooperative_matrix` via *OpExtension*. | ||||||
|
|
||||||
| If the OpenCL environment supports the extension `cl_khr_cooperative_matrix` and use of the SPIR-V extension `SPV_KHR_cooperative_matrix` is declared in the module via *OpExtension*, then the environment must accept modules that declare the following SPIR-V capability: | ||||||
|
|
||||||
| * *CooperativeMatrixKHR* | ||||||
|
|
||||||
| For *OpTypeCooperativeMatrixKHR*, the component type, number of rows and number | ||||||
| of columns must match one of the supported combinations reported via the | ||||||
| {clGetDeviceCooperativeMatrixInfoKHR} device query, otherwise | ||||||
| the behavior of the program is undefined. | ||||||
|
|
||||||
| For *OpTypeCooperativeMatrixMulAddKHR*, the operands must match a supported | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| {cl_device_cooperative_matrix_variant_khr_TYPE} such that: | ||||||
|
|
||||||
| * The type of _A_ must have _Rows_ match `cl_device_cooperative_matrix_variant_khr::m_size`, | ||||||
| _Columns_ match `cl_device_cooperative_matrix_variant_khr::k_size`, _Use_ be *MatrixAKHR*, | ||||||
| and _ComponentType_ match `cl_device_cooperative_matrix_variant_khr::a_type`. | ||||||
|
|
||||||
| * The type of _B_ must have _Rows_ match `cl_device_cooperative_matrix_variant_khr::k_size`, | ||||||
| _Columns_ match `cl_device_cooperative_matrix_variant_khr::n_size`, _Use_ be *MatrixBKHR*, | ||||||
| and _ComponentType_ match `cl_device_cooperative_matrix_variant_khr::b_type`. | ||||||
|
|
||||||
| * The type of _C_ must have _Rows_ match `cl_device_cooperative_matrix_variant_khr::m_size`, | ||||||
| _Columns_ match `cl_device_cooperative_matrix_variant_khr::n_size`, _Use_ be *MatrixAccumulatorKHR*, | ||||||
| and _ComponentType_ match `cl_device_cooperative_matrix_variant_khr::c_type`. | ||||||
|
|
||||||
| * The type of _Result_ must have _Rows_ match `cl_device_cooperative_matrix_variant_khr::m_size`, | ||||||
| _Columns_ match `cl_device_cooperative_matrix_variant_khr::n_size`, _Use_ be *MatrixAccumulatorKHR*, | ||||||
| and _ComponentType_ match `cl_device_cooperative_matrix_variant_khr::result_type`. | ||||||
|
|
||||||
| * If and only if `cl_device_cooperative_matrix_variant_khr::a_type` is a signed | ||||||
| integer type, *MatrixASignedComponents* must be used. | ||||||
|
|
||||||
| * If and only if `cl_device_cooperative_matrix_variant_khr::b_type` is a signed | ||||||
| integer type, *MatrixBSignedComponents* must be used. | ||||||
|
|
||||||
| * If and only if `cl_device_cooperative_matrix_variant_khr::c_type` is a signed | ||||||
| integer type, *MatrixCSignedComponents* must be used. | ||||||
|
|
||||||
| * If and only if `cl_device_cooperative_matrix_variant_khr::result_type` is a signed | ||||||
| integer type, *MatrixResultSignedComponents* must be used. | ||||||
|
|
||||||
| * If and only if `cl_device_cooperative_matrix_variant_khr::saturating_accumulation` | ||||||
| is `CL_TRUE`, *SaturatingAccumulationKHR* must be used. | ||||||
|
|
||||||
| * If and only if `cl_device_cooperative_matrix_variant_khr::saturating_accumulation` | ||||||
| is `CL_FALSE`, *SaturatingAccumulationKHR* must not be used. | ||||||
|
|
||||||
| * The scope of all cooperative matrix operands must be *Subgroup*. | ||||||
|
|
||||||
| * Behavior is undefined if *OpCooperativeMatrixLoadKHR*, | ||||||
| *OpCooperativeMatrixStoreKHR*, or *OpCooperativeMatrixMulAddKHR* acting on | ||||||
| cooperative matrix objects with *Subgroup* scope are dynamically executed | ||||||
| by a kernel that does not use full subgroups. | ||||||
|
|
||||||
| For *OpCooperativeMatrixLoadKHR* or *OpCooperativeMatrixStoreKHR*: | ||||||
|
|
||||||
| * the _Storage Class_ of the _Pointer_ operand must be limited to *Workgroup* or | ||||||
| *CrossWorkgroup*. | ||||||
| * _Pointer_ must be aligned to at least the larger of the size of the elements | ||||||
| of the matrix or {CL_DEVICE_COOPERATIVE_MATRIX_POINTER_ALIGNMENT_KHR} for the | ||||||
| device. | ||||||
| * _Stride_ must be a multiple of the larger of the size of the elements of the | ||||||
| matrix or {CL_DEVICE_COOPERATIVE_MATRIX_STRIDE_MULTIPLE_KHR}, divided by the | ||||||
| size of the type pointed to by _Pointer_. | ||||||
|
|
||||||
| === Embedded Profile Extensions | ||||||
|
|
||||||
| ==== `cles_khr_int64` | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be
OpTypeInt xx 1to indicate signedness?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, as the OpenCL SPIR-V Environment Specification Section 4 "Validation Rules" says:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks!