- 下载SDK
点击SNPE下载SDK,解压后目录TOPO:

- 确定target arch和DSP Hexagon Arch
- 安卓就选aarch64-android
- linux-arm的,选aarch64开头的,然后根据linux版本,编译器版本确定,如aarch64-ubuntu-gcc9.4代表aarch64架构,ubuntu系统,gcc9.4编译器。这个要严格对应,否则会Failed
- DSP Hexagon Arch,对应SOC版本如下图,更多点击DSP & SOC:

- 配置环境
- 推送snpe和dsp的 runtime library 到开发板
adb push aarch64-ubuntu-gcc9.4 /data
adb push hexagon-v66 /data
然后登录开发板
adb shell
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/data/aarch64-ubuntu-gcc9.4"
export ADSP_LIBRARY_PATH="/data/hexagon-v66/unsigned;/usr/lib/rfsa/adsp;/dsp"
PS:
- Unlike LD_LIBRARY_PATH, the path must be contained within quotations. Additionally, unlike LD_LIBRARY_PATH, the directory separator is a semi-colon, not a colon. 目录要用封号隔开而非冒号
- The DSP loader requires the environment variable ADSP_LIBRARY_PATH to be set to the directory where the shared libraries are stored. This environment variable is used for both ADSP and CDSP. CDSP和ADSP的环境变量统一使用ADSP_LIBRARY_PATH。
/usr/lib/rfsa/adsp;/dsp dsp的驱动,一般开发板应该都配好了,否则需要自己搭。
- 测试
两种方法:
- snpe-platform-validator
./aarch64-ubuntu-gcc7.5/snpe-platform-validator --runtime dsp
PF_VALIDATOR: DEBUG: Calling PlatformValidator->setRuntime
PF_VALIDATOR: DEBUG: Calling PlatformValidator->IsRuntimeAvailable
PF_VALIDATOR: DEBUG: CPU side validation passed.
PF_VALIDATOR: DEBUG: Checking if backend is available
/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_repo_rel/2.29.0/release/snpe_src/avante-tools/prebuilt/dsp/hexagon-sdk-4.1.0/ipc/fastrpc/rpcmem/src/rpcmem_android.c:38:dummy call to rpcmem_init, rpcmem APIs will be used from libxdsprpcPF_VALIDATOR: DEBUG: Snpe-QNN HEXNNV2 backend initialization successful
Runtime DSP Prerequisites: Present.
PF_VALIDATOR: DEBUG: Calling PlatformValidator->RuntimeCheck
PF_VALIDATOR: DEBUG: CPU side validation passed.
PF_VALIDATOR: DEBUG: Checking if backend is available
PF_VALIDATOR: DEBUG: Snpe-QNN HEXNNV2 backend initialization successful
PF_VALIDATOR: DEBUG: starting calculator test
PF_VALIDATOR: DEBUG: Loading DSP stub: libcalculator.so
PF_VALIDATOR: DEBUG: Successfully loaded DSP library - 'libcalculator.so'. Setting up pointers.
PF_VALIDATOR: DEBUG: Success in executing the sum function
Unit Test on the runtime DSP: Passed.
SNPE is supported for runtime DSP on the device.
- c++API
zdl::SNPE::SNPEFactory::isRuntimeAvailable(zdl::DlSystem::Runtime_t::DSP)
2156

被折叠的 条评论
为什么被折叠?



