[Mlir-commits] [mlir] [mlir] [linalg] Add canonicalize pattern to swap transpose with broadcast (PR #97063)

donald chen llvmlistbot at llvm.org
Mon Jul 1 08:07:20 PDT 2024


cxy-1993 wrote:

> I understand this makes sense as something good to do always, but isnt this a one-off pattern that you want. Does it have to be a canonicalization where it needs a fixed point? (not hard-blocking though, cause I can see why this is better in general). (see the extremely long discussion here https://discourse.llvm.org/t/rfc-update-to-general-design-section-of-operation-canonicalizations-in-mlir/79355)

Thanks for the context. I completely agree with the discussion here: I also often struggle with whether an optimization pattern should be placed in fold/canonicalize or a pass. Maybe you should doc it here too(https://mlir.llvm.org/docs/Canonicalization/).

For this pattern, I think it's appropriate to use it as a canonicalization. Here are the reasons:
- This pattern is convergent.
- This pattern is unidirectional (in the direction of reducing data size, not like the case in the RFC).
- This is not a one-off pattern; new matches may be generated during the application process.


https://github.com/llvm/llvm-project/pull/97063


More information about the Mlir-commits mailing list