1 // RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.module(func.func(test-scf-parallel-loop-collapsing{collapsed-indices-0=0,3 collapsed-indices-1=1,4 collapsed-indices-2=2}, canonicalize))' --mlir-print-local-scope | FileCheck %s
3 // CHECK: func @parallel_many_dims() {
4 func.func @parallel_many_dims() {
5 %c0 = arith.constant 0 : index
6 %c1 = arith.constant 1 : index
7 %c2 = arith.constant 2 : index
8 %c3 = arith.constant 3 : index
9 %c4 = arith.constant 4 : index
10 %c5 = arith.constant 5 : index
11 %c6 = arith.constant 6 : index
12 %c7 = arith.constant 7 : index
13 %c8 = arith.constant 8 : index
14 %c9 = arith.constant 9 : index
15 %c10 = arith.constant 10 : index
16 %c11 = arith.constant 11 : index
17 %c12 = arith.constant 12 : index
18 %c13 = arith.constant 13 : index
19 %c14 = arith.constant 14 : index
20 %c15 = arith.constant 15 : index
21 %c26 = arith.constant 26 : index
23 scf.parallel (%i0, %i1, %i2, %i3, %i4) = (%c0, %c3, %c6, %c9, %c12)
24 to (%c2, %c5, %c8, %c26, %c14) step (%c1, %c4, %c7, %c10, %c13) {
25 %result = "magic.op"(%i0, %i1, %i2, %i3, %i4)
26 : (index, index, index, index, index) -> index
31 // CHECK-DAG: %[[C3:.*]] = arith.constant 3 : index
32 // CHECK-DAG: %[[C6:.*]] = arith.constant 6 : index
33 // CHECK-DAG: %[[C12:.*]] = arith.constant 12 : index
34 // CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index
35 // CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index
36 // CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index
37 // CHECK-DAG: %[[C4:.*]] = arith.constant 4 : index
38 // CHECK: scf.parallel (%[[NEW_I0:.*]]) = (%[[C0]]) to (%[[C4]]) step (%[[C1]]) {
39 // CHECK: %[[V0:.*]] = arith.remsi %[[NEW_I0]], %[[C2]] : index
40 // CHECK: %[[I0:.*]] = arith.divsi %[[NEW_I0]], %[[C2]] : index
41 // CHECK: %[[I3:.*]] = affine.apply affine_map<(d0) -> (d0 * 10 + 9)>(%[[V0]])
42 // CHECK: "magic.op"(%[[I0]], %[[C3]], %[[C6]], %[[I3]], %[[C12]]) : (index, index, index, index, index) -> index