Repository navigation
[QNN EP] Enable automatic selection of QNN EP for PREFER_NPU policy - #24629
Merged
Adrian Lizarraga (adrianlizarraga) merged 2 commits intoMay 4, 2025
Merged
Conversation
Adrian Lizarraga (adrianlizarraga)
requested review from
Hector Li (HectorSVC),
George Wu (jywu-mysoft) and
Scott McKay (skottmckay)
May 3, 2025 22:23
Scott McKay (skottmckay)
previously approved these changes
May 4, 2025
George Wu (jywu-mysoft)
previously approved these changes
May 4, 2025
Adrian Lizarraga (adrianlizarraga)
dismissed stale reviews from George Wu (jywu-mysoft) and Scott McKay (skottmckay)
via
May 4, 2025 05:41
f4955fe
Scott McKay (skottmckay)
approved these changes
May 4, 2025
Adrian Lizarraga (adrianlizarraga)
added a commit
that referenced
this pull request
May 4, 2025
…24629) ### Description - Enables automatic selection of QNN EP for PREFER_NPU policy - Fixes cpuid vendor id for Qualcomm to be `'Q' | ('C' << 8) | ('O' << 16) | ('M' << 24);` Sample code from unit test: ```c++ // Tests autoEP feature to automatically select an EP that supports the NPU. // Currently only works on Windows. TEST_F(QnnHTPBackendTests, AutoEp_PreferNpu) { ASSERT_ORTSTATUS_OK(Ort::GetApi().RegisterExecutionProviderLibrary(*ort_env, kQnnExecutionProvider, ORT_TSTR("onnxruntime_providers_qnn.dll"))); Ort::SessionOptions so; so.SetEpSelectionPolicy(OrtExecutionProviderDevicePolicy_PREFER_NPU); const ORTCHAR_T* ort_model_path = ORT_MODEL_FOLDER "nhwc_resize_sizes_opset18.quant.onnx"; Ort::Session session(*ort_env, ort_model_path, so); EXPECT_TRUE(SessionHasEp(session, kQnnExecutionProvider)); ASSERT_ORTSTATUS_OK(Ort::GetApi().UnregisterExecutionProviderLibrary(*ort_env, kQnnExecutionProvider)); } ``` ### Motivation and Context A recent feature allows ORT to automatically select an EP according to policies set by the user (e.g., prefer npu or prefer gpu). This PR allows QNN EP to be potentially selected when the user sets the `PREFER_NPU` policy.
George Wu (jywu-mysoft)
pushed a commit
that referenced
this pull request
May 4, 2025
### Description Adds #24629 to the ORT 1.22.0 release branch ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. -->
Contributor
|
This PR has been cherry-picked into the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
'Q' | ('C' << 8) | ('O' << 16) | ('M' << 24);Sample code from unit test:
Motivation and Context
A recent feature allows ORT to automatically select an EP according to policies set by the user (e.g., prefer npu or prefer gpu). This PR allows QNN EP to be potentially selected when the user sets the
PREFER_NPUpolicy.