Skip to content

Commit 22f5268

Browse files
authored
[mlir][tosa] Add infer shape test of scalar mul op (#128091)
This adds a tosa-infer-shapes test for scalar mul op Signed-off-by: Tai Ly <[email protected]>
1 parent 204dcaf commit 22f5268

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,3 +1479,13 @@ func.func @test_multiple_non_inferrable_consumers(%arg0: tensor<1x2x8xf32>) {
14791479
%expanded_1 = tensor.expand_shape %0 [[0], [1, 2], [3]] output_shape [%dim, 1, 4, 8] : tensor<?x2x8xf32> into tensor<?x1x2x8xf32>
14801480
return
14811481
}
1482+
1483+
// -----
1484+
// CHECK-LABEL: test_mul_scalar
1485+
func.func @test_mul_scalar(%arg0: tensor<f32>, %arg1: tensor<f32>) -> tensor<*xf32> {
1486+
// CHECK: %[[SHIFT:.*]] = "tosa.const"() <{value = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8>
1487+
// CHECK: tosa.mul %arg0, %arg1, %[[SHIFT]] : (tensor<f32>, tensor<f32>, tensor<1xi8>) -> tensor<f32>
1488+
%shift = "tosa.const"() <{value = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8>
1489+
%0 = tosa.mul %arg0, %arg1, %shift : (tensor<f32>, tensor<f32>, tensor<1xi8>) -> tensor<*xf32>
1490+
return %0 : tensor<*xf32>
1491+
}

0 commit comments

Comments
 (0)