[Mlir-commits] [mlir] [mlir][linalg] Add merge consecutive linalg::reduceOp canonicalization (PR #195048)
Hocky Yudhiono
llvmlistbot at llvm.org
Thu May 7 19:01:55 PDT 2026
hockyy wrote:
> Can you provide more justification as to why this should be a canonicalization?
Background: This pass is a canonicalization from our internal downstream. We use it to:
- Reduce amount of reduce operations
- Reduce amount of intermediate buffers (after `OneShotBufferization`)
Specific usage:
- Easier reduction dimension analysis in the entire kernel (We keep track which dimension of which value is a reduction dimension)
- Another heuristic pass -- Which will gather all reduce operations and trying to compose them with a certain cost model into a compose `linalg.reduce` with multiple inits and inputs -- relies on this.
I got your point, this can be refactored to a separate pass, but I put it in canonicalizations as we want it to run alongside other patterns without declaring our own driver + pattern adder separately
https://github.com/llvm/llvm-project/pull/195048
More information about the Mlir-commits
mailing list