[TOC]

概述

概述

使用QNN的时候,Clientst通过后端与QNN进行通信。一般来说,QNN后端是一个实现QNN API的软件实体,并通常以共享库的形式进行编译。 “QNN后端 “和 “QNN后端库 “这两个术语经常被互换使用。

*Available QNN SDK Backend libraries*

后端库名称 后端库介绍 目标库和依赖库 Library Description
CPU 使用骁龙™CPU硬件内核的后端 aarch64-android
arm-android
x86_64-linux-clang
libQnnCpu.so
libQnnCpu.so : CPU backend library, same name used across all targets.
DSP Backend for Hexagon™ DSP hardware accelerator hexagon-v65libQnnDspV65Skel.sohexagon-v66libQnnDspV66Skel.soaarch64-androidarm-androidlibQnnDspV65Stub.so``libQnnDspV66Stub.so libQnnDspV65Skel.so : DSP native library which is to be loaded using libQnnDspV65Stub.so from device CPU side.libQnnDspV65Stub.so : DSP proxy backend library, communicating with libQnnDspV65Skel.so on DSP side via RPC channel.libQnnDspV66Skel.so : DSP native library which is to be loaded using libQnnDspV66Stub.so from device CPU side.libQnnDspV66Stub.so : DSP proxy backend library, communicating with libQnnDspV66Skel.so on DSP side via RPC channel.
GPU Backend for Adreno™ GPU hardware accelerator aarch64-androidarm-androidlibQnnGpu.so libQnnGpu.so : GPU backend library, same name used across all targets.
HTP Backend for Hexagon™ HTP hardware accelerator hexagon-v68libQnnHtpV68Skel.so``libQnnHtpV68.so``[Deprecated] libQnnHtpAltPrepSkel.soaarch64-androidarm-androidlibQnnHtp.so``libQnnHtpPrepare.so``libQnnHtpV68Stub.so``[Deprecated] libQnnHtpAltPrepStub.sox86_64-linux-clanglibQnnHtp.so libQnnHtpV68Skel.so : HTP native library which is to be loaded using libQnnHtpV68Stub.so (with the same version string) from the device CPU side and is responsible to execute graphs on the HTP accelerator.[Deprecated] libQnnHtpAltPrepSkel.so : HTP native library which is to be loaded using libQnnHtpAltPrepStub.so from the device CPU side and is responsible to execute graphs on the HTP accelerator.libQnnHtpV68Stub.so : HTP proxy library that communicates with libQnnHtpV68Skel.so on the HTP side via RPC channel.[Deprecated] libQnnHtpAltPrepStub.so : HTP proxy backend library which is responsible to finalize graphs on the ARM (CPU side) and communicates with libQnnHtpAltPrepSkel.so on HTP side via RPC channel to execute the finalized graph.libQnnHtp.so : There are two variants of this library: (Android) Acts as a stub library in initializing the backend and loading the corresponding HTP stub library based on the SoC; (x86_64) Serves as an emulator for the hardware accelerator.libQnnHtpV68.so : This library acts as an HTP native library that allows direct integration on HTP without RPC.libQnnHtpPrepare.so : HTP native library which is responsible for finalizing graphs on the ARM (CPU) side. This library is automatically loaded only when one of the following operations is requested: 1) QnnBackend_validateOpConfig, 2) QnnGraph_addNode, 3) QnnGraph_finalize, or 4) QnnBackend_registerOpPackage() with “CPU” target. If these operations are not requested, this library does not need to be on the device.
HTA Backend for Snapdragon™ HTA hardware accelerator aarch64-androidarm-androidlibQnnHta.so libQnnHta.so : HTA backend library, same name used across all supported targets.
Saver Backend which captures QNN API calls and saves them to a file as they are issued by a client. This can later be replayed for support and troubleshooting. aarch64-androidarm-androidx86_64-linux-clanghexagon-v68libQnnSaver.so libQnnSaver.so : Saver backend library.

QNN SDK 包含帮助客户将经过训练的深度学习网络集成到其应用程序中的工具。 QNN 集成工作流程图说明了基本集成工作流程。

../_static/resources/qnn_basic_workflow.png

生成的中间产物:SO文件

SO文件每次进行加载的时候,每次都要重新进行图的展开,所以每次进行推理的时候都需要进行初始化加载,因为他的图没有进行展开,也就是他的模型没有加载到NPU的内存中。

最终的生成产物:bin文件

bin文件只需要初始化一次,在NPU内存中已经进行展开,就不需要每次进行初始化。