13
13
// CHECK: %[[MEMREF:.*]] = bufferization.to_memref %[[TENSOR]] : memref<f32>
14
14
// CHECK: %[[EXTENT:.*]] = memref.dim %[[MEMREF]], %[[INDEX]] : memref<f32>
15
15
// CHECK: return %[[EXTENT]] : index
16
- func @dim (%arg0: tensor <f32 >, %arg1: index ) -> index {
16
+ func.func @dim (%arg0: tensor <f32 >, %arg1: index ) -> index {
17
17
%0 = tensor.dim %arg0 , %arg1 : tensor <f32 >
18
18
return %0 : index
19
19
}
@@ -22,7 +22,7 @@ func @dim(%arg0: tensor<f32>, %arg1: index) -> index {
22
22
// CHECK-SAME: %[[TENSOR:.*]]: tensor<*xf32>) -> index {
23
23
// CHECK: %[[MEMREF:.*]] = bufferization.to_memref %[[TENSOR]]
24
24
// CHECK: %[[EXTENT:.*]] = memref.rank %[[MEMREF]] : memref<*xf32>
25
- func @rank (%arg0: tensor <*xf32 >) -> index {
25
+ func.func @rank (%arg0: tensor <*xf32 >) -> index {
26
26
%0 = tensor.rank %arg0 : tensor <*xf32 >
27
27
return %0 : index
28
28
}
@@ -33,7 +33,7 @@ func @rank(%arg0: tensor<*xf32>) -> index {
33
33
// CHECK: %[[CASTED:.*]] = memref.cast %[[MEMREF]] : memref<?xindex> to memref<2xindex>
34
34
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[CASTED]]
35
35
// CHECK: return %[[RET]] : tensor<2xindex>
36
- func @tensor.cast (%arg0: tensor <?xindex >) -> tensor <2 xindex > {
36
+ func.func @tensor.cast (%arg0: tensor <?xindex >) -> tensor <2 xindex > {
37
37
%0 = tensor.cast %arg0 : tensor <?xindex > to tensor <2 xindex >
38
38
return %0 : tensor <2 xindex >
39
39
}
@@ -44,7 +44,7 @@ func @tensor.cast(%arg0: tensor<?xindex>) -> tensor<2xindex> {
44
44
// CHECK: %[[CASTED_MEMREF:.*]] = memref.cast %[[MEMREF]] : memref<*xf32> to memref<2xf32>
45
45
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[CASTED_MEMREF]] : memref<2xf32>
46
46
// CHECK: return %[[RET]] : tensor<2xf32>
47
- func @tensor.cast_from_unranked (%arg0: tensor <*xf32 >) -> tensor <2 xf32 > {
47
+ func.func @tensor.cast_from_unranked (%arg0: tensor <*xf32 >) -> tensor <2 xf32 > {
48
48
%0 = tensor.cast %arg0 : tensor <*xf32 > to tensor <2 xf32 >
49
49
return %0 : tensor <2 xf32 >
50
50
}
@@ -55,7 +55,7 @@ func @tensor.cast_from_unranked(%arg0: tensor<*xf32>) -> tensor<2xf32> {
55
55
// CHECK: %[[CASTED_MEMREF:.*]] = memref.cast %[[MEMREF]] : memref<2xf32> to memref<*xf32>
56
56
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[CASTED_MEMREF]] : memref<*xf32>
57
57
// CHECK: return %[[RET]] : tensor<*xf32>
58
- func @tensor.cast_to_unranked (%arg0: tensor <2 xf32 >) -> tensor <*xf32 > {
58
+ func.func @tensor.cast_to_unranked (%arg0: tensor <2 xf32 >) -> tensor <*xf32 > {
59
59
%0 = tensor.cast %arg0 : tensor <2 xf32 > to tensor <*xf32 >
60
60
return %0 : tensor <*xf32 >
61
61
}
@@ -67,15 +67,15 @@ func @tensor.cast_to_unranked(%arg0: tensor<2xf32>) -> tensor<*xf32> {
67
67
// CHECK: %[[RET:.*]] = memref.load %[[MEMREF]][%[[IDX]]] : memref<?xf32>
68
68
// CHECK: return %[[RET]] : f32
69
69
// CHECK: }
70
- func @tensor.extract (%arg0: tensor <?xf32 >, %arg1: index ) -> f32 {
70
+ func.func @tensor.extract (%arg0: tensor <?xf32 >, %arg1: index ) -> f32 {
71
71
%0 = tensor.extract %arg0 [%arg1 ] : tensor <?xf32 >
72
72
return %0 : f32
73
73
}
74
74
75
75
// CHECK-LABEL: func @tensor.from_elements_no_elements() -> tensor<0xindex> {
76
76
// CHECK: %[[RET:.*]] = arith.constant dense<> : tensor<0xindex>
77
77
// CHECK: return %[[RET]] : tensor<0xindex>
78
- func @tensor.from_elements_no_elements () -> tensor <0 xindex > {
78
+ func.func @tensor.from_elements_no_elements () -> tensor <0 xindex > {
79
79
%0 = tensor.from_elements : tensor <0 xindex >
80
80
return %0 : tensor <0 xindex >
81
81
}
@@ -86,7 +86,7 @@ func @tensor.from_elements_no_elements() -> tensor<0xindex> {
86
86
// CHECK: store %[[ELEM0]], %[[MEMREF]]
87
87
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[MEMREF]]
88
88
// CHECK: return %[[RET]] : tensor<index>
89
- func @tensor.from_elements_0d (%arg0: index ) -> tensor <index > {
89
+ func.func @tensor.from_elements_0d (%arg0: index ) -> tensor <index > {
90
90
%0 = tensor.from_elements %arg0 : tensor <index >
91
91
return %0 : tensor <index >
92
92
}
@@ -101,7 +101,7 @@ func @tensor.from_elements_0d(%arg0: index) -> tensor<index> {
101
101
// CHECK: store %[[ELEM1]], %[[MEMREF]][%[[C1]]]
102
102
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[MEMREF]]
103
103
// CHECK: return %[[RET]] : tensor<2xindex>
104
- func @tensor.from_elements_1d (%arg0: index , %arg1: index ) -> tensor <2 xindex > {
104
+ func.func @tensor.from_elements_1d (%arg0: index , %arg1: index ) -> tensor <2 xindex > {
105
105
%0 = tensor.from_elements %arg0 , %arg1 : tensor <2 xindex >
106
106
return %0 : tensor <2 xindex >
107
107
}
@@ -121,7 +121,7 @@ func @tensor.from_elements_1d(%arg0: index, %arg1: index) -> tensor<2xindex> {
121
121
// CHECK: store %[[ELEM1]], %[[MEMREF]][%[[C2]], %[[C1]]]
122
122
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[MEMREF]]
123
123
// CHECK: return %[[RET]] : tensor<3x2xindex>
124
- func @tensor.from_elements_2d (%arg0: index , %arg1: index ) -> tensor <3 x2 xindex > {
124
+ func.func @tensor.from_elements_2d (%arg0: index , %arg1: index ) -> tensor <3 x2 xindex > {
125
125
%0 = tensor.from_elements %arg0 , %arg1 , %arg0 , %arg1 , %arg0 , %arg1
126
126
: tensor <3 x2 xindex >
127
127
return %0 : tensor <3 x2 xindex >
@@ -163,7 +163,7 @@ func @tensor.from_elements_2d(%arg0: index, %arg1: index) -> tensor<3x2xindex> {
163
163
164
164
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[MEMREF]]
165
165
// CHECK: return %[[RET]] : tensor<3x2x2xf32>
166
- func @tensor.from_elements_3d (%f0 : f32 ) -> tensor <3 x2 x2 xf32 > {
166
+ func.func @tensor.from_elements_3d (%f0 : f32 ) -> tensor <3 x2 x2 xf32 > {
167
167
%f1 = arith.constant 1.0 : f32
168
168
%f2 = arith.constant 2.0 : f32
169
169
%f3 = arith.constant 3.0 : f32
@@ -195,7 +195,7 @@ func @tensor.from_elements_3d(%f0 : f32) -> tensor<3x2x2xf32> {
195
195
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[MEMREF]] : memref<?xindex>
196
196
// CHECK: return %[[RET]] : tensor<?xindex>
197
197
// CHECK: }
198
- func @tensor.generate (%arg: tensor <*xf32 >, %dynamic_extent: index ) -> tensor <?xindex > {
198
+ func.func @tensor.generate (%arg: tensor <*xf32 >, %dynamic_extent: index ) -> tensor <?xindex > {
199
199
%result = tensor.generate %dynamic_extent {
200
200
^bb0 (%i : index ):
201
201
%elem = tensor.dim %arg , %i : tensor <*xf32 >
@@ -221,7 +221,7 @@ func @tensor.generate(%arg: tensor<*xf32>, %dynamic_extent: index) -> tensor<?xi
221
221
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[MEMREF]] : memref<16x?xindex>
222
222
// CHECK: return %[[RET]] : tensor<16x?xindex>
223
223
// CHECK: }
224
- func @tensor.generate_static_and_dynamic (%arg0: index ) -> tensor <16 x?xindex > {
224
+ func.func @tensor.generate_static_and_dynamic (%arg0: index ) -> tensor <16 x?xindex > {
225
225
%result = tensor.generate %arg0 {
226
226
^bb0 (%i: index , %j: index ):
227
227
%sum = arith.addi %i , %j : index
@@ -231,7 +231,7 @@ func @tensor.generate_static_and_dynamic(%arg0: index) -> tensor<16x?xindex> {
231
231
}
232
232
233
233
// CHECK-LABEL: func @tensor.generate_unknown_ops_in_body
234
- func @tensor.generate_unknown_ops_in_body (%arg0: index ) -> tensor <?xindex > {
234
+ func.func @tensor.generate_unknown_ops_in_body (%arg0: index ) -> tensor <?xindex > {
235
235
// CHECK-NOT: tensor.generate
236
236
%tensor = tensor.generate %arg0 {
237
237
^bb0 (%iv: index ):
@@ -244,7 +244,7 @@ func @tensor.generate_unknown_ops_in_body(%arg0: index) -> tensor<?xindex> {
244
244
245
245
// CHECK-LABEL: func @tensor.extract_slice(
246
246
// CHECK-SAME: %[[t1:.*]]: tensor<?x?xf32>, %[[idx1:.*]]: index, %[[idx2:.*]]: index
247
- func @tensor.extract_slice (
247
+ func.func @tensor.extract_slice (
248
248
%t1: tensor <?x?xf32 >, %idx1: index , %idx2: index ) -> tensor <?x10 xf32 > {
249
249
// CHECK: %[[m:.*]] = bufferization.to_memref %[[t1]] : memref<?x?xf32>
250
250
// CHECK: %[[r:.*]] = memref.subview %[[m]][5, %[[idx2]]] [%[[idx1]], 10] [1, 1] : memref<?x?xf32> to memref<?x10xf32, #[[$MAP0]]>
@@ -258,7 +258,7 @@ func @tensor.extract_slice(
258
258
// CHECK-LABEL: func @tensor.extract_slice_rank_reducing(
259
259
// CHECK-SAME: %[[t1:.*]]: tensor<?x10x?xf32>, %[[idx1:.*]]: index,
260
260
// CHECK-SAME: %[[idx2:.*]]: index
261
- func @tensor.extract_slice_rank_reducing (
261
+ func.func @tensor.extract_slice_rank_reducing (
262
262
%t1: tensor <?x10 x?xf32 >, %idx1: index , %idx2: index ) -> tensor <?x15 xf32 > {
263
263
// CHECK: %[[m1:.*]] = bufferization.to_memref %[[t1]] : memref<?x10x?xf32>
264
264
// CHECK: %[[r:.*]] = memref.subview %[[m1]][5, %[[idx1]], 10] [%[[idx2]], 1, 15] [1, 1, 1] : memref<?x10x?xf32> to memref<?x15xf32, #[[$MAP0]]>
@@ -272,7 +272,7 @@ func @tensor.extract_slice_rank_reducing(
272
272
// CHECK-LABEL: func @tensor.insert_slice(
273
273
// CHECK-SAME: %[[t1:.*]]: tensor<?x?xf32>, %[[t2:.*]]: tensor<?x10xf32>,
274
274
// CHECK-SAME: %[[idx1:.*]]: index, %[[idx2:.*]]: index
275
- func @tensor.insert_slice (%t1: tensor <?x?xf32 >, %t2: tensor <?x10 xf32 >,
275
+ func.func @tensor.insert_slice (%t1: tensor <?x?xf32 >, %t2: tensor <?x10 xf32 >,
276
276
%idx1: index , %idx2: index ) -> tensor <?x?xf32 > {
277
277
// CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index
278
278
// CHECK-DAG: %[[c1:.*]] = arith.constant 1 : index
@@ -295,7 +295,7 @@ func @tensor.insert_slice(%t1: tensor<?x?xf32>, %t2: tensor<?x10xf32>,
295
295
// CHECK-LABEL: func @tensor.insert(
296
296
// CHECK-SAME: %[[t1:.*]]: tensor<5xf32>, %[[idx1:.*]]: index,
297
297
// CHECK-SAME: %[[f:.*]]: f32
298
- func @tensor.insert (%t1: tensor <5 xf32 >, %idx1: index , %f: f32 ) -> tensor <5 xf32 > {
298
+ func.func @tensor.insert (%t1: tensor <5 xf32 >, %idx1: index , %f: f32 ) -> tensor <5 xf32 > {
299
299
// CHECK-DAG: %[[alloc:.*]] = memref.alloc() {{.*}} : memref<5xf32>
300
300
// CHECK-DAG: %[[m1:.*]] = bufferization.to_memref %[[t1]] : memref<5xf32>
301
301
// CHECK: memref.copy %[[m1]], %[[alloc]]
@@ -309,7 +309,7 @@ func @tensor.insert(%t1: tensor<5xf32>, %idx1: index, %f: f32) -> tensor<5xf32>
309
309
310
310
// CHECK-LABEL: func @tensor.expand_shape(
311
311
// CHECK-SAME: %[[t1:.*]]: tensor<?x10xf32>
312
- func @tensor.expand_shape (%t1: tensor <?x10 xf32 >) -> tensor <2 x?x10 xf32 > {
312
+ func.func @tensor.expand_shape (%t1: tensor <?x10 xf32 >) -> tensor <2 x?x10 xf32 > {
313
313
// CHECK: %[[m1:.*]] = bufferization.to_memref %[[t1]] : memref<?x10xf32>
314
314
// CHECK: %[[expanded:.*]] = memref.expand_shape %[[m1]] [
315
315
// CHECK-SAME: [0, 1], [2]] : memref<?x10xf32> into memref<2x?x10xf32>
@@ -323,7 +323,7 @@ func @tensor.expand_shape(%t1: tensor<?x10xf32>) -> tensor<2x?x10xf32> {
323
323
324
324
// CHECK-LABEL: func @tensor.expand_shape_of_slice(
325
325
// CHECK-SAME: %[[t1:.*]]: tensor<?x20xf32>
326
- func @tensor.expand_shape_of_slice (
326
+ func.func @tensor.expand_shape_of_slice (
327
327
%t1: tensor <?x20 xf32 >, %o1: index , %s1: index ) -> tensor <?x7 x2 x5 xf32 > {
328
328
// CHECK: %[[m1:.*]] = bufferization.to_memref %[[t1]] : memref<?x20xf32>
329
329
// CHECK: %[[subview:.*]] = memref.subview %[[m1]][%{{.*}}, 5] [%{{.*}}, 10] [1, 1] : memref<?x20xf32> to memref<?x10xf32, #[[$MAP1]]>
@@ -340,7 +340,7 @@ func @tensor.expand_shape_of_slice(
340
340
341
341
// CHECK-LABEL: func @tensor.expand_shape_of_slice2(
342
342
// CHECK-SAME: %[[t1:.*]]: tensor<1x2xf32>
343
- func @tensor.expand_shape_of_slice2 (%t1: tensor <1 x2 xf32 >) -> tensor <1 xf32 > {
343
+ func.func @tensor.expand_shape_of_slice2 (%t1: tensor <1 x2 xf32 >) -> tensor <1 xf32 > {
344
344
// CHECK: memref.subview {{.*}} : memref<1x2xf32> to memref<1x1xf32, #[[$MAP5]]>
345
345
%0 = tensor.extract_slice %t1 [0 , 0 ][1 , 1 ][1 , 1 ] : tensor <1 x2 xf32 > to tensor <1 x1 xf32 >
346
346
// CHECK: memref.collapse_shape %{{.*}} [
@@ -351,7 +351,7 @@ func @tensor.expand_shape_of_slice2(%t1: tensor<1x2xf32>) -> tensor<1xf32> {
351
351
352
352
// CHECK-LABEL: func @tensor.collapse_shape(
353
353
// CHECK-SAME: %[[t1:.*]]: tensor<2x?x?xf32>
354
- func @tensor.collapse_shape (%t1: tensor <2 x?x?xf32 >) -> tensor <?x?xf32 > {
354
+ func.func @tensor.collapse_shape (%t1: tensor <2 x?x?xf32 >) -> tensor <?x?xf32 > {
355
355
// CHECK: %[[m1:.*]] = bufferization.to_memref %[[t1]] : memref<2x?x?xf32>
356
356
// CHECK: %[[collapsed:.*]] = memref.collapse_shape %[[m1]] [
357
357
// CHECK-SAME: [0, 1], [2]] : memref<2x?x?xf32> into memref<?x?xf32>
@@ -365,7 +365,7 @@ func @tensor.collapse_shape(%t1: tensor<2x?x?xf32>) -> tensor<?x?xf32> {
365
365
366
366
// CHECK-LABEL: func @tensor.collapse_shape_to_scalar(
367
367
// CHECK-SAME: %[[t1:.*]]: tensor<1x1x1xf32>
368
- func @tensor.collapse_shape_to_scalar (%t1: tensor <1 x1 x1 xf32 >) -> tensor <f32 > {
368
+ func.func @tensor.collapse_shape_to_scalar (%t1: tensor <1 x1 x1 xf32 >) -> tensor <f32 > {
369
369
// CHECK: %[[m1:.*]] = bufferization.to_memref %[[t1]] : memref<1x1x1xf32>
370
370
// CHECK: %[[collapsed:.*]] = memref.collapse_shape %[[m1]] [] : memref<1x1x1xf32> into memref<f32>
371
371
%0 = tensor.collapse_shape %t1 []
@@ -377,7 +377,7 @@ func @tensor.collapse_shape_to_scalar(%t1: tensor<1x1x1xf32>) -> tensor<f32> {
377
377
}
378
378
379
379
// CHECK-LABEL: func @tensor.collapse_shape_of_slice(
380
- func @tensor.collapse_shape_of_slice (%arg0: tensor <2 xi32 >) -> tensor <i32 > {
380
+ func.func @tensor.collapse_shape_of_slice (%arg0: tensor <2 xi32 >) -> tensor <i32 > {
381
381
// CHECK: memref.subview %{{.*}}[1] [1] [1] : memref<2xi32> to memref<1xi32, #[[$MAP3]]>
382
382
%0 = tensor.extract_slice %arg0 [1 ] [1 ] [1 ] : tensor <2 xi32 > to tensor <1 xi32 >
383
383
// CHECK: memref.collapse_shape %{{.*}} [] : memref<1xi32, #[[$MAP3]]> into memref<i32, #[[$MAP4]]>
@@ -386,7 +386,7 @@ func @tensor.collapse_shape_of_slice(%arg0: tensor<2xi32>) -> tensor<i32> {
386
386
}
387
387
388
388
// CHECK-LABEL: func @tensor.collapse_shape_of_slice2(
389
- func @tensor.collapse_shape_of_slice2 (
389
+ func.func @tensor.collapse_shape_of_slice2 (
390
390
%arg0: tensor <?x?x?x?xi64 >, %o1: index , %o2: index , %o3: index , %o4: index )
391
391
-> tensor <87 x63648 xi64 > {
392
392
// CHECK: %[[subview:.*]] = memref.subview %{{.*}} : memref<?x?x?x?xi64> to memref<87x78x68x12xi64, #{{.*}}>
0 commit comments