Skip to content

Add cl_khr_cooperative_matrix tests#2655

Open
svenvh wants to merge 3 commits intoKhronosGroup:mainfrom
svenvh:cl_khr_cooperative_matrix
Open

Add cl_khr_cooperative_matrix tests#2655
svenvh wants to merge 3 commits intoKhronosGroup:mainfrom
svenvh:cl_khr_cooperative_matrix

Conversation

@svenvh
Copy link
Copy Markdown
Member

@svenvh svenvh commented Apr 1, 2026

Add tests for the cl_khr_cooperative_matrix extension.

The extension defines various operations on cooperative matrix types. The list of tested operations is in cooperative_matrix.def. Each entry in that .def file results in a subtest.

Each subtest will iterate over all supported variants reported by the runtime and test each variant. An individual variant can be run using the --variant command line option.

This CTS suite generates textual SPIR-V and uses spirv-tools to assemble the textual SPIR-V into a SPIR-V binary.

@svenvh svenvh force-pushed the cl_khr_cooperative_matrix branch from 96d41e3 to d865c53 Compare April 1, 2026 13:12
@svenvh svenvh marked this pull request as draft April 1, 2026 13:23
@svenvh svenvh force-pushed the cl_khr_cooperative_matrix branch 5 times, most recently from 1714294 to bcd2025 Compare April 1, 2026 16:01
case CoopMatOp::multicomponent_load:
case CoopMatOp::multicomponent_store:
spirv_text << R"(
%matSrc = OpCooperativeMatrixLoadKHR )" << getResTy() << R"( %in)" << variant.order << R"( %layout)" << variant.order << R"( %stride)" << variant.order << R"(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matAty should be the type always used for OpCooperativeMatrixLoadKHR in the copy tests.
When a unary variant is created, variant.inputA, variant.inputB and variant.inputC matrices use the same size (rows x cols).
For example, for a supported variant that uses MatrixA (64 x 16) and MatrixB (16 x 64), if the order of the copy operation is B, variant.inputA and variant.inputB will be 16x64. This results on the next SPIR-V being generated:

%sizeM = OpConstant %i32 16
%sizeK = OpConstant %i32 64
%sizeN = OpConstant %i32 64

And then matBty will be used resulting in storing a 64x64 matrix in a buffer of size 16x64

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks! Always using matAty would mean the OpCooperativeMatrixLoadKHR operations are only tested with Use = MatrixAKHR, whereas we should cover all Use values. I'll prepare a different fix.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a fix now; let me know if this works for you.

svenvh and others added 3 commits April 7, 2026 13:33
Add tests for the `cl_khr_cooperative_matrix` extension.

The extension defines various operations on cooperative matrix types.
The list of tested operations is in `cooperative_matrix.def`.  Each
entry in that `.def` file results in a subtest.

Each subtest will iterate over all supported variants reported by the
runtime and test each variant.  An individual variant can be run using
the `--variant` command line option.

This CTS suite generates textual SPIR-V and uses spirv-tools to
assemble the textual SPIR-V into a SPIR-V binary.

Co-authored-by: Jacob Hodgson <jacob.hodgson@arm.com>
Co-authored-by: Martin Fredin <martin.fredin@arm.com>
Co-authored-by: Nico Reissmann <nico.reissmann@arm.com>
Co-authored-by: Pedro Olsen Ferreira <pedro.olsenferreira@arm.com>
Co-authored-by: Riccardo Zanetti <riccardo.zanetti@arm.com>
Co-authored-by: Stuart Brady <stuart.brady@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
@svenvh svenvh force-pushed the cl_khr_cooperative_matrix branch from bcd2025 to e980541 Compare April 7, 2026 12:37
@svenvh svenvh marked this pull request as ready for review April 7, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants