1// RUN: mlir-opt %s --transform-interpreter --split-input-file --verify-diagnostics | FileCheck %s 2 3func.func private @callee(%i: index, %j: index) 4 5// CHECK-LABEL: @two_iters 6// CHECK-SAME: %[[UB1:.+]]: index, %[[UB2:.+]]: index 7func.func @two_iters(%ub1: index, %ub2: index) { 8 scf.forall (%i, %j) in (%ub1, %ub2) { 9 func.call @callee(%i, %j) : (index, index) -> () 10 } 11 // CHECK: scf.for %[[IV1:.+]] = %{{.*}} to %[[UB1]] 12 // CHECK: scf.for %[[IV2:.+]] = %{{.*}} to %[[UB2]] 13 // CHECK: func.call @callee(%[[IV1]], %[[IV2]]) 14 return 15} 16 17module attributes {transform.with_named_sequence} { 18 transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) { 19 %0 = transform.structured.match ops{["scf.forall"]} in %arg0 : (!transform.any_op) -> !transform.any_op 20 transform.loop.forall_to_for %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) 21 transform.yield 22 } 23} 24 25// ----- 26 27func.func private @callee(%i: index, %j: index) 28 29func.func @repeated(%ub1: index, %ub2: index) { 30 scf.forall (%i, %j) in (%ub1, %ub2) { 31 func.call @callee(%i, %j) : (index, index) -> () 32 } 33 scf.forall (%i, %j) in (%ub1, %ub2) { 34 func.call @callee(%i, %j) : (index, index) -> () 35 } 36 return 37} 38 39module attributes {transform.with_named_sequence} { 40 transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) { 41 %0 = transform.structured.match ops{["scf.forall"]} in %arg0 : (!transform.any_op) -> !transform.any_op 42 // expected-error @below {{expected a single payload op}} 43 transform.loop.forall_to_for %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) 44 transform.yield 45 } 46} 47 48// ----- 49 50func.func private @callee(%i: index, %j: index) 51 52func.func @repeated(%ub1: index, %ub2: index) { 53 // expected-note @below {{payload op}} 54 scf.forall (%i, %j) in (%ub1, %ub2) { 55 func.call @callee(%i, %j) : (index, index) -> () 56 } 57 return 58} 59 60module attributes {transform.with_named_sequence} { 61 transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) { 62 %0 = transform.structured.match ops{["scf.forall"]} in %arg0 : (!transform.any_op) -> !transform.any_op 63 // expected-error @below {{op expects as many results (1) as payload has induction variables (2)}} 64 transform.loop.forall_to_for %0 : (!transform.any_op) -> !transform.any_op 65 transform.yield 66 } 67} 68 69// ----- 70 71// expected-note @below {{payload op}} 72func.func private @callee(%i: index, %j: index) 73 74module attributes {transform.with_named_sequence} { 75 transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) { 76 %0 = transform.structured.match ops{["func.func"]} in %arg0 : (!transform.any_op) -> !transform.any_op 77 // expected-error @below {{expected the payload to be scf.forall}} 78 transform.loop.forall_to_for %0 : (!transform.any_op) -> !transform.any_op 79 transform.yield 80 } 81} 82