[Mlir-commits] [mlir] [mlir][linalg][elementwise] Fold broadcast into new elementwise (PR #167626)
Rolf Morel
llvmlistbot at llvm.org
Wed Dec 17 06:51:14 PST 2025
https://github.com/rolfmorel approved this pull request.
Great work -- looks really clean and makes good use of the GreedyRewriter to keep on folding up to a fixed point (with arbitrary long chains of transposes and broadcasts on an elementwise's operand)! 🙂
I will second @jopperm and @javedabsar1's call for restricting the folding to projected permutations (i.e. needing the map for the operand of elementwise to already be a projected permutation), at least for now. We can expand this later if there's a need.
For controllability, the projected permutation restriction might help as then we could always unfold again via DecomposeGenericByUnfoldingPermutation. Whether the controllability should be on this PR's patterns or DecomposeGenericByUnfoldingPermutation is something a follow-up PR could address. That is, having `-linalg-fold-into-elementwise` be fully greedy for now is fine by me.
On the topic of follow-ups: couldn't the same folding be applied to elementwise's result?
In any case, please wait for @jopperm and either of @javedabsar1 or @rengolin to approve before merging.
https://github.com/llvm/llvm-project/pull/167626
More information about the Mlir-commits
mailing list