Hi,
I would like to know how coopMatLoad from the VK_KHR_cooperative_matrix extension exactly works when loading from shared variables. The definition is:
void coopMatLoad(out coopmat m, float_or_float16_t[] buf, uint element, uint stride, colMajor / rowMajor);
mis a cooperative matrix where to store the results of the load operation.bufis a 32-bit or 16-bit buffer (it can be also a shared variable).elementis an offset inside the buffer where to load from (in this case,buf).strideis the stride to apply to the loading operation, as perhaps some empty 0s are required per row or column.rowMajor/colMajorto indicate whether to load information from but in a row major or column major fashion (in practice, the valuesgl_CooperativeMatrixLayoutRowMajororgl_CooperativeMatrixLayoutColumnMajorare used).
For instance, given a 16 rows x 8 columns matrix and a shared variable of 128 elements with initialized values ready:
shared float16_t sharedVariable[128];
coopmat<float16_t, gl_ScopeSubgroup, 16, 8, gl_MatrixUseA> m;
Is the command below correct to load the 128 elements from the shared variable sharedVariable onto the matrix m so no element is missing (being all tightly loaded, with no “0.0” values due to stride)?
coopMatLoad(m, sharedVariable, 0, 8, gl_CooperativeMatrixLayoutRowMajor);
Thanks,
T