Fix QNN include path and provide QNN Offline usage guide #12
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.
This change updates the
source/backend/qnn/CMakeLists.txtto include${_QNN_ROOT}/include/in the search path. This ensures compatibility with the directory structure created byprepare_qnn_deps.sh(where headers are directly underinclude/) as well as the standard Qualcomm QNN SDK structure (where headers are underinclude/QNN/).Usage Guide for MNN QNN (Offline Mode)
This guide explains how to compile and use
mnn_qnnfor offline model conversion and Android execution.1. Prerequisites
./prepare_qnn_deps.shto download necessary headers and libs tosource/backend/qnn/3rdParty/, OR have the full QNN SDK installed.2. Compile Model Converter (Host - Linux x86_64)
The
MNN2QNNModeltool converts an MNN model into a QNN-compatible model (.mnn+.bin). It requiresMNN_QNNandMNN_QNN_CONVERT_MODEenabled.mkdir build_host cd build_host cmake .. \ -DMNN_QNN=ON \ -DMNN_QNN_CONVERT_MODE=ON \ -DQNN_SDK_ROOT=/path/to/qnn/sdk_or_deps make -j4 MNN2QNNModel(Note: If using
prepare_qnn_deps.sh, setQNN_SDK_ROOTtopath/to/source/backend/qnn/3rdParty).3. Convert Model (Host)
Running
MNN2QNNModelrequires the full QNN SDK (specificallybin/x86_64-linux-clangtools likeqnn-context-binary-generator).# Usage: ./MNN2QNNModel <qnnSDKPath> <socId> <hexagonArch> <srcMNNPath> <outputDir> ./MNN2QNNModel /opt/qcom/qnn/sdk 43 73 model.mnn ./outputsocId: e.g., 43 for Snapdragon 8 Gen 2.hexagonArch: e.g., 73 for Hexagon V73.model_43_73.mnnandmodel_43_73.bin.4. Compile Runtime (Android - ARM64)
Build
libMNN.sowith QNN support. Crucially,MNN_WITH_PLUGIN=ONis required for loading offline models, andMNN_QNN_CONVERT_MODEmust be OFF.5. Run on Android
Push Libraries:
libMNN.so(built above).libQnnHtp.so,libQnnHtpVxxSkel.so,libQnnHtpVxxStub.so,libQnnSystem.so(from QNN SDKlib/aarch64-android/)./data/local/tmp(or app lib dir).Push Model:
model_43_73.mnnandmodel_43_73.bin.Execute:
LD_LIBRARY_PATHto include the directory with QNN libs.model_43_73.mnn.PR created automatically by Jules for task 4451591356993808856 started by @Juude
Note
Low Risk
Build-system-only change that broadens header search paths; low functional risk, with the main concern being potential include-order/header ambiguity if both layouts are present.
Overview
Fixes QNN builds against alternate SDK layouts by adding
${_QNN_ROOT}/include/toMNN_QNN's include directories (in addition to the existing${_QNN_ROOT}/include/QNN/).Written by Cursor Bugbot for commit 3bef715. This will update automatically on new commits. Configure here.