[Mlir-commits] [mlir] [mlir][linalg][elementwise] Fold broadcast into new elementwise (PR #167626)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Nov 16 16:06:13 PST 2025


someoneinjd wrote:

Thank you all for the feedback.

I have updated the PR based on your suggestions. The pattern now handles the case where the elementwise op has an existing non-identity map (like a transpose).

The implementation now uses `AffineMap::compose` to combine the `elementwise` op's existing indexing map with the map from the `broadcast` / `transpose` op.

I've also added some new test cases that covers this composition logic, similar to the `elementwise(transpose(broadcast(x)))` example that was discussed.

Could you please take another look when you have a chance? I'd appreciate knowing if this implementation is on the right track.

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


More information about the Mlir-commits mailing list