@@ -94,6 +94,7 @@ func.func @test_add_0d(%arg0: tensor<f32>, %arg1: tensor<f32>) -> tensor<f32> {
94
94
// CHECK: } -> tensor<f32>
95
95
%0 = tosa.add %arg0 , %arg1 : (tensor <f32 >, tensor <f32 >) -> tensor <f32 >
96
96
97
+
97
98
// CHECK: return [[RESULT]] : tensor<f32>
98
99
return %0 : tensor <f32 >
99
100
}
@@ -123,20 +124,20 @@ func.func @test_add_uint8(%arg0: tensor<ui8>, %arg1: tensor<ui8>) -> tensor<ui8>
123
124
// CHECK: #[[$MAP0:.+]] = affine_map<(d0, d1) -> (d0, d1)>
124
125
// CHECK: #[[$MAP1:.+]] = affine_map<(d0, d1) -> (0, d1)>
125
126
126
- // CHECK-LABEL: func.func @test_add_0d_broadcast (
127
+ // CHECK-LABEL: func.func @test_add_2d_broadcast (
127
128
// CHECK-SAME: %[[ARG0:.*]]: tensor<2x1xf32>,
128
- // CHECK-SAME: %[[ARG1:.*]]: tensor<f32>) -> tensor<2x1xf32> {
129
- // CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[ARG1]] [] output_shape [1, 1] : tensor<f32> into tensor<1x1xf32>
129
+ // CHECK-SAME: %[[ARG1:.*]]: tensor<1x1xf32>) -> tensor<2x1xf32> {
130
130
// CHECK: %[[EMPTY_TENSOR:.*]] = tensor.empty() : tensor<2x1xf32>
131
- // 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>) {
131
+ // CHECK: %[[RESULT:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]], #[[$MAP0]]], iterator_types = ["parallel", "parallel"]} ins(%[[ARG0]], %[[ARG1 ]] : tensor<2x1xf32>, tensor<1x1xf32>) outs(%[[EMPTY_TENSOR]] : tensor<2x1xf32>) {
132
132
// CHECK: ^bb0(%[[IN0:.*]]: f32, %[[IN1:.*]]: f32, %[[OUT:.*]]: f32):
133
133
// CHECK: %[[ADD:.*]] = arith.addf %[[IN0]], %[[IN1]] : f32
134
134
// CHECK: linalg.yield %[[ADD]] : f32
135
135
// CHECK: } -> tensor<2x1xf32>
136
136
// CHECK: return %[[RESULT]] : tensor<2x1xf32>
137
137
// CHECK: }
138
- func.func @test_add_0d_broadcast (%arg0: tensor <2 x1 xf32 >, %arg1: tensor <f32 >) -> tensor <2 x1 xf32 > {
139
- %0 = tosa.add %arg0 , %arg1 : (tensor <2 x1 xf32 >, tensor <f32 >) -> tensor <2 x1 xf32 >
138
+ func.func @test_add_2d_broadcast (%arg0: tensor <2 x1 xf32 >, %arg1: tensor <1 x1 xf32 >) -> tensor <2 x1 xf32 > {
139
+ // tosa element-wise operators now require operands of equal ranks
140
+ %0 = tosa.add %arg0 , %arg1 : (tensor <2 x1 xf32 >, tensor <1 x1 xf32 >) -> tensor <2 x1 xf32 >
140
141
return %0 : tensor <2 x1 xf32 >
141
142
}
142
143
@@ -403,28 +404,6 @@ func.func @test_add_2d_all_dynamic(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32
403
404
404
405
// -----
405
406
406
- // CHECK: #[[$MAP0:.+]] = affine_map<(d0, d1, d2) -> (0, d1, d2)>
407
- // CHECK: #[[$MAP1:.+]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
408
- // CHECK-LABEL: @test_add_2d_different_ranks
409
- // CHECK-SAME: %[[ARG0:[0-9a-zA-Z_]*]]:
410
- // CHECK-SAME: %[[ARG1:[0-9a-zA-Z_]*]]:
411
- func.func @test_add_2d_different_ranks (%arg0: tensor <3 x4 xf32 >, %arg1: tensor <2 x3 x4 xf32 >) -> tensor <2 x3 x4 xf32 > {
412
-
413
- // CHECK: %[[ARG0_EXPANDED:.*]] = tensor.expand_shape %[[ARG0]] {{\[\[}}0, 1], [2]] output_shape [1, 3, 4] : tensor<3x4xf32> into tensor<1x3x4xf32>
414
- // CHECK: %[[VAL_0:.*]] = tensor.empty() : tensor<2x3x4xf32>
415
- // CHECK: %[[RESULT:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]], #[[$MAP1]]], iterator_types = ["parallel", "parallel", "parallel"]} ins(%[[ARG0_EXPANDED]], %[[ARG1]] : tensor<1x3x4xf32>, tensor<2x3x4xf32>) outs(%[[VAL_0]] : tensor<2x3x4xf32>) {
416
- // CHECK: ^bb0(%[[VAL_1:.*]]: f32, %[[VAL_2:.*]]: f32, %[[VAL_3:.*]]: f32):
417
- // CHECK: %[[VAL_4:.*]] = arith.addf %[[VAL_1]], %[[VAL_2]] : f32
418
- // CHECK: linalg.yield %[[VAL_4]] : f32
419
- // CHECK: } -> tensor<2x3x4xf32>
420
- %0 = tosa.add %arg0 , %arg1 : (tensor <3 x4 xf32 >, tensor <2 x3 x4 xf32 >) -> tensor <2 x3 x4 xf32 >
421
-
422
- // CHECK: return %[[RESULT]] : tensor<2x3x4xf32>
423
- return %0 : tensor <2 x3 x4 xf32 >
424
- }
425
-
426
- // -----
427
-
428
407
// CHECK: #[[$MAP0:.+]] = affine_map<(d0, d1) -> (d0, 0)>
429
408
// CHECK: #[[$MAP1:.+]] = affine_map<(d0, d1) -> (d0, d1)>
430
409
// CHECK-LABEL: @test_select_2d_one_dynamic
0 commit comments