[Mlir-commits] [mlir] [MLIR][SCF] Add canonicalization pattern to fold away iter args of scf.forall (PR #90189)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed May 1 17:01:57 PDT 2024
================
@@ -1509,6 +1510,203 @@ class ForallOpControlOperandsFolder : public OpRewritePattern<ForallOp> {
}
};
+/// The following canonicalization pattern folds the iter arguments of
+/// scf.forall op if :-
+/// 1. The corresponding result has zero uses.
+/// 2. The iter argument is NOT being modified within the loop body.
+/// uses.
+///
+/// Example of first case :-
+/// INPUT:
+/// %res:3 = scf.forall ... shared_outs(%arg0 = %a, %arg1 = %b, %arg2 = %c)
+/// {
+/// ...
+/// <SOME USE OF %arg0>
----------------
MaheshRavishankar wrote:
I dont know the semantics of things yet if you use a shared_outs in anything apart from the `store_op` in the `scf.forall.in_parallel`. I'd just check for a single use in the `scf.forall.in_parallel` (and as said in the other comment, just check for the use being a `tensor.insert_in_parallel`)
https://github.com/llvm/llvm-project/pull/90189
More information about the Mlir-commits
mailing list