Unclear requirements on Stride operand to OpCooperativeMatrix{Load,Store}KHR
kpet opened this issue · 0 comments
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?