[Mlir-commits] [mlir] 62c209b - [mlir][tosa] add test of scalar mul op (#128088)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Feb 20 15:51:37 PST 2025


Author: Tai Ly
Date: 2025-02-20T15:51:33-08:00
New Revision: 62c209b728d4babbc0009dc681a31e175c2505b6

URL: https://github.com/llvm/llvm-project/commit/62c209b728d4babbc0009dc681a31e175c2505b6
DIFF: https://github.com/llvm/llvm-project/commit/62c209b728d4babbc0009dc681a31e175c2505b6.diff

LOG: [mlir][tosa] add test of scalar mul op (#128088)

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 <tai.ly at arm.com>

Added: 
    

Modified: 
    mlir/test/Dialect/Tosa/ops.mlir

Removed: 
    


################################################################################
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<f32>, %arg1: tenso
 }
 
 // -----
-// CHECK-LABEL: mul
+// CHECK-LABEL: test_mul_scalar
+func.func @test_mul_scalar(%arg0: tensor<f32>, %arg1: tensor<f32>) -> tensor<f32> {
+  %shift = "tosa.const"() <{value = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8>
+  %0 = tosa.mul %arg0, %arg1, %shift : (tensor<f32>, tensor<f32>, tensor<1xi8>) -> tensor<f32>
+  return %0 : tensor<f32>
+}
+
+// -----
+// 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>


        


More information about the Mlir-commits mailing list