[Mlir-commits] [mlir] [mlir][memref] Use array notation instead of permutation map for memref.transpose (PR #67880)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Mon Oct 2 02:35:45 PDT 2023
ftynse wrote:
> But isn't it still possible to interpret it the other way around, i.e. as a mapping of result dimensions to original dimensions? I think this is what happened in https://github.com/llvm/llvm-project/issues/65145.
It is significantly less likely given how pervasive the "follow the arrow" interpretation of the map is. What happened in #65145 is actually likely due to the author interpreting the affine map as a list of integers in disguise rather than as a map, which is exactly what the proposed change will enforce.
> In https://github.com/llvm/llvm-project/issues/65145 if I understand correctly the lowering pass wrong, so it's not a problem of IR readability but a problem of someone used the C++ API the wrong way around.
And a better solution to that would be to use higher-level API, not use an even lower-level representation. We have this https://github.com/llvm/llvm-project/blob/bc7ca9170f250e2eb6b235ed8555278dbc82e801/mlir/include/mlir/IR/AffineMap.h#L624.
Even better, if permutations are such a common case, we could introduce a `PermutationAttr` with unambiguous API backed by a dense storage.
https://github.com/llvm/llvm-project/pull/67880
More information about the Mlir-commits
mailing list