-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Revert "[mlir][tosa] Add more error_if checks for Resize Op" #129729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit cd3d10c.
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-tosa Author: Jerry-Ge (Jerry-Ge) ChangesReverts llvm/llvm-project#129577. Need rebase to fix some errors. Full diff: https://github.com/llvm/llvm-project/pull/129729.diff 1 Files Affected:
diff --git a/mlir/test/Dialect/Tosa/error_if_check.mlir b/mlir/test/Dialect/Tosa/error_if_check.mlir
deleted file mode 100644
index 267b9c589c5b3..0000000000000
--- a/mlir/test/Dialect/Tosa/error_if_check.mlir
+++ /dev/null
@@ -1,85 +0,0 @@
-// RUN: mlir-opt %s -split-input-file -verify-diagnostics --tosa-validate="profile=pro_int,pro_fp extension=int16,int4,bf16,fp8e4m3,fp8e5m2,fft,variable,controlflow,dynamic strict-op-spec-alignment"
-
-// -----
-
-// CHECK-LABEL: test_resize_large_image_size
-func.func @test_resize_large_image_size(%arg0: tensor<1x16384x16384x8xf32>) -> tensor<1x32767x32767x8xf32> {
- %scale = tosa.const_shape { value = dense<[2, 1, 2, 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>
- // expected-error@+1 {{'tosa.resize' op expect input/output height/width dims to be < 16384, got [OH, OW, IH, IW] = 32767, 32767, 16384, 16384}}
- %1 = tosa.resize %arg0, %scale, %offset, %border { mode = "BILINEAR" } : (tensor<1x16384x16384x8xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x32767x32767x8xf32>
- return %1 : tensor<1x32767x32767x8xf32>
-}
-
-// -----
-
-// CHECK-LABEL: test_resize_invalid_scale_numerator
-func.func @test_resize_invalid_scale_numerator(%arg0: tensor<1x9x9x8xf32>) -> tensor<?x?x?x?xf32> {
- %scale = tosa.const_shape { value = dense<[2049, 8, 1, 2]> : 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>
- // expected-error@+1 {{'tosa.resize' op expect all scale numerator values to be <= (1 << 11), got scale_y_n=2049, scale_x_n=1}}
- %1 = tosa.resize %arg0, %scale, %offset, %border { mode = "BILINEAR" } : (tensor<1x9x9x8xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<?x?x?x?xf32>
- return %1 : tensor<?x?x?x?xf32>
-}
-
-// -----
-
-// CHECK-LABEL: test_resize_invalid_downscale
-func.func @test_resize_invalid_downscale(%arg0: tensor<1x37x37x8xf32>) -> tensor<?x?x?x?xf32> {
- %scale = tosa.const_shape { value = dense<[1, 18, 1, 18]> : 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>
- // expected-error@+1 {{'tosa.resize' op expect a downscale ratio larger than 1/16, got y=1/18, x=1/18}}
- %1 = tosa.resize %arg0, %scale, %offset, %border { mode = "BILINEAR" } : (tensor<1x37x37x8xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<?x?x?x?xf32>
- return %1 : tensor<?x?x?x?xf32>
-}
-
-// -----
-
-// CHECK-LABEL: test_resize_invalid_offset_y
-func.func @test_resize_invalid_offset_y(%arg0: tensor<1x8x8x8xf32>) -> tensor<?x?x?x?xf32> {
- %scale = tosa.const_shape { value = dense<[1, 1, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>
- %offset = tosa.const_shape { value = dense<[17, 0]> : tensor<2xindex> } : () -> !tosa.shape<2>
- %border = tosa.const_shape { value = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>
- // expected-error@+1 {{'tosa.resize' op expect offsetY / scaleYNumerator to be in range [-1, 16), got 17/1}}
- %1 = tosa.resize %arg0, %scale, %offset, %border { mode = "BILINEAR" } : (tensor<1x8x8x8xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<?x?x?x?xf32>
- return %1 : tensor<?x?x?x?xf32>
-}
-
-// -----
-
-// CHECK-LABEL: test_resize_invalid_offset_x
-func.func @test_resize_invalid_offset_x(%arg0: tensor<1x8x8x8xf32>) -> tensor<?x?x?x?xf32> {
- %scale = tosa.const_shape { value = dense<[1, 1, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>
- %offset = tosa.const_shape { value = dense<[0, -2]> : tensor<2xindex> } : () -> !tosa.shape<2>
- %border = tosa.const_shape { value = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>
- // expected-error@+1 {{'tosa.resize' op expect offsetX / scaleXNumerator to be in range [-1, 16), got -2/1}}
- %1 = tosa.resize %arg0, %scale, %offset, %border { mode = "BILINEAR" } : (tensor<1x8x8x8xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<?x?x?x?xf32>
- return %1 : tensor<?x?x?x?xf32>
-}
-
-// -----
-
-// CHECK-LABEL: test_resize_invalid_border_y
-func.func @test_resize_invalid_boarder_y(%arg0: tensor<1x8x8x8xf32>) -> tensor<?x?x?x?xf32> {
- %scale = tosa.const_shape { value = dense<[1, 1, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>
- %offset = tosa.const_shape { value = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>
- %border = tosa.const_shape { value = dense<[-17, 0]> : tensor<2xindex> } : () -> !tosa.shape<2>
- // expected-error@+1 {{'tosa.resize' op expect borderY / scaleYNumerator to be in range [-16, 1), got -17/1}}
- %1 = tosa.resize %arg0, %scale, %offset, %border { mode = "BILINEAR" } : (tensor<1x8x8x8xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<?x?x?x?xf32>
- return %1 : tensor<?x?x?x?xf32>
-}
-
-// -----
-
-// CHECK-LABEL: test_resize_invalid_border_x
-func.func @test_resize_invalid_boarder_x(%arg0: tensor<1x8x8x8xf32>) -> tensor<?x?x?x?xf32> {
- %scale = tosa.const_shape { value = dense<[1, 1, 1, 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, 2]> : tensor<2xindex> } : () -> !tosa.shape<2>
- // expected-error@+1 {{'tosa.resize' op expect borderX / scaleXNumerator to be in range [-16, 1), got 2/1}}
- %1 = tosa.resize %arg0, %scale, %offset, %border { mode = "BILINEAR" } : (tensor<1x8x8x8xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<?x?x?x?xf32>
- return %1 : tensor<?x?x?x?xf32>
-}
|
jph-13
pushed a commit
to jph-13/llvm-project
that referenced
this pull request
Mar 21, 2025
…9729) Reverts llvm#129577. Need rebase to fix some errors.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #129577. Need rebase to fix some errors.