[Mlir-commits] [mlir] [mlir][tosa] Make TOSA RESIZE's scale, offset, border as Input (PR #124956)

Luke Hutton llvmlistbot at llvm.org
Thu Feb 13 12:02:38 PST 2025


================
@@ -38,71 +50,22 @@ func.func @unary_resize_bilinear_fp16(%arg0 : tensor<3x1x1x7xf16>) -> tensor<3x1
 
 // CHECK-LABEL: @unary_resize_nearest_i8
 func.func @unary_resize_nearest_i8(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x1x1x7xi8> {
-  %resize = "tosa.resize"(%arg0) {mode = "NEAREST_NEIGHBOR", scale = array<i64: 2, 1, 3, 1>, offset = array<i64: 0, 0>, border = array<i64: 0, 0>} : (tensor<3x1x1x7xi8>) -> tensor<3x1x1x7xi8>
+  %scale = tosa.const_shape { value = dense<[2, 1, 3, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>
+  %offset = tosa.const_shape { value = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>
+  %border = tosa.const_shape { value = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>
+  %resize = tosa.resize %arg0, %scale, %offset, %border {mode = "NEAREST_NEIGHBOR"} : (tensor<3x1x1x7xi8>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x1x7xi8>
   // CHECK: return %arg0
   return %resize : tensor<3x1x1x7xi8>
 }
 
 // -----
 
-// CHECK-LABEL: @broadcast_resize_nearest_f32
-func.func @broadcast_resize_nearest_f32(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x1x5x7xf32> {
----------------
lhutton1 wrote:

Apologies, there might have been some confusion here. If the intention of keeping `MaterializeResizeBroadcast` was to avoid breaking things for other users that potentially rely on the broadcasting functionality, I think we’d need to make sure the tests that have been replaced don’t have any changes to them (in particular aren’t checking for an expected error). Currently someone that relies on this broadcasting functionality will hit the same error which may break existing flows.

My thinking was to make an exception in the verifier so that it doesn’t check the output shape when broadcasting is involved. We can then repeat this check in the validation pass without the exception to properly check we conform to the specification

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


More information about the Mlir-commits mailing list