[Mlir-commits] [mlir] [mlir][tosa] Support unranked input/weight tensors for convolution ops (PR #134856)

Luke Hutton llvmlistbot at llvm.org
Thu Apr 24 02:43:32 PDT 2025


================
@@ -33,19 +33,9 @@ func.func @test_conv2d(%arg0: tensor<1x29x29x4xf32>, %arg1: tensor<16x3x3x4xi8>,
 
 // -----
 
-func.func @test_conv2d(%arg0: tensor<*xi8>, %arg1: tensor<16x3x3x4xi8>, %arg2: tensor<16xi8>) -> tensor<1x27x27x16xi8> {
-  %zp = "tosa.const"() {values = dense<0> : tensor<1xi8>} : () -> tensor<1xi8>
-  // expected-error at +1 {{'tosa.conv2d' op expect a ranked tensor for input, got <block argument> of type 'tensor<*xi8>' at index: 0}}
-  %0 = tosa.conv2d %arg0, %arg1, %arg2, %zp, %zp {acc_type = i32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 0, 0, 0>, stride = array<i64: 1, 1>}
-           : (tensor<*xi8>, tensor<16x3x3x4xi8>, tensor<16xi8>, tensor<1xi8>, tensor<1xi8>) -> tensor<1x27x27x16xi8>
-  return %0 : tensor<1x27x27x16xi8>
-}
-
-// -----
-
 func.func @test_conv2d(%arg0: tensor<1x29x29x4xi8>, %arg1: tensor<*xi8>, %arg2: tensor<16xi8>) -> tensor<1x27x27x16xi8> {
   %zp = "tosa.const"() {values = dense<0> : tensor<1xi8>} : () -> tensor<1xi8>
-  // expected-error at +1 {{'tosa.conv2d' op operand #1 must be 4D tensor of 4-bit signless integer or 8-bit signless integer or Quint8 type or Qint4 type or Qint8 type or Qint16 type or Qint32 type or floating-point values, but got 'tensor<*xi8>'}}
+  // expected-error at +1 {{'tosa.conv2d' op illegal: operand/result data types not supported}}
----------------
lhutton1 wrote:

Indeed, this is a consequence of the issue now being caught in the validation pass as opposed to coming from the type definition. The validation pass check tries to match the current datatype combinations (i8, i8, i8, i8) with a list of known good combinations from the spec. I suspect we could improve this new error message such that it lists the legal datatype combinations, but it might be better off as a separate PR?

https://github.com/llvm/llvm-project/pull/134856


More information about the Mlir-commits mailing list