3
3
// CHECK-LABEL: @dim_const
4
4
// CHECK: %[[ret:.+]] = arith.constant 3 : index
5
5
// CHECK: return %[[ret]]
6
- func.func @dim_const (%m : tensor <3 x5 xi32 >) -> index {
6
+ func.func @dim_const (%t : tensor <3 x5 xi32 >) -> index {
7
7
%c0 = arith.constant 0 : index
8
- %0 = tensor.dim %m , %c0 : tensor <3 x5 xi32 >
8
+ %0 = tensor.dim %t , %c0 : tensor <3 x5 xi32 >
9
9
return %0 : index
10
10
}
11
11
@@ -15,8 +15,8 @@ func.func @dim_const(%m: tensor<3x5xi32>) -> index {
15
15
// CHECK: %[[op:.+]] = tensor.dim
16
16
// CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 5 : index, smin = 3 : index, umax = 5 : index, umin = 3 : index} %[[op]]
17
17
// CHECK: return %[[ret]]
18
- func.func @dim_any_static (%m : tensor <3 x5 xi32 >, %x: index ) -> index {
19
- %0 = tensor.dim %m , %x : tensor <3 x5 xi32 >
18
+ func.func @dim_any_static (%t : tensor <3 x5 xi32 >, %x: index ) -> index {
19
+ %0 = tensor.dim %t , %x : tensor <3 x5 xi32 >
20
20
%1 = test.reflect_bounds %0 : index
21
21
return %1 : index
22
22
}
@@ -27,9 +27,9 @@ func.func @dim_any_static(%m: tensor<3x5xi32>, %x: index) -> index {
27
27
// CHECK: %[[op:.+]] = tensor.dim
28
28
// CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 9223372036854775807 : index, smin = 0 : index, umax = 9223372036854775807 : index, umin = 0 : index} %[[op]]
29
29
// CHECK: return %[[ret]]
30
- func.func @dim_dynamic (%m : tensor <?x5 xi32 >) -> index {
30
+ func.func @dim_dynamic (%t : tensor <?x5 xi32 >) -> index {
31
31
%c0 = arith.constant 0 : index
32
- %0 = tensor.dim %m , %c0 : tensor <?x5 xi32 >
32
+ %0 = tensor.dim %t , %c0 : tensor <?x5 xi32 >
33
33
%1 = test.reflect_bounds %0 : index
34
34
return %1 : index
35
35
}
@@ -40,8 +40,8 @@ func.func @dim_dynamic(%m: tensor<?x5xi32>) -> index {
40
40
// CHECK: %[[op:.+]] = tensor.dim
41
41
// CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 9223372036854775807 : index, smin = 0 : index, umax = 9223372036854775807 : index, umin = 0 : index} %[[op]]
42
42
// CHECK: return %[[ret]]
43
- func.func @dim_any_dynamic (%m : tensor <?x5 xi32 >, %x: index ) -> index {
44
- %0 = tensor.dim %m , %x : tensor <?x5 xi32 >
43
+ func.func @dim_any_dynamic (%t : tensor <?x5 xi32 >, %x: index ) -> index {
44
+ %0 = tensor.dim %t , %x : tensor <?x5 xi32 >
45
45
%1 = test.reflect_bounds %0 : index
46
46
return %1 : index
47
47
}
@@ -52,10 +52,23 @@ func.func @dim_any_dynamic(%m: tensor<?x5xi32>, %x: index) -> index {
52
52
// CHECK: %[[op:.+]] = tensor.dim
53
53
// CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 5 : index, smin = 3 : index, umax = 5 : index, umin = 3 : index} %[[op]]
54
54
// CHECK: return %[[ret]]
55
- func.func @dim_some_omitting_dynamic (%m : tensor <?x3 x5 xi32 >, %x: index ) -> index {
55
+ func.func @dim_some_omitting_dynamic (%t : tensor <?x3 x5 xi32 >, %x: index ) -> index {
56
56
%c1 = arith.constant 1 : index
57
57
%0 = arith.maxsi %x , %c1 : index
58
- %1 = tensor.dim %m , %0 : tensor <?x3 x5 xi32 >
58
+ %1 = tensor.dim %t , %0 : tensor <?x3 x5 xi32 >
59
59
%2 = test.reflect_bounds %1 : index
60
60
return %2 : index
61
61
}
62
+
63
+ // -----
64
+
65
+ // CHECK-LABEL: @dim_unranked
66
+ // CHECK: %[[op:.+]] = tensor.dim
67
+ // CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 9223372036854775807 : index, smin = 0 : index, umax = 9223372036854775807 : index, umin = 0 : index} %[[op]]
68
+ // CHECK: return %[[ret]]
69
+ func.func @dim_unranked (%t: tensor <*xi32 >) -> index {
70
+ %c0 = arith.constant 0 : index
71
+ %0 = tensor.dim %t , %c0 : tensor <*xi32 >
72
+ %1 = test.reflect_bounds %0 : index
73
+ return %1 : index
74
+ }
0 commit comments