File: make-isolated-from-above.mlir

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (115 lines) | stat: -rw-r--r-- 6,638 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// RUN: mlir-opt -test-make-isolated-from-above=simple -allow-unregistered-dialect --split-input-file %s | FileCheck %s
// RUN: mlir-opt -test-make-isolated-from-above=clone-ops-with-no-operands -allow-unregistered-dialect --split-input-file %s | FileCheck %s --check-prefix=CLONE1
// RUN: mlir-opt -test-make-isolated-from-above=clone-ops-with-operands -allow-unregistered-dialect --split-input-file %s | FileCheck %s --check-prefix=CLONE2

func.func @make_isolated_from_above_single_block(%arg0 : index, %arg1 : index) {
  %c0 = arith.constant 0: index
  %c1 = arith.constant 1 : index
  %empty = tensor.empty(%arg0, %arg1) : tensor<?x?xf32>
  %d0 = tensor.dim %empty, %c0 : tensor<?x?xf32>
  %d1 = tensor.dim %empty, %c1 : tensor<?x?xf32>
  "test.one_region_with_operands_op"() ({
    "foo.yield"(%c0, %c1, %d0, %d1) : (index, index, index, index) -> ()
  }) : () -> ()
  return
}
// CHECK-LABEL: func @make_isolated_from_above_single_block(
//  CHECK-SAME:     %[[ARG0:[a-zA-Z0-9]+]]: index
//  CHECK-SAME:     %[[ARG1:[a-zA-Z0-9]+]]: index
//   CHECK-DAG:   %[[C0:.+]] = arith.constant 0 : index
//   CHECK-DAG:   %[[C1:.+]] = arith.constant 1 : index
//   CHECK-DAG:   %[[EMPTY:.+]] = tensor.empty(%[[ARG0]], %[[ARG1]])
//   CHECK-DAG:   %[[D0:.+]] = tensor.dim %[[EMPTY]], %[[C0]]
//   CHECK-DAG:   %[[D1:.+]] = tensor.dim %[[EMPTY]], %[[C1]]
//       CHECK:   test.isolated_one_region_op %[[C0]], %[[C1]], %[[D0]], %[[D1]]
//  CHECK-NEXT:     ^bb0(%[[B0:[a-zA-Z0-9]+]]: index, %[[B1:[a-zA-Z0-9]+]]: index, %[[B2:[a-zA-Z0-9]+]]: index, %[[B3:[a-zA-Z0-9]+]]: index)
//       CHECK:       "foo.yield"(%[[B0]], %[[B1]], %[[B2]], %[[B3]])

// CLONE1-LABEL: func @make_isolated_from_above_single_block(
//  CLONE1-SAME:     %[[ARG0:[a-zA-Z0-9]+]]: index
//  CLONE1-SAME:     %[[ARG1:[a-zA-Z0-9]+]]: index
//   CLONE1-DAG:   %[[C0:.+]] = arith.constant 0 : index
//   CLONE1-DAG:   %[[C1:.+]] = arith.constant 1 : index
//   CLONE1-DAG:   %[[EMPTY:.+]] = tensor.empty(%[[ARG0]], %[[ARG1]])
//   CLONE1-DAG:   %[[D0:.+]] = tensor.dim %[[EMPTY]], %[[C0]]
//   CLONE1-DAG:   %[[D1:.+]] = tensor.dim %[[EMPTY]], %[[C1]]
//       CLONE1:   test.isolated_one_region_op %[[D0]], %[[D1]]
//  CLONE1-NEXT:     ^bb0(%[[B0:[a-zA-Z0-9]+]]: index, %[[B1:[a-zA-Z0-9]+]]: index)
//   CLONE1-DAG:       %[[C0_0:.+]] = arith.constant 0 : index
//   CLONE1-DAG:       %[[C1_0:.+]] = arith.constant 1 : index
//       CLONE1:       "foo.yield"(%[[C0_0]], %[[C1_0]], %[[B0]], %[[B1]])

// CLONE2-LABEL: func @make_isolated_from_above_single_block(
//  CLONE2-SAME:     %[[ARG0:[a-zA-Z0-9]+]]: index
//  CLONE2-SAME:     %[[ARG1:[a-zA-Z0-9]+]]: index
//       CLONE2:   test.isolated_one_region_op %[[ARG0]], %[[ARG1]]
//  CLONE2-NEXT:     ^bb0(%[[B0:[a-zA-Z0-9]+]]: index, %[[B1:[a-zA-Z0-9]+]]: index)
//   CLONE2-DAG:       %[[C0:.+]] = arith.constant 0 : index
//   CLONE2-DAG:       %[[C1:.+]] = arith.constant 1 : index
//   CLONE2-DAG:       %[[EMPTY:.+]] = tensor.empty(%[[B0]], %[[B1]])
//   CLONE2-DAG:       %[[D0:.+]] = tensor.dim %[[EMPTY]], %[[C0]]
//   CLONE2-DAG:       %[[D1:.+]] = tensor.dim %[[EMPTY]], %[[C1]]
//       CLONE2:       "foo.yield"(%[[C0]], %[[C1]], %[[D0]], %[[D1]])

// -----

func.func @make_isolated_from_above_multiple_blocks(%arg0 : index, %arg1 : index, %arg2 : index) {
  %c0 = arith.constant 0: index
  %c1 = arith.constant 1 : index
  %empty = tensor.empty(%arg0, %arg1) : tensor<?x?xf32>
  %d0 = tensor.dim %empty, %c0 : tensor<?x?xf32>
  %d1 = tensor.dim %empty, %c1 : tensor<?x?xf32>
  "test.one_region_with_operands_op"(%arg2) ({
    ^bb0(%b0 : index):
      cf.br ^bb1(%b0: index)
    ^bb1(%b1 : index):
    "foo.yield"(%c0, %c1, %d0, %d1, %b1) : (index, index, index, index, index) -> ()
  }) : (index) -> ()
  return
}
// CHECK-LABEL: func @make_isolated_from_above_multiple_blocks(
//  CHECK-SAME:     %[[ARG0:[a-zA-Z0-9]+]]: index
//  CHECK-SAME:     %[[ARG1:[a-zA-Z0-9]+]]: index
//  CHECK-SAME:     %[[ARG2:[a-zA-Z0-9]+]]: index
//   CHECK-DAG:   %[[C0:.+]] = arith.constant 0 : index
//   CHECK-DAG:   %[[C1:.+]] = arith.constant 1 : index
//   CHECK-DAG:   %[[EMPTY:.+]] = tensor.empty(%[[ARG0]], %[[ARG1]])
//   CHECK-DAG:   %[[D0:.+]] = tensor.dim %[[EMPTY]], %[[C0]]
//   CHECK-DAG:   %[[D1:.+]] = tensor.dim %[[EMPTY]], %[[C1]]
//       CHECK:   test.isolated_one_region_op %[[ARG2]], %[[C0]], %[[C1]], %[[D0]], %[[D1]]
//  CHECK-NEXT:     ^bb0(%[[B0:[a-zA-Z0-9]+]]: index, %[[B1:[a-zA-Z0-9]+]]: index, %[[B2:[a-zA-Z0-9]+]]: index, %[[B3:[a-zA-Z0-9]+]]: index, %[[B4:[a-zA-Z0-9]+]]: index)
//  CHECK-NEXT:       cf.br ^bb1(%[[B0]] : index)
//       CHECK:     ^bb1(%[[B5:.+]]: index)
//       CHECK:       "foo.yield"(%[[B1]], %[[B2]], %[[B3]], %[[B4]], %[[B5]])

// CLONE1-LABEL: func @make_isolated_from_above_multiple_blocks(
//  CLONE1-SAME:     %[[ARG0:[a-zA-Z0-9]+]]: index
//  CLONE1-SAME:     %[[ARG1:[a-zA-Z0-9]+]]: index
//  CLONE1-SAME:     %[[ARG2:[a-zA-Z0-9]+]]: index
//   CLONE1-DAG:   %[[C0:.+]] = arith.constant 0 : index
//   CLONE1-DAG:   %[[C1:.+]] = arith.constant 1 : index
//   CLONE1-DAG:   %[[EMPTY:.+]] = tensor.empty(%[[ARG0]], %[[ARG1]])
//   CLONE1-DAG:   %[[D0:.+]] = tensor.dim %[[EMPTY]], %[[C0]]
//   CLONE1-DAG:   %[[D1:.+]] = tensor.dim %[[EMPTY]], %[[C1]]
//       CLONE1:   test.isolated_one_region_op %[[ARG2]], %[[D0]], %[[D1]]
//  CLONE1-NEXT:     ^bb0(%[[B0:[a-zA-Z0-9]+]]: index, %[[B1:[a-zA-Z0-9]+]]: index, %[[B2:[a-zA-Z0-9]+]]: index)
//   CLONE1-DAG:       %[[C0_0:.+]] = arith.constant 0 : index
//   CLONE1-DAG:       %[[C1_0:.+]] = arith.constant 1 : index
//  CLONE1-NEXT:       cf.br ^bb1(%[[B0]] : index)
//       CLONE1:     ^bb1(%[[B3:.+]]: index)
//       CLONE1:       "foo.yield"(%[[C0_0]], %[[C1_0]], %[[B1]], %[[B2]], %[[B3]])

// CLONE2-LABEL: func @make_isolated_from_above_multiple_blocks(
//  CLONE2-SAME:     %[[ARG0:[a-zA-Z0-9]+]]: index
//  CLONE2-SAME:     %[[ARG1:[a-zA-Z0-9]+]]: index
//  CLONE2-SAME:     %[[ARG2:[a-zA-Z0-9]+]]: index
//       CLONE2:   test.isolated_one_region_op %[[ARG2]], %[[ARG0]], %[[ARG1]]
//  CLONE2-NEXT:     ^bb0(%[[B0:[a-zA-Z0-9]+]]: index, %[[B1:[a-zA-Z0-9]+]]: index, %[[B2:[a-zA-Z0-9]+]]: index)
//   CLONE2-DAG:       %[[C0:.+]] = arith.constant 0 : index
//   CLONE2-DAG:       %[[C1:.+]] = arith.constant 1 : index
//   CLONE2-DAG:       %[[EMPTY:.+]] = tensor.empty(%[[B1]], %[[B2]])
//   CLONE2-DAG:       %[[D0:.+]] = tensor.dim %[[EMPTY]], %[[C0]]
//   CLONE2-DAG:       %[[D1:.+]] = tensor.dim %[[EMPTY]], %[[C1]]
//  CLONE2-NEXT:       cf.br ^bb1(%[[B0]] : index)
//       CLONE2:     ^bb1(%[[B3:.+]]: index)
//       CLONE2:       "foo.yield"(%[[C0]], %[[C1]], %[[D0]], %[[D1]], %[[B3]])