Skip to content

Conversation

@shewu-quic
Copy link
Collaborator

Summary:

  • Include the contextmanager QnnManagerContext and QnnManagerRegistry to handle the life cycle management of QnnManager in AOT.
  • Introduce a singleton QnnBackendUnifiedRegistry to manage shared QNN components.
  • Separate the QnnManager Init function into InitBackend and InitContext to prevent creating the same backend and device for each context in AOT and runtime.
    • InitBackend should initialize shared QNN components such as QnnBackend, QnnDevice, QnnLogger, and the QNN library.
    • InitContext will be responsible for setting up QnnContext and QnnGraph.
  • Resolved the outdated link in the documentation

Background

  • It takes some time to re-initialize the QNN components for both qnn_partitioner and qnn_preprocess in AOT.
    • We currently create and initialize a QnnManager in the qnn_partitioner, and then repeat this process for each partition in the qnn_preprocess. This could be improved by using a single QnnManager for both qnn_partitioner and qnn_preprocess to enhance lowering time.
  • It takes some fixed time to do QNN component initialization during QNN ExecuTorch runtime, especially to QNN device API.
    • We can use static initialization of the QNN device to improve model loading times when the model is initialized frequently.

Goals and Objectives

  • In AOT, make sure to load the QNN library and configure the QNN Backend and Device, ensuring these are shared between both qnn_partitioner and qnn_preprocess.
  • During runtime, we can create one backend and device once in QnnExecutorchBackend and sharing for all partitions and multi-methods

cc: @haowhsu-quic

Summary:
- Include the contextmanager QnnManagerContext and QnnManagerRegistry to handle the life cycle management of QnnManager in AOT.
- Introduce a singleton QnnBackendUnifiedRegistry to manage shared QNN components.
- Separate the QnnManager Init function into InitBackend and InitContext to prevent creating the same backend and device for each context in AOT and runtime.
  - InitBackend should initialize shared QNN components such as QnnBackend, QnnDevice, QnnLogger, and the QNN library.
  - InitContext will be responsible for setting up QnnContext and QnnGraph.
- Resolved the outdated link in the documentation
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 20, 2025

🔗 Helpful Links

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

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

❌ 11 New Failures, 2 Unrelated Failures

As of commit 31dbcca with merge base aff5086 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but was 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 Nov 20, 2025
@shewu-quic
Copy link
Collaborator Author

@pytorchbot label "release notes: qualcomm"

@pytorch-bot pytorch-bot bot added the release notes: qualcomm Changes to the Qualcomm backend delegate label Nov 20, 2025
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.

1 participant