[Mlir-commits] [mlir] [mlir][linalg] Add pass to transpose A matrix of matmul op (PR #89075)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Thu Apr 18 02:20:16 PDT 2024
banach-space wrote:
Hey @c-rhodes , thanks for implementing this!
> This seems like a very specific use case though....
ArmSME is just _one_ motivating example. The applicability of this is much wider - it's a very **generic transformation**:
* `linalg.matmul` -> `linalg.transpose + linalg.matmul_transpose_a`.
There are other examples like this in tree (`linalg.conv` -> `linalg.transpose` + `linalg.conv`):
* [TransposeConv2D.cpp](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Linalg/Transforms/TransposeConv2D.cpp)
Here's an example of wrapping a handful of patterns into a pass (in case that's the actual concern here):
* https://github.com/llvm/llvm-project/pull/87333
Also, an example of a rather target-specific set of optimisations:
* [VectorLinearize.cpp](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp)
I'm saying "target-specific" as a chunk of that won't work for scalable vectors (so one could argue that it's not "generic enough").
> I know there's MMT4D and @banach-space has spent a bit of time looking at this but it's a bit more involved and will require some work.
Even when we do have MMT4D, this transformation will remain a useful stepping stone that I'd like to use for benchmarking.
@MaheshRavishankar , to me this change is consistent with other transformations that we have in MLIR. I also don't see it being a maintenance burden - it's rather tiny.
> If there is a "general framework" to convert from one named op type to another prescriptively that would be a useful infra to have, but a one-off doesnt seem useful and hard to manage.
It's not obvious to me that that would be better than what's proposed here. Isn't that what patterns+passes are for? Do you have something specific in mind? Any references? Thanks!
https://github.com/llvm/llvm-project/pull/89075
More information about the Mlir-commits
mailing list