[Mlir-commits] [mlir] [mlir][memref] canonicalization for erasing copying subview to identical subview (PR #125852)
Matthias Gehre
llvmlistbot at llvm.org
Fri Feb 28 02:22:46 PST 2025
mgehre-amd wrote:
> > If the two subview operations are same, why wouldn't they cse to the same operation?
>
> See above, only a canonicalize->cse->canonicalize will do the same.
>
> > You could implement the same canonicalization for any two duplicate operations.
>
> Maybe there are others with a similar potential. What is the implication of this statement?
I guess the question is, why can't you run `canonicalize->cse->canonicalize` to solve this problem?
If you approach this problem by pure canonicalization, you will eventually recreate all functionality of CSE within this canonicalization pattern. E.g. what if the memref.copy has two operands that are both an equivalent `memref.expand_shape`? Or both are an equivalent `memref.collapse_shape`? Or both are an identical chain of `expand_shape` + `subview`. This would require even more code in this canonicalization pattern, where the problem is already solved today by running `canonicalize->cse->canonicalize`.
https://github.com/llvm/llvm-project/pull/125852
More information about the Mlir-commits
mailing list