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

Mehdi Amini llvmlistbot at llvm.org
Thu Oct 17 16:01:02 PDT 2024


joker-eph wrote:

> Like Andrej said, it depends on whether for a compiler stack a linalg.fill -> extract_slice is better or a two linalg.fills are better. I think it is an opinionated decision

Sorry but that's not a principled way to think about canonicalization: this actually a perfect example of why we need canonicalization. If the two forms can be equally well matched, the canonicalization is here so that a compiler does not have to match both but can match a single one. 
A "compiler stack" cannot just expect something to be "better" without a principled argument, hence the question about semantic loss.

> if someone has an issue with it being one, then id be fine moving it out of canonicalization.

Sure, I'd want to hear a principled reason about why it's not a good one (that is "it is not alway possible to match the new canonical form", or "we lost some important information from the original program"). This should always be possible to express with an example of input IR and the intended lowering.


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


More information about the Mlir-commits mailing list