@@ -100,16 +100,15 @@ func.func @test_add_0d(%arg0: tensor<f32>, %arg1: tensor<f32>) -> tensor<f32> {
100
100
101
101
// -----
102
102
103
- // CHECK: #[[$MAP0:.+]] = affine_map<(d0, d1) -> (d0, 0)>
104
- // CHECK: #[[$MAP1:.+]] = affine_map<(d0, d1) -> (0, 0)>
105
- // CHECK: #[[$MAP2:.+]] = affine_map<(d0, d1) -> (d0, d1)>
103
+ // CHECK: #[[$MAP0:.+]] = affine_map<(d0, d1) -> (d0, d1)>
104
+ // CHECK: #[[$MAP1:.+]] = affine_map<(d0, d1) -> (0, d1)>
106
105
107
106
// CHECK-LABEL: func.func @test_add_0d_broadcast(
108
107
// CHECK-SAME: %[[ARG0:.*]]: tensor<2x1xf32>,
109
108
// CHECK-SAME: %[[ARG1:.*]]: tensor<f32>) -> tensor<2x1xf32> {
110
109
// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[ARG1]] [] output_shape [1, 1] : tensor<f32> into tensor<1x1xf32>
111
110
// CHECK: %[[EMPTY_TENSOR:.*]] = tensor.empty() : tensor<2x1xf32>
112
- // CHECK: %[[RESULT:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]], #[[$MAP2 ]]], iterator_types = ["parallel", "parallel"]} ins(%[[ARG0]], %[[EXPANDED]] : tensor<2x1xf32>, tensor<1x1xf32>) outs(%[[EMPTY_TENSOR]] : tensor<2x1xf32>) {
111
+ // CHECK: %[[RESULT:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]], #[[$MAP0 ]]], iterator_types = ["parallel", "parallel"]} ins(%[[ARG0]], %[[EXPANDED]] : tensor<2x1xf32>, tensor<1x1xf32>) outs(%[[EMPTY_TENSOR]] : tensor<2x1xf32>) {
113
112
// CHECK: ^bb0(%[[IN0:.*]]: f32, %[[IN1:.*]]: f32, %[[OUT:.*]]: f32):
114
113
// CHECK: %[[ADD:.*]] = arith.addf %[[IN0]], %[[IN1]] : f32
115
114
// CHECK: linalg.yield %[[ADD]] : f32
@@ -253,6 +252,26 @@ func.func @test_add_1d_broadcast_static_to_static(%arg0: tensor<1xf32>, %arg1: t
253
252
254
253
// -----
255
254
255
+ // CHECK: #[[$MAP:.+]] = affine_map<(d0) -> (d0)>
256
+ // CHECK-LABEL: @test_add_1d_matching_no_broadcast
257
+ // CHECK-SAME: %[[ARG0:[0-9a-zA-Z_]*]]:
258
+ // CHECK-SAME: %[[ARG1:[0-9a-zA-Z_]*]]:
259
+ func.func @test_add_1d_matching_no_broadcast (%arg0: tensor <1 xf32 >, %arg1: tensor <1 xf32 >) -> tensor <1 xf32 > {
260
+
261
+ // CHECK: %[[VAL_0:.*]] = tensor.empty() : tensor<1xf32>
262
+ // CHECK: %[[RESULT:.*]] = linalg.generic {indexing_maps = [#[[$MAP]], #[[$MAP]], #[[$MAP]]], iterator_types = ["parallel"]} ins(%[[ARG0]], %[[ARG1]] : tensor<1xf32>, tensor<1xf32>) outs(%[[VAL_0]] : tensor<1xf32>) {
263
+ // CHECK: ^bb0(%[[VAL_1:.*]]: f32, %[[VAL_2:.*]]: f32, %[[VAL_3:.*]]: f32):
264
+ // CHECK: %[[VAL_4:.*]] = arith.addf %[[VAL_1]], %[[VAL_2]] : f32
265
+ // CHECK: linalg.yield %[[VAL_4]] : f32
266
+ // CHECK: } -> tensor<1xf32>
267
+ %0 = tosa.add %arg0 , %arg1 : (tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 xf32 >
268
+
269
+ // CHECK: return %[[RESULT]] : tensor<1xf32>
270
+ return %0 : tensor <1 xf32 >
271
+ }
272
+
273
+ // -----
274
+
256
275
// CHECK: #[[$MAP0:.+]] = affine_map<(d0) -> (d0)>
257
276
// CHECK-LABEL: @test_add_1d_matching_static
258
277
// CHECK-SAME: %[[ARG0:[0-9a-zA-Z_]*]]:
@@ -1969,13 +1988,12 @@ func.func @test_dynamic_fft2d(%arg0: tensor<?x?x?xf32>, %arg1: tensor<?x?x?xf32>
1969
1988
1970
1989
// -----
1971
1990
1972
- // CHECK: #[[$MAP0:.+]] = affine_map<(d0) -> (0)>
1973
- // CHECK: #[[$MAP1:.+]] = affine_map<(d0) -> (d0)>
1991
+ // CHECK: #[[$MAP0:.+]] = affine_map<(d0) -> (d0)>
1974
1992
1975
1993
// CHECK-LABEL: func.func @test_cast_fp32_i64(
1976
1994
// CHECK-SAME: %[[ARG0:.*]]: tensor<1xf32>) -> tensor<1xi64> {
1977
1995
// CHECK: %[[EMPTY_TENSOR:.*]] = tensor.empty() : tensor<1xi64>
1978
- // CHECK: %[[RESULT:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1 ]]], iterator_types = ["parallel"]} ins(%[[ARG0]] : tensor<1xf32>) outs(%[[EMPTY_TENSOR]] : tensor<1xi64>) {
1996
+ // CHECK: %[[RESULT:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP0 ]]], iterator_types = ["parallel"]} ins(%[[ARG0]] : tensor<1xf32>) outs(%[[EMPTY_TENSOR]] : tensor<1xi64>) {
1979
1997
// CHECK: ^bb0(%[[IN:.*]]: f32, %[[OUT:.*]]: i64):
1980
1998
// CHECK: %[[ROUND_EVEN:.*]] = math.roundeven %[[IN]] : f32
1981
1999
// CHECK: %[[FP_INT_MIN:.*]] = arith.constant -9.22337203E+18 : f32
0 commit comments