[Mlir-commits] [mlir] [mlir][Linalg]: Add rewrite pattern to fuse fill with reduce operations (PR #125401)

Aviad Cohen llvmlistbot at llvm.org
Sun Feb 2 21:09:26 PST 2025


AviadCo wrote:

Hey @MaheshRavishankar ,
We are using tile and fuse transform in addition to the regular linalg fusion.
When lowered to loops, I would like to acheive the following pseudo-code:
```
for (int i = 0; i < N; ++i) {
    int sum = 0;
    for (j = 0; j < M; ++j) {
        int x = load[i][j];
        sum += x;
    }
}
```
I can lower the linalg.generic of fill and reduce into loops and do it then but at that point the flow is much more complicated to identify the pattern of fill + reduce.
This pattern is useful for us although it causes none fully nested loops.
Moreover, our HW know how to handle such calculations although it is not fully nested loops.

I do have some patterns to optimize the none nested loops after the lowering but it is more HW specific.

I think that some other people might use this tranformation pattern as well as I do.

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


More information about the Mlir-commits mailing list