-
Notifications
You must be signed in to change notification settings - Fork 722
Qualcomm AI Engine Direct - VIT Optimization #15696
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15696
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New Failures, 1 Cancelled Job, 4 Unrelated FailuresAs of commit da35397 with merge base d07a49a ( NEW FAILURES - The following jobs have failed:
CANCELLED JOB - The following job was cancelled. Please retry:
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. |
This PR needs a
|
|
Hi @cccclai, |
|
|
||
| # Copied from torch/nn/functional.py | ||
| # QNN does not have 5D permute optimization. Fuse to a single 4D optimization | ||
| # Changed unsqueeze(0).transpose(0, -2).squeeze(-2) to permute(2, 0, 1, 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be a pass ideally, is it correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This can be a pass. If this pattern occurs frequently in the future, we will see if there's a better way to do this.
cccclai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh just saw that you mentioned the pattern is a bit hard to generalize hence we're doing source transform here
Summary
QNN doesn't have much 5D permute optimization, which causes Vit running slower than CPU.

Switched pattern from unsqueeze->permute 5d->squeeze to permute 4d.
Improvements: 150ms/inference -> 4.2ms/inference.
Test plan
Pass Vit UT