[Mlir-commits] [mlir] [mlir][tosa] Enhance TosaInferShapes pass for simple shape inference (PR #178418)

Luke Hutton llvmlistbot at llvm.org
Thu Jan 29 08:03:41 PST 2026


================
@@ -1164,7 +1166,7 @@ func.func @resize_negative_output_dim(%arg0: tensor<1x3x1x1xi8>) {
   %scale = tosa.const_shape { values = dense<[1, 3, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>
   %offset = tosa.const_shape { values = dense<[6, 1]> : tensor<2xindex> } : () -> !tosa.shape<2>
   %border = tosa.const_shape { values = dense<[-15, 0]> : tensor<2xindex> } : () -> !tosa.shape<2>
-  // expected-error at +1 {{calculated output height and width must be non-negative, got height = -5, width = 0}}
+  // expected-error at below {{calculated output height and width must be non-negative, got height = -5, width = 0}}
----------------
lhutton1 wrote:

This test supports the check added here: https://github.com/llvm/llvm-project/blob/ac454a2706540e2957396c0eaeea1888b8e03934/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp#L2980 which helps to prevent a shape inference attempting to construct a ranked tensor of negative dims.

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


More information about the Mlir-commits mailing list