# Tutorial: HTP Backend on SA-series — LA GVM (Android)

In automotive application, QNN’s serialized binary context should be used for
HTP backend execution. To generate the context run:

$ ${QNN_SDK_ROOT}/bin/x86_64-linux-clang/qnn-context-binary-generator \
        --backend ${QNN_SDK_ROOT}/lib/x86_64-linux-clang/libQnnHtp.so \
        --model ${QNN_SDK_ROOT}/examples/Models/InceptionV3/model_libs/x86_64-linux-clang/libInception_v3_quantized.so \
        --binary_file Inception_v3_quantized.serialized
    Copy to clipboard

This creates the context at:

- `${QNN_SDK_ROOT}/examples/Models/InceptionV3/output/Inception_v3_quantized.serialized.bin`

Now execute *adb root && adb remount* for your target, *adb shell* to the QNN terminal and create directories:

$ mkdir -p /data/local/tmp/lib
    $ mkdir -p /data/local/tmp/bin
    Copy to clipboard

Push the necessary libraries to device:

# For SA8295 and SA8540:
    $ adb push ${QNN_SDK_ROOT}/lib/aarch64-android/libQnnHtpV68Stub.so /data/local/tmp/lib
    
    # For SA8650, SA8775 and SA8255:
    $ adb push ${QNN_SDK_ROOT}/lib/aarch64-android/libQnnHtpV73Stub.so /data/local/tmp/lib
    
    # For SA8620 and SA7255:
    $ adb push ${QNN_SDK_ROOT}/lib/aarch64-android/libQnnHtpV75Stub.so /data/local/tmp/lib
    
    # For SA8797:
    $ adb push ${QNN_SDK_ROOT}/lib/aarch64-android/libQnnHtpV81Stub.so /data/local/tmp/lib
    
    $ adb push ${QNN_SDK_ROOT}/lib/aarch64-android/libQnnHtp.so /data/local/tmp/lib
    $ adb push ${QNN_SDK_ROOT}/bin/aarch64-android/qnn-net-run /data/local/tmp/bin
    $ adb push ${QNN_SDK_ROOT}/bin/aarch64-android/qnn-profile-viewer /data/local/tmp/bin
    Copy to clipboard

In the LA GVM terminal, enable permissions for QNN binaries:

$ chmod 777 /data/local/tmp/bin/qnn-net-run
    $ chmod 777 /data/local/tmp/bin/qnn-profile-viewer
    Copy to clipboard

Push the HTP backend binary to the target:

# For SA8295 and SA8540:
    $ adb push ${QNN_SDK_ROOT}/lib/hexagon-v68/unsigned/libQnnHtpV68Skel.so /data/local/tmp/lib
    
    # For SA8650, SA8775 and SA8255:
    $ adb push ${QNN_SDK_ROOT}/lib/hexagon-v73/unsigned/libQnnHtpV73Skel.so /data/local/tmp/lib
    
    # For SA8620 and SA7255:
    $ adb push ${QNN_SDK_ROOT}/lib/hexagon-v75/unsigned/libQnnHtpV75Skel.so /data/local/tmp/lib
    
    # For SA8797:
    $ adb push ${QNN_SDK_ROOT}/lib/hexagon-v81/unsigned/libQnnHtpV81Skel.so /data/local/tmp/lib
    Copy to clipboard

Pull `libc++.so.1` and `libc++abi.so.1` from your hypervisor host’s `/mnt/etc/images/cdsp0` directory, then push them to the target:

$ adb push libc++.so.1 /data/local/tmp/lib
    $ adb push libc++abi.so.1 /data/local/tmp/lib
    Copy to clipboard

Now push the input data, input lists and serialized bin to device:

$ adb push ${QNN_SDK_ROOT}/examples/Models/InceptionV3/data/cropped /data/local/tmp/bin
    $ adb push ${QNN_SDK_ROOT}/examples/Models/InceptionV3/data/target_raw_list.txt /data/local/tmp/bin
    $ adb push ${QNN_SDK_ROOT}/examples/Models/InceptionV3/output/Inception_v3_quantized.serialized.bin /data/local/tmp/bin
    Copy to clipboard

Finally, reset the target with the following command in the LA GVM terminal:

$ reset
    Copy to clipboard

Now qnn-net-run and qnn-profile-viewer can be executed using HTP and LA GVM. Then, *adb shell* into the LA GVM terminal and setup the execution environment:

$ cd /data/local/tmp/bin
    $ export PATH=/data/local/tmp/bin:$PATH
    $ export VENDOR_LIB=/data/local/tmp/lib
    $ export LD_LIBRARY_PATH=$VENDOR_LIB:$LD_LIBRARY_PATH
    $ export ADSP_LIBRARY_PATH="/vendor/lib/rfsa/adsp;$VENDOR_LIB;"
    Copy to clipboard

Then we can execute qnn-net-run with the following:

$ ./qnn-net-run \
        --backend libQnnHtp.so \
        --input_list target_raw_list.txt \
        --retrieve_context Inception_v3_quantized.serialized.bin
    Copy to clipboard

We can also execute qnn-net-run with profiling:

$ ./qnn-net-run \
        --backend libQnnHtp.so \
        --input_list target_raw_list.txt \
        --retrieve_context Inception_v3_quantized.serialized.bin \
        --profiling_level basic
    
    # OR
    
    $ ./qnn-net-run \
        --backend libQnnHtp.so \
        --input_list target_raw_list.txt \
        --retrieve_context Inception_v3_quantized.serialized.bin \
        --profiling_level detailed
    Copy to clipboard

Profiling data can be viewed using qnn-profile-viewer by running the following command:

$ ./qnn-profile-viewer \
        --input_log output/qnn-profiling-data.log
    Copy to clipboard

Outputs from the run will be located at the default ./output directory. Exit the device and view the results:

$ exit
    $ cd ${QNN_SDK_ROOT}/examples/Models/InceptionV3
    $ adb pull /data/local/tmp/bin/output output_android
    $ python3 ${QNN_SDK_ROOT}/examples/Models/InceptionV3/scripts/show_inceptionv3_classifications.py \
        -i data/cropped/raw_list.txt \
        -o output_android/ \
        -l data/imagenet_slim_labels.txt
    Copy to clipboard

Last Published: Jun 04, 2026

[Previous Topic
Tutorial: Running QNN HTP on SA-series](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/htp_auto_tutorial_2.md) [Next Topic
Tutorial: HTP Backend on SA-series — LV GVM (Rich OS)](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/htp_auto_tutorial_2_lv_gvm.md)