[Mlir-commits] [mlir] [MLIR][Tensor] Canonicalize fully covering slice insertions into tensors with unit prefixes (PR #92912)

Mehdi Amini llvmlistbot at llvm.org
Wed May 22 11:46:12 PDT 2024


joker-eph wrote:

> There might not be a single form. The two equivalent programs are equivalent and there is nothing to chose between them without additional context that only exist in the use case.

Sorry but I don't see any first principles coming from your statement here: in particular when it comes to a very simple case like here that only involve 1 op before and after the canonicalization, we ought to be able to select one!

Going back to this pattern: what makes it more difficult to match `tensor.expand_shape`  rather than `insert_slice`?
We're in the same dialect, the same level of abstraction, I really don't see the argument against picking one side or the other here!

>> If you have an expand shape in the input IR: would you do the opposite transformation?
> No. IMO that is an opinionated decision. Should be left to the downstream users to pick what works for their context.

Unfortunately this isn't how MLIR Canonicalization is designed: you either canonicalize, or you don't.
Actually we expose for canonicalize an option “disable-patterns” which takes a string list of patterns to filter out which kind of does what you want.

Otherwise, feel free to propose a redesign of the system, but this is what we have!!



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


More information about the Mlir-commits mailing list