[Mlir-commits] [mlir] [mlir] Allow unroll & jam on SCF loops with results (PR #98887)
Javier Setoain
llvmlistbot at llvm.org
Tue Jul 16 02:33:14 PDT 2024
================
@@ -336,6 +336,33 @@ module attributes {transform.with_named_sequence} {
// -----
+// CHECK-LABEL: @loop_unroll_and_jam_loop_with_results
+func.func @loop_unroll_and_jam_loop_with_results() -> index {
+ // CHECK: %[[LB:.*]] = arith.constant 0
+ // CHECK: %[[UB:.*]] = arith.constant 40
+ // CHECK: %[[STEP:.*]] = arith.constant 8
+ %c0 = arith.constant 0 : index
+ %c40 = arith.constant 40 : index
+ %c2 = arith.constant 2 : index
+ // CHECK: %[[RES:[a-zA-Z0-9]+]]:4 = scf.for %[[I:.*]] = %[[LB]] to %[[UB]] step %[[STEP]]
+ %sum = scf.for %i = %c0 to %c40 step %c2 iter_args(%does_not_alias_aggregated = %c0) -> (index) {
----------------
jsetoain wrote:
I've added a somewhat more complex test extracted from a common use-case. You can see the use of `iter_args` in a parallel loop. They superficially look like a loop-carried dependency, but the insertion/extraction of slices in the tensor occur in different places for each tuple of iterator values in the outermost loops; the dependency is real only in the innermost loop. The peculiar tensor "pass down" pattern in the `iter_args` should disappear after bufferization.
https://github.com/llvm/llvm-project/pull/98887
More information about the Mlir-commits
mailing list