Forums - Using DSP with Native APIs

3 posts / 0 new
Last post
Using DSP with Native APIs
hwjeong
Join Date: 8 Mar 18
Posts: 3
Posted: Wed, 2018-03-28 01:41

Hello,

I am trying to use DSP for inceptionV3 model with native APIs, and I have some problems.

 

First, I confirmed the NativeCpp example code working well in my Android project. Then, I modified the example codes (main.cpp, CreateUserBuffer.cpp, Android.mk, etc.) a bit to use DSP.

To do that, I made input .raw images from 32bit to 8-bit, and changed Android.mk to include .so files for DSP. Also, zdl::DlSystem::Runtime_t runtime is set to DSP, and size of user buffer is changed by editing elementsize from 4(float) to 1(unsinged char).

When printing the logs, I confirmed input bufSize is the same as input file size (299x299x3 = 268203), output buffer size was 1008, which are 1/4 of buffer size when running on CPU/GPU. Of course I checked whether "zdl::SNPE::SNPEFactory::isRuntimeAvailable(zdl::DlSystem::Runtime_t::DSP)" returns True.

However, I got runtime error for the "snpe->execute(inputMap, outputMap);" line.

So, could you give me some sample codes or advices for this?

My test circumstance is SDM845(Galaxy S9) and some printed logs are attached below.

01-26301/com.example.hellojni V/com.example.hellojni: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1220: /dsp/fastrpc_shell_3 load failed 45, searching...
03-28 16:16:37.044 26301-26301/com.example.hellojni V/com.example.hellojni: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:194: fopen success: /dsp/cdsp/fastrpc_shell_3
03-28 16:16:37.045 26301-26301/com.example.hellojni V/com.example.hellojni: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1322: create user pd with attributes 0 domain 3
03-28 16:16:37.071 26301-26366/com.example.hellojni V/com.example.hellojni: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:194: fopen success: /storage/emulated/0/snpe/libsnpe_dsp_v65_skel.so
03-28 16:16:37.077 26301-26366/com.example.hellojni E/com.example.hellojni: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:693:Error 45: fopen failed for testsig-0x7a1319e.so. (No such file or directory)
03-28 16:16:37.080 26301-26366/com.example.hellojni E/com.example.hellojni: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:693:Error 45: fopen failed for testsig.so. (No such file or directory)
03-28 16:16:37.106 26301-26366/com.example.hellojni V/com.example.hellojni: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:194: fopen success: /system/vendor/lib/rfsa/adsp/libdspCV_skel.so
03-28 16:16:37.113 26301-26366/com.example.hellojni V/com.example.hellojni: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:194: fopen success: /system/vendor/lib/rfsa/adsp/libapps_mem_heap.so
03-28 16:16:38.322 26301-26301/com.example.hellojni D/MY_DEBUG: hw_snpeBuilder time: 1279.6367
03-28 16:16:38.326 26301-26367/com.example.hellojni D/com.example.hellojni: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1393: Error 4b: adsp current process handle failed. domain 3
03-28 16:16:38.327 26301-26301/com.example.hellojni D/MY_DEBUG: dim, rank, elementsize: 299 3 1
03-28 16:16:38.327 26301-26301/com.example.hellojni D/MY_DEBUG: bufsize: 268203
03-28 16:16:38.327 26301-26301/com.example.hellojni D/MY_DEBUG: dim, rank, elementsize: 1008 1 1
03-28 16:16:38.327 26301-26301/com.example.hellojni D/MY_DEBUG: bufsize: 1008
03-28 16:16:38.327 26301-26301/com.example.hellojni D/MY_DEBUG: input file length: 268203
03-28 16:16:38.327 26301-26301/com.example.hellojni D/MY_DEBUG: check fileLine: /storage/emulated/0/snpe/cropped/chairsq.raw
03-28 16:16:38.328 26301-26301/com.example.hellojni A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 26301 (xample.hellojni)

 

Thank you very much.

  • Up0
  • Down0
hwjeong
Join Date: 8 Mar 18
Posts: 3
Posted: Wed, 2018-04-25 01:14

I solved the problem by setting "zdl::DlSystem::UserBufferEncodingTf8" instead of "zdl::DlSystem::UserBufferEncodingUnsigned8Bit" for user buffer coding when creating user buffer.

  • Up0
  • Down0
f10.liu
Join Date: 22 Mar 18
Posts: 14
Posted: Tue, 2018-08-07 01:30

Hi, I try to use DSP in NativeCpp/SampleCode. But after I change "UserBufferEncodingTf8" in CreateUserBuffer.cpp, and generated input image data in uint8 type, I still got error : "Segmentation fault" in "snpe->execute(inputMap, outputMap);".

 

Because I push "snpe-sample" in mobilephone, so I didn't get more information. If you can tell me which code you have been modified, I will be really appreciate!

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.