Skip to content

Arm backend: Support for dynamic shapes and fix resize bugs #11310

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 3 commits into from
Jun 6, 2025

Conversation

Burton2000
Copy link
Contributor

@Burton2000 Burton2000 commented Jun 3, 2025

Dynamic shapes are detected when converting torch shapes to TOSA shapes, when they contain SymInts rather than regular ints. These are converted to -1s as this is how TOSA represents dynamic shapes.

The resize op needs special handling for dynamic shapes, and will only work when all of the TOSA parameters (scale n/d, offset, border) work out to be constant values independent of the shape.

Also fix bug where align_corners was always set to True, when it should be False

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218

Signed-off-by: Richard Burton [email protected]
Co-authored-by: Robert Hughes @Rob-Hughes-Arm

Dynamic shapes are detected when converting torch shapes to TOSA shapes, when they contain SymInts rather than regular ints.
These are converted to -1s as this is how TOSA represents dynamic shapes.

The resize op needs special handling for dynamic shapes, and will only work when all of the TOSA parameters (scale n/d, offset, border) work out to be constant values independent of the shape.

Also fix bug where align_corners was always set to True, when it should be False

Signed-off-by: Richard Burton <[email protected]>

Change-Id: Ibce3d5f8d62b3c450a00e5b61975d3cf97ff2c69
@Burton2000 Burton2000 requested a review from digantdesai as a code owner June 3, 2025 12:10
Copy link

pytorch-bot bot commented Jun 3, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11310

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures

As of commit fc97a9b with merge base a69e28e (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 3, 2025
@Burton2000
Copy link
Contributor Author

@pytorchbot label ciflow/trunk

Copy link

pytorch-bot bot commented Jun 3, 2025

To add these label(s) (ciflow/trunk) to the PR, please first approve the workflows that are awaiting approval (scroll to the bottom of this page).

This helps ensure we don't trigger CI on this PR until it is actually authorized to do so. Please ping one of the reviewers if you do not have access to approve and run workflows.

@gggekov gggekov added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm topic: not user facing ciflow/trunk labels Jun 3, 2025
Copy link

pytorch-bot bot commented Jun 3, 2025

To add the ciflow label ciflow/trunk please first approve the workflows that are awaiting approval (scroll to the bottom of this page).

This helps ensure we don't trigger CI on this PR until it is actually authorized to do so. Please ping one of the reviewers if you do not have access to approve and run workflows.

@pytorch-bot pytorch-bot bot removed the ciflow/trunk label Jun 3, 2025
@zingo zingo added release notes: arm Changes to the ARM backend delegate ciflow/trunk and removed topic: not user facing labels Jun 3, 2025
Copy link

pytorch-bot bot commented Jun 3, 2025

To add the ciflow label ciflow/trunk please first approve the workflows that are awaiting approval (scroll to the bottom of this page).

This helps ensure we don't trigger CI on this PR until it is actually authorized to do so. Please ping one of the reviewers if you do not have access to approve and run workflows.

@zingo
Copy link
Collaborator

zingo commented Jun 3, 2025

This PR caused a strange lintrunner error so I rebased it to check if it helped.

@zingo
Copy link
Collaborator

zingo commented Jun 4, 2025

@Burton2000 unfortunately it didn't help, it seems this PR cause some lint problems. Without looking at it it might be that one of you changes in a generic class get error when used so if you tests locally you might not see it if you only check changed files in the patch e.g. you might need to use lintrunner without args if you used something like
lintrunner --revision 'HEAD^' -a

Change-Id: I269a9d1dd789bd866eaa46b641fee47ba231b8fc
@Burton2000
Copy link
Contributor Author

Looking better now?

@zingo
Copy link
Collaborator

zingo commented Jun 6, 2025

Looking better now?

Yes but there is a fail in a Arm backend test now :(

@zingo
Copy link
Collaborator

zingo commented Jun 6, 2025

It was
backends/arm/test/models/test_deit_tiny_arm.py
It seems a bit flakey I think the atol might need a bump as it seem to fail now and then, I retriggered the test for you.

@zingo
Copy link
Collaborator

zingo commented Jun 6, 2025

MacOS fails are unrelated as this delegate don't build or run on it.

@zingo zingo merged commit 50f7376 into pytorch:main Jun 6, 2025
262 of 266 checks passed
@Burton2000 Burton2000 deleted the dynamic branch June 6, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: arm Changes to the ARM backend delegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants