Skip to content

Qualcomm AI Engine Direct - Adding QNN backend support for randn core ATen op#19377

Open
qti-horodnic wants to merge 1 commit into
pytorch:mainfrom
CodeLinaro:randn
Open

Qualcomm AI Engine Direct - Adding QNN backend support for randn core ATen op#19377
qti-horodnic wants to merge 1 commit into
pytorch:mainfrom
CodeLinaro:randn

Conversation

@qti-horodnic
Copy link
Copy Markdown
Contributor

@qti-horodnic qti-horodnic commented May 7, 2026

Summary

Added support for the randn core ATen op using the existing QNN backend implementation of RandomNormalLike. Note only INT8 outputs are supported.

Also fixed a minor bug in the rand op's implementation and test and removed the FP test as it doesn't serve a purpose since rand doesn't support FP outputs either.

Test plan

python backends/qualcomm/tests/test_qnn_delegate.py -k TestQNNQuantizedOperator.test_qnn_backend_randn --model 
SM8750 --host aisw-vm15-labsd --device 545ee4aa --build_folder build-android

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 7, 2026

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ You can merge normally! (2 Unrelated Failures)

As of commit 3f95804 with merge base 371cb1c (image):

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.

@meta-cla meta-cla 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 May 7, 2026
@qti-horodnic
Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: qualcomm"

Comment thread backends/qualcomm/builders/README.md Outdated
@psiddh
Copy link
Copy Markdown
Contributor

psiddh commented May 15, 2026

So, Before this PR, if a model contained torch.randn or torch.randn_like, the QNN partitioner had no builder for it, so it would not delegate that op to HTP, instead it would be running on CPU , causing potential perf degradation

Copy link
Copy Markdown
Contributor

@psiddh psiddh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm (mypy CI errors are unrelated)

@qti-horodnic
Copy link
Copy Markdown
Contributor Author

qti-horodnic commented May 15, 2026

So, Before this PR, if a model contained torch.randn or torch.randn_like, the QNN partitioner had no builder for it, so it would not delegate that op to HTP, instead it would be running on CPU, causing potential perf degradation

Yes, correct. All the prs which I called adding QNN backend support for ... op do this. If there's a direct implementation on the QNN side, support will be added via a builder as in this PR or #19283. If there isn't a QNN implementation, support will be added (if possible) via a decomposition pass breaking down the unsupported into ops which are supported, like for the tan op here.

Note that we are working on supporting most of the ops in the ATen core opset, so expect several more such prs over the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: qualcomm Changes to the Qualcomm backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants