[Mlir-commits] [mlir] [MLIR][SCF] Handle commuted indices in parallel loop fusion (PR #219665)
Mehdi Amini
llvmlistbot at llvm.org
Mon Aug 31 04:45:40 PDT 2026
================
@@ -1761,3 +1761,33 @@ func.func @do_not_fuse_distinct_dynamic_bounds(%A: memref<16xf32>,
// CHECK-LABEL: func @do_not_fuse_distinct_dynamic_bounds
// CHECK: scf.parallel
// CHECK: scf.parallel
+
+// -----
+
+func.func @fuse_commuted_indices(%arg0: memref<32xf32>,
+ %arg1: memref<32xf32>) {
+ %c0 = arith.constant 0 : index
+ %c1 = arith.constant 1 : index
+ %c16 = arith.constant 16 : index
+ %cst = arith.constant 3.000000e+00 : f32
+
+ scf.parallel (%i) = (%c0) to (%c16) step (%c1) {
+ %index = arith.addi %i, %c1 : index
+ memref.store %cst, %arg0[%index] : memref<32xf32>
+ scf.reduce
+ }
+
+ scf.parallel (%i) = (%c0) to (%c16) step (%c1) {
+ %index = arith.addi %c1, %i : index
----------------
joker-eph wrote:
We don't generally run canonicalize on every test, and shouldn't need to.
What we should avoid is make analyses and transformations more complex for handling things that are already handled in canonicalization pattern: the whole design of the compiler is the opposite, that is move things out of analyses and transformations (when possible and appropriate) into canonicalization to simplify the analyses and transformations and avoid repeating redundant work everywhere.
https://github.com/llvm/llvm-project/pull/219665
More information about the Mlir-commits
mailing list