Fix QNN include path and provide QNN Offline usage guide#12
Conversation
Co-authored-by: Juude <2675838+Juude@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
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.