[Mlir-commits] [mlir] [mlir] Canonicalize tensor.extract_slice (linalg.fill) (PR #112619)

Stella Laurenzo llvmlistbot at llvm.org
Sun Oct 20 18:27:48 PDT 2024


stellaraccident wrote:

> Thanks for the comments. I agree with @banach-space that this might not fit into a canonicalization pattern when the `FillOp` has multiple consumers introducing additional buffer allocation.
> 
> I've changed the pattern to fold only when there's one consumer of the `FillOp`.

I really don't want to add to this thread, but I am skeptical that this qualifies if restricted to a single consumer: that doesn't actually simplify any downstream matching because now a compiler still has to pattern match all of the variants. I could imagine arguments why this might be the case, but having run into a lot of these fragile single-consumer optimizations trying to fly as a canonicalized, I an default skeptical.

If the multi use case is a canonical form, then so be it. But I expect that Mahesh is right that the actual optimization being sought here is a full graph transformation where the graph is put into a form such that some of these ops are maximally "bubbled". That is an optimization. The effect can be approximated by the canonicalized but it is typically not the right tool for the job, ime.

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


More information about the Mlir-commits mailing list