environments:
Ubuntu 22.04 / LLVM-19.1.0-Linux-X64
commit id:a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4
bash command:
mlir-opt -pass-pipeline="builtin.module(func.func(tosa-to-linalg))" ../input/input.mlir -o ../output/res.mlir
test case:
func.func @test_mul(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x1x3xf32>) -> tensor<13x21x3xf32> {
%0 = tosa.mul %arg0, %arg1 {shift = 1 : i8} : (tensor<13x21x3xf32>, tensor<13x1x3xf32>) -> tensor<13x21x3xf32>
return %0 : tensor<13x21x3xf32>
}
error:
/home/workdir/input/input.mlir:2:8: error: failed to legalize operation 'tosa.mul'
%0 = tosa.mul %arg0, %arg1 {shift = 1 : i8} : (tensor<13x21x3xf32>, tensor<13x1x3xf32>) -> tensor<13x21x3xf32>
^
/home/workdir/input/manual_input.mlir:2:8: note: see current operation: %0 = "tosa.mul"(%arg0, %arg1) <{shift = 1 : i8}> : (tensor<13x21x3xf32>, tensor<13x1x3xf32>) -> tensor<13x21x3xf32>
But this pass works fine for following input file(change {shift = 1 : i8} to {shift = 0 : i8}):
func.func @test_mul(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x1x3xf32>) -> tensor<13x21x3xf32> {
%0 = tosa.mul %arg0, %arg1 {shift = 0 : i8} : (tensor<13x21x3xf32>, tensor<13x1x3xf32>) -> tensor<13x21x3xf32>
return %0 : tensor<13x21x3xf32>
}