[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
Thu May 2 15:00:41 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 still dont think the semantics of the operation is well defined when a shared-outs is used anywhere outside of the `scf.forall.in_parallel` region. So for now, unless you need it (in which case i'd like to know more), better to narrow the usage for cases where the shared outs is used only once and in the `scf.forall.in_parallel` region.
https://github.com/llvm/llvm-project/pull/90189
More information about the Mlir-commits
mailing list