Skip to content

Qualcomm AI Engine Direct - Python API Refactor#18312

Open
winskuo-quic wants to merge 1 commit intopytorch:mainfrom
CodeLinaro:dev1/winskuo/python_api_refactor
Open

Qualcomm AI Engine Direct - Python API Refactor#18312
winskuo-quic wants to merge 1 commit intopytorch:mainfrom
CodeLinaro:dev1/winskuo/python_api_refactor

Conversation

@winskuo-quic
Copy link
Collaborator

Summary

The biggest goal of this PR is to improve user experience by maintaining consistency across all example scripts and provide an official config file for QNN APIs.
In the past, user has to manually provide params to APIs such as build_executorch_binary to make it work. However, not all the params are passed in the build_executorch_binary, making some of the flags not working, which leaves users confused. Taking example below, if user tries to skip node in script 1, it will fail.
image
For this reason, we want to maintain a QnnConfig structure as an official config file.
If we want to introduce a new flag to our APIs, if we want all scripts to benefit from the flag, we will need to update all our example scripts, making it hard to maintain as we support more flags and more scripts. With this feature, we don't have to manually update all example scripts when a new flag is introduced. Instead, all QnnConfig will parse it itself and we don't have to update the example script at all.

This PR does the following:

  1. Introduce QnnConfig, which takes parser or .json file as input
  2. Migrate our Qnn ExecuTorch official APIs to backends/qualcomm/export_utils.py. The reason of doing this is API calls shouldn't be under examples folder. Furthermore, pip install executorch does not include examples/qualcomm folder, meaning these APIs are not exposed to users that uses pip install.
  3. The following flags can now all be removed from example scripts and backend API will handle the logic: compile_only, pre_gen_pte, skip_push, profile_level, dump_intermediate_outputs, shared_buffer, skip_delegate_node_ids, skip_delegate_node_ops.
  4. Update README so it aligns with the new behavior.

Test plan

Passes all tests under test_qnn_delegate.py.

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 19, 2026

🔗 Helpful Links

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

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

⏳ 4 Pending, 3 Unrelated Failures

As of commit 4a6594d with merge base ca2a616 (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 Mar 19, 2026
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/python_api_refactor branch from 8f0d3da to 4a6594d Compare March 19, 2026 08:02
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant