Arm backend: Validate TOSA resize parameters#19757
Conversation
Re-upload with BUCK changes. Share TOSA RESIZE parameter validation between upsample support checks and fake RESIZE lowering so invalid nearest and bilinear resize parameters are rejected before delegation. Signed-off-by: Per Held <per.held@arm.com> Change-Id: I57c267aca96d733879ae90329267e44adce399c6
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19757
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 3 Unrelated FailuresAs of commit fd3a3e7 with merge base ee4c90a ( NEW FAILURE - The following job has failed:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Pull request overview
This PR centralizes TOSA RESIZE parameter validation so upsample support checks and fake RESIZE lowering reject the same invalid nearest/bilinear resize cases before delegation.
Changes:
- Adds shared RESIZE validation and output-shape calculation helpers.
- Wires fake TOSA RESIZE and upsample operator support checks to the shared validation.
- Adds tests for invalid 1/16 downscale and scale numerator limits, plus build target updates.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
backends/arm/tosa/resize_utils.py |
Adds shared TOSA RESIZE validation and output size calculation utilities. |
backends/arm/tosa/dialect/ops/resize.py |
Reuses shared validation and output-shape calculation in fake RESIZE. |
backends/arm/operator_support/upsample_support.py |
Applies shared validation to nearest and bilinear upsample support checks. |
backends/arm/tosa/BUCK |
Adds the resize_utils Python target. |
backends/arm/tosa/dialect/BUCK |
Adds dependency on resize_utils. |
backends/arm/operator_support/TARGETS |
Adds dependency on resize_utils. |
backends/arm/test/ops/test_upsample_nearest2d.py |
Adds coverage for rejecting exact 1/16 nearest downscale delegation. |
backends/arm/test/misc/tosa_dialect/test_tosa_resize.py |
Expands fake RESIZE validation tests for nearest/bilinear and numerator limits. |
Comments suppressed due to low confidence (2)
backends/arm/tosa/resize_utils.py:85
- When any scale component is symbolic,
_validate_scalereturns before checking the concrete components for positivity, numerator limits, ratio limits, or the downscale floor. A mixed symbolic scale with a concrete invalid denominator or numerator can therefore bypass validation and later either fail during fake shape calculation or emit invalid TOSA. Please validate the concrete elements independently and defer only comparisons that genuinely depend on symbolic values.
scale_ints = _as_concrete_ints(scale)
if scale_ints is None:
return None
backends/arm/tosa/resize_utils.py:250
- Returning as soon as
scale_intsisNoneskips offset, border, and output-shape validation for mixed symbolic cases, even when one axis has fully concrete scale/offset/border values. This allows concrete invalid parameters on that axis to pass support checks and fake RESIZE validation. Consider validating each axis independently and only skipping the checks whose operands are symbolic.
if scale_ints is None:
return None
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zingo
left a comment
There was a problem hiding this comment.
OK to merge, added file but buck2 files have been updated.
|
@metascroy Hi! This is the revert of the revert but I have added buck things. Can you see if this works for your internal CI? |
I've kicked off an internal test run. |
|
@rascani has imported this pull request. If you are a Meta employee, you can view this in D106382504. |
Looks good! Thanks for fixing that @perheld! |
Re-upload with BUCK changes.
Share TOSA RESIZE parameter validation between upsample support checks and fake RESIZE lowering so invalid nearest and bilinear resize parameters are rejected before delegation.
Change-Id: I57c267aca96d733879ae90329267e44adce399c6
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani