I am not entirely clear on why the attribute leadDimension in the gpu.subgroup_mma_load_matrix (and store) ops is necessary.
Couldn’t/shouldn’t it be inferred from the source (or destination) memref?
The need being loaded from could be 1-D, for example (as you generally need for a SPIR-V compile)
Thanks for the reply. I see, but even then it means that the leading dimension is known and the buffer is logically not 1D, so a reshape op on the argument seems like a better option.
I’d argue it’s reasonable to encode this on the op, especially since folding away reshapes is a rather common normalization step.
I am still not convinced that this is the right approach. As I see it when the buffer is logically 2D (or more) and the leading dimension is known, it should be encoded in the memref. Otherwise you get either duplicate information or you might as well use a pointer + size instead of a memref.
It’s a reasonable transformation to make all memrefs 1D before leaving MLIR. For one, I think the SPIR-V backend requires it, and even when you can have a 2D memref, you might want to expose the indexing logic so you can do stiff like integer range optimizations or LICM on it in MLIR.