[QNN:Feature] Auto ADSP_LIBRARY_PATH setup and device creation fallback#4584
Open
lanling-47 wants to merge 1 commit into
Open
[QNN:Feature] Auto ADSP_LIBRARY_PATH setup and device creation fallback#4584lanling-47 wants to merge 1 commit into
lanling-47 wants to merge 1 commit into
Conversation
Robustness improvements for QNN HTP backend initialization:
1. Auto ADSP_LIBRARY_PATH:
- Detect libQnnHtp.so location at runtime via dladdr
- Set ADSP_LIBRARY_PATH to prioritize app-bundled skel libraries
- Prevents 'Skel lib id mismatch' errors from system/stub
version conflicts
2. Device creation fallback:
- When default deviceCreate fails, try multiple SOC/Arch/SignedPD
combinations (SM8750/v79, SM8650/v75, signed/unsigned PD)
- Continue without device handle rather than aborting entirely
3. Runtime creation safety:
- Check logHandle and backendHandle are non-null before creating
QnnRuntime
- Warn (but proceed) if deviceHandle is null
4. Minor cleanup:
- Rename gContext.QnnInterface -> gContext.interface for clarity
- Use __fp16 directly instead of mnn_qnn_fp16_t wrapper
- CMakeLists: fallback to bundled 3rdParty/ for QNN SDK headers
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.
Summary
Robustness improvements for QNN HTP backend initialization to handle diverse device configurations gracefully.
Changes
1. Auto ADSP_LIBRARY_PATH Setup
libQnnHtp.solocation at runtime viadladdrADSP_LIBRARY_PATHto prioritize app-bundled skel libraries over system ones2. Device Creation Fallback
deviceCreatefails, exhaustively try multiple SOC/Arch/SignedPD combinations:3. Runtime Creation Safety
logHandleandbackendHandleare non-null before creatingQnnRuntimedeviceHandleis null4. Minor Cleanup
gContext.QnnInterface→gContext.interfacefor clarity__fp16directly instead ofmnn_qnn_fp16_twrapper3rdParty/directory for QNN SDK headers whenQNN_SDK_ROOTis not setTesting
Tested on Snapdragon 8 Gen 3 and Snapdragon 8 Elite devices. Verified that ADSP path auto-detection resolves skel mismatch issues and device fallback works when default config fails.