From 4f4411b22dc0a8ed4f0b23f048af94355f7b1221 Mon Sep 17 00:00:00 2001 From: Tai Ly Date: Tue, 7 Jan 2025 01:04:52 +0000 Subject: [PATCH] [mlir][tosa] add test of scalar mul op This patch adds a lit test for mul op of scalar input1 and input2 but rank-1 shift operand to make sure output is still scalar Signed-off-by: Tai Ly Change-Id: Id3de91ec8258f8c241b6163125a32e72489ed79f --- mlir/test/Dialect/Tosa/ops.mlir | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir index 4a7e48ea702bf..cd73377c7f587 100644 --- a/mlir/test/Dialect/Tosa/ops.mlir +++ b/mlir/test/Dialect/Tosa/ops.mlir @@ -346,7 +346,15 @@ func.func @test_mul_scalar_with_unranked_output(%arg0: tensor, %arg1: tenso } // ----- -// CHECK-LABEL: mul +// CHECK-LABEL: test_mul_scalar +func.func @test_mul_scalar(%arg0: tensor, %arg1: tensor) -> tensor { + %shift = "tosa.const"() <{value = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8> + %0 = tosa.mul %arg0, %arg1, %shift : (tensor, tensor, tensor<1xi8>) -> tensor + return %0 : tensor +} + +// ----- +// CHECK-LABEL: test_mul func.func @test_mul(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x1x3xf32>) -> tensor<13x21x3xf32> { %shift = "tosa.const"() <{value = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8> %0 = tosa.mul %arg0, %arg1, %shift : (tensor<13x21x3xf32>, tensor<13x1x3xf32>, tensor<1xi8>) -> tensor<13x21x3xf32>