2020-03-17 21:16:33 +08:00
|
|
|
// RUN: onnx-mlir-opt %s -mlir-print-op-generic | FileCheck -check-prefix=GENERIC %s
|
|
|
|
// RUN: onnx-mlir-opt %s | FileCheck %s
|
2019-11-28 11:56:34 +08:00
|
|
|
|
2020-04-16 15:17:27 +08:00
|
|
|
// -----
|
|
|
|
|
2020-01-21 01:30:08 +08:00
|
|
|
// GENERIC-DAG: #{{.*}} = affine_map<() -> (0)>
|
|
|
|
// GENERIC-DAG: #{{.*}} = affine_map<() -> (10)>
|
|
|
|
// GENERIC-DAG: #{{.*}} = affine_map<() -> (1)>
|
|
|
|
// GENERIC-DAG: #{{.*}} = affine_map<() -> (11)>
|
|
|
|
// GENERIC-DAG: #{{.*}} = affine_map<(d0, d1) -> (d0 - d1)>
|
|
|
|
// GENERIC-DAG: #{{.*}} = affine_map<(d0, d1) -> (d0 + d1)>
|
2019-11-28 11:56:34 +08:00
|
|
|
|
|
|
|
func @simple_iterate(%N : index) {
|
|
|
|
%ii, %ij, %ik = krnl.define_loops 3
|
|
|
|
|
|
|
|
// GENERIC: "krnl.iterate"(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) ( {
|
|
|
|
// GENERIC-NEXT: ^bb0(%{{.*}}: index, %{{.*}}: index):
|
|
|
|
// GENERIC-NEXT: "krnl.terminate"() : () -> ()
|
|
|
|
// GENERIC-NEXT: bounds = [#{{.*}}, #{{.*}}, #{{.*}}, #{{.*}}]
|
|
|
|
|
|
|
|
// CHECK: krnl.iterate(%{{.*}}, %{{.*}}) with (%{{.*}} -> %{{.*}} = 0 to 10, %{{.*}} -> %{{.*}} = 1 to 11) {
|
2020-07-08 12:49:15 +08:00
|
|
|
krnl.iterate(%ii, %ij) with (%ii -> %i = 0 to 10, %ij -> %j = 1 to 11) {
|
2019-11-28 11:56:34 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// GENERIC: "krnl.iterate"(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) ( {
|
|
|
|
// GENERIC-NEXT: ^bb0(%{{.*}}: index, %{{.*}}: index):
|
|
|
|
// CHECK: krnl.iterate(%{{.*}}, %{{.*}}) with (%{{.*}} -> %{{.*}} = 0 to 10, %{{.*}} -> %{{.*}} = 0 to 10) {
|
2020-07-08 12:49:15 +08:00
|
|
|
krnl.iterate(%ii, %ij) with (%ii -> %i = 0 to 10, %ij -> %j = 0 to 10) {
|
2019-11-28 11:56:34 +08:00
|
|
|
// GENERIC: "krnl.iterate"(%{{.*}}, %{{.*}}) ( {
|
|
|
|
// GENERIC-NEXT: ^bb0(%{{.*}}: index):
|
|
|
|
// CHECK: krnl.iterate(%{{.*}}) with (%{{.*}} -> %{{.*}} = 0 to 10) {
|
2020-07-08 12:49:15 +08:00
|
|
|
krnl.iterate(%ik) with (%ik -> %k = 0 to 10) {
|
2019-11-28 11:56:34 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GENERIC: "krnl.iterate"(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) ( {
|
|
|
|
// GENERIC-NEXT: ^bb0(%{{.*}}: index, %{{.*}}: index):
|
|
|
|
// CHECK: krnl.iterate(%{{.*}}, %{{.*}}) with (%{{.*}} -> %{{.*}} = 0 to %{{.*}}, %{{.*}} -> %{{.*}} = 0 to 10) {
|
2020-07-08 12:49:15 +08:00
|
|
|
krnl.iterate(%ii, %ij) with (%ii -> %i = 0 to %N, %ij -> %j = 0 to 10) {
|
2019-11-28 11:56:34 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-04-16 15:17:27 +08:00
|
|
|
// -----
|
|
|
|
|
2019-11-28 11:56:34 +08:00
|
|
|
func @affine_map_bound(%N : index) {
|
|
|
|
%ii, %ij, %ik = krnl.define_loops 3
|
|
|
|
|
|
|
|
// GENERIC: "krnl.iterate"(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) ( {
|
|
|
|
// GENERIC-NEXT: ^bb0(%{{.*}}: index, %{{.*}}: index):
|
|
|
|
// CHECK: krnl.iterate(%{{.*}}, %{{.*}}) with (%{{.*}} -> %{{.*}} = 0 to 10, %{{.*}} -> %{{.*}} = 0 to 10) {
|
2020-07-08 12:49:15 +08:00
|
|
|
krnl.iterate(%ii, %ij) with (%ii -> %i = affine_map<()->(0)>() to affine_map<()->(10)>(), %ij -> %j = 0 to 10) {
|
2019-11-28 11:56:34 +08:00
|
|
|
// GENERIC: "krnl.iterate"(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) ( {
|
|
|
|
// GENERIC-NEXT: ^bb0(%{{.*}}: index):
|
|
|
|
// CHECK: krnl.iterate(%{{.*}}) with (%{{.*}} -> %{{.*}} = #{{.*}}(%{{.*}}, %{{.*}}) to #{{.*}}(%{{.*}}, %{{.*}})) {
|
2020-07-08 12:49:15 +08:00
|
|
|
krnl.iterate(%ik) with (%ik -> %k = affine_map<(d0, d1)->(d0 - d1)>(%i, %j) to affine_map<(d0, d1)->(d0 + d1)>(%i, %j)) {
|
2019-11-28 11:56:34 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// GENERIC: "krnl.iterate"(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) ( {
|
|
|
|
// GENERIC-NEXT: ^bb0(%{{.*}}: index):
|
|
|
|
// CHECK: krnl.iterate(%{{.*}}) with (%{{.*}} -> %{{.*}} = max #map{{.*}}(%{{.*}}, %{{.*}}) to min #map{{.*}}(%{{.*}}, %{{.*}})[%{{.*}}]) {
|
2020-07-08 12:49:15 +08:00
|
|
|
krnl.iterate(%ik) with (%ik -> %k = max affine_map<(d0, d1)->(d0 - d1, 0)>(%i, %j) to min affine_map<(d0, d1)[s0]->(d0 + d1, s0)>(%i, %j)[%N]) {
|
2019-11-28 11:56:34 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
2020-04-16 15:17:27 +08:00
|
|
|
}
|