Skip to content

Unclear requirements on Stride operand to OpCooperativeMatrix{Load,Store}KHR #279

@kpet

Description

@kpet

For the RowMajorKHR and ColumnMajorKHR memory layouts the SPV_KHR_cooperative_matrix specification currently states

Stride must be greater than 0 when passed to OpCooperativeMatrixStoreKHR and must be greater than or equal to 0 when passed to OpCooperativeMatrixLoadKHR.

@alan-baker observed in KhronosGroup/SPIRV-Tools#5777 (review) that the specification does not explicitly document the signedness of the Stride operand.

This was discussed in the 2024/08/28 SPIR teleconference and the consensus seemed to be that Stride is meant to always be interpreted as unsigned. If that's the case we should state it in the specification and remove the requirement that it be "greater than or equal to 0 when passed to OpCooperativeMatrixLoadKHR".

Also, we observed in the teleconference that the requirement for Stride to be "greater than 0 when passed to OpCooperativeMatrixStoreKHR" was necessary for correctness but not sufficient. Should we strengthen the rule and require that the stride be greater than the total size of the data being stored to avoid write collisions?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions