[Mlir-commits] [mlir] fa0b01a - [mlir][scf] Test forall promotion with multiple inserts (#232920)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Oct 17 13:00:39 PDT 2026


Author: Akimasa Watanuki
Date: 2026-10-17T15:00:34-05:00
New Revision: fa0b01a70bdd8c6af6288bb6ca597d71783ca4ba

URL: https://github.com/llvm/llvm-project/commit/fa0b01a70bdd8c6af6288bb6ca597d71783ca4ba
DIFF: https://github.com/llvm/llvm-project/commit/fa0b01a70bdd8c6af6288bb6ca597d71783ca4ba.diff

LOG: [mlir][scf] Test forall promotion with multiple inserts (#232920)

Cover #231826 by checking that disjoint insertions into one shared
output are chained into a single result.

Assisted-by: Codex / GPT-6

Added: 
    

Modified: 
    mlir/test/Dialect/SCF/canonicalize.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/Dialect/SCF/canonicalize.mlir b/mlir/test/Dialect/SCF/canonicalize.mlir
index 05795ac63cfc98..bd8c35ad882501 100644
--- a/mlir/test/Dialect/SCF/canonicalize.mlir
+++ b/mlir/test/Dialect/SCF/canonicalize.mlir
@@ -2437,3 +2437,21 @@ func.func @promote_partial_outputs(%a: tensor<2xf32>, %b: tensor<2xf32>, %init_a
   }
   return %r#0, %r#1 : tensor<4xf32>, tensor<4xf32>
 }
+
+// -----
+
+// Disjoint insertions into one shared output must contribute to one result.
+// CHECK-LABEL: func @promote_multiple_inserts
+//  CHECK-SAME:   (%[[A:.*]]: tensor<2xf32>, %[[B:.*]]: tensor<2xf32>, %[[INIT:.*]]: tensor<4xf32>)
+//       CHECK:   %[[FIRST:.*]] = tensor.insert_slice %[[B]] into %[[INIT]][2] [2] [1]
+//       CHECK:   %[[SECOND:.*]] = tensor.insert_slice %[[A]] into %[[FIRST]][0] [2] [1]
+//       CHECK:   return %[[SECOND]] : tensor<4xf32>
+func.func @promote_multiple_inserts(%a: tensor<2xf32>, %b: tensor<2xf32>, %init: tensor<4xf32>) -> tensor<4xf32> {
+  %r = scf.forall () in () shared_outs(%out = %init) -> tensor<4xf32> {
+    scf.forall.in_parallel {
+      tensor.parallel_insert_slice %a into %out[0] [2] [1] : tensor<2xf32> into tensor<4xf32>
+      tensor.parallel_insert_slice %b into %out[2] [2] [1] : tensor<2xf32> into tensor<4xf32>
+    }
+  }
+  return %r : tensor<4xf32>
+}


        


More information about the Mlir-commits mailing list