Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Halide on the Hexagon on a Snapdragon 835 : blur app aborts #3608

Closed
markivx opened this issue Jan 23, 2019 · 18 comments
Closed

Halide on the Hexagon on a Snapdragon 835 : blur app aborts #3608

markivx opened this issue Jan 23, 2019 · 18 comments

Comments

@markivx
Copy link

markivx commented Jan 23, 2019

Hello, I'm trying to run the blur example on a hexagon DSP on a Snapdragon 835. Compilation went okay, but the halide_blur() call dies somewhere and the test app aborts. All I see is a message "Aborted". mini-dm didn't provide any information either. (I have testsig setup correctly too, other Hexagon SDK samples work)

$ HL_TARGET=arm-64-android-hvx_128 ./adb_run_on_device.sh

g++ -std=c++11 -I ../../distrib/include/ -I ../../distrib/tools/  -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi -fno-rtti halide_blur_generator.cpp ../../distrib/lib/libHalide.a ../../distrib/tools/GenGen.cpp -o bin/halide_blur.generator  -ldl -lpthread -lz -lz -lrt -ldl -lpthread -lm -lxml2

bin/halide_blur.generator -g halide_blur -o ./bin/arm-64-android target=arm-64-android-hvx_64

/home/markiv/ndk-r10d-toolchain/bin/aarch64-linux-android-c++ -std=c++11 -I ../../distrib/include/ -I ../../distrib/tools/  -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi -fno-rtti -fopenmp -Wall -O2 -I./bin/arm-64-android test.cpp ./bin/arm-64-android/halide_blur.a -o bin/arm-64-android/test -llog -fPIE -pie

rm bin/arm-64-android/halide_blur.a

../../src/runtime/hexagon_remote/bin/arm-64-android/libhalide_hexagon_host.so: 1 file pushed. 4.3 MB/s (28000 bytes in 0.006s)

../../src/runtime/hexagon_remote/bin/v60/signed_by_debug/libhalide_h...agon_remote_skel.so: 1 file pushed. 6.0 MB/s (38780 bytes in 0.006s)
bin/arm-64-android/test: 1 file pushed. 17.9 MB/s (4235119 bytes in 0.226s)
Aborted 
@markivx
Copy link
Author

markivx commented Jan 23, 2019

I'm using Hexagon SDK version 3.0 and Hexagon Tools 8.2.04.

@dsharletg
Copy link
Contributor

What do you see if you do adb logcat | grep halide ?

@dsharletg
Copy link
Contributor

I'm going to close this, if you are still seeing the issue and can get back to us with the output of adb, feel free to reopen.

@dgajaria-ADI
Copy link

dgajaria-ADI commented Jul 17, 2019

I am using Intrinsyc Open-Q 835 Snapdragon Dev platform with Android Nougat (7.1.2), I get the same error (App Aborts) when trying to launch blur App.

Output of adb logcat | grep halide is as below

07-17 19:40:49.935 27848 27848 I halide  : Hexagon: remote_poll_log failed 59
07-17 19:40:49.935 27848 27848 I halide  : Error: Initialization of Hexagon kernels failed 

Could you please help?

@dsharletg
Copy link
Contributor

What do you see if you do adb logcat | grep dsp? Is there a message about 'signature verify'? If so, the issue is likely that the Hexagon code is not signed, and there is no 'testsig' on the device (see Hexagon SDK docs).

Also, Android N is 3-4 years old, and I remember some extra challenges in using FastRPC around that time. Is it possible to update to a newer version of Android?

@dgajaria-ADI
Copy link

I generated the testsig signature using the testsig.py script (provided with Hexagon SDK) and pushed it to android device. I still get the same error. Output of adb logcat | grep dsp is as follow

07-17 21:53:08.230  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:916: /dsp/fastrpc_shell_3 load failed 69, searching...                                                    
07-17 21:53:08.230  3772  3772 E /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:691:Error 45: fopen failed for fastrpc_shell_3. (No such file or directory)                                    
07-17 21:53:08.230  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:930: open_shell failed. domain 69                                                                         
07-17 21:53:08.230  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1048: Error ffffffff: apps_dev_init failed. domain 3, errno No such file or directory
07-17 21:53:08.230  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1128: Error ffffffff: open dev -1 for domain 3 failed
07-17 21:53:08.230  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:916: /dsp/fastrpc_shell_3 load failed 69, searching...
07-17 21:53:08.231  3772  3772 E /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:691:Error 45: fopen failed for fastrpc_shell_3. (No such file or directory)
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:930: open_shell failed. domain 69
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1048: Error ffffffff: apps_dev_init failed. domain 3, errno No such file or directory
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1128: Error ffffffff: open dev -1 for domain 3 failed
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:576: Error 3b: remote handle invoke failed. domain 3, handle ffffffff, sc 30100, pra 0x7ff9172860
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:916: /dsp/fastrpc_shell_3 load failed 69, searching...
07-17 21:53:08.231  3772  3772 E /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:691:Error 45: fopen failed for fastrpc_shell_3. (No such file or directory)                                    
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:930: open_shell failed. domain 69                                                                         
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1048: Error ffffffff: apps_dev_init failed. domain 3, errno No such file or directory                     
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1128: Error ffffffff: open dev -1 for domain 3 failed                                                     
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:916: /dsp/fastrpc_shell_3 load failed 69, searching...                                                    
07-17 21:53:08.231  3772  3772 E /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:691:Error 45: fopen failed for fastrpc_shell_3. (No such file or directory)                                    
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:930: open_shell failed. domain 69                                                                         
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1048: Error ffffffff: apps_dev_init failed. domain 3, errno No such file or directory                     
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1128: Error ffffffff: open dev -1 for domain 3 failed                                                     
07-17 21:53:08.231  3772  3772 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:576: Error 3b: remote handle invoke failed. domain 3, handle ffffffff, sc 6010200, pra 0x7ff9172430 

@dsharletg
Copy link
Contributor

If you are still seeing the signature verification error, you may simply need to reboot the device after installing the testsig.

If that doesn't fix the issue, I think you'll need some support from Qualcomm to resolve this. @pranavb-ca @dpalermo

@dgajaria-ADI
Copy link

dgajaria-ADI commented Jul 18, 2019

Updated to Android Oreo, still getting same error.

Running the logcat | grep test shows the following log

03-20 15:10:28.026 17034 17034 V /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1011: /dsp/fastrpc_shell_3 load failed 45, searching...                   
03-20 15:10:28.027 17034 17034 E /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:695:Error 45: fopen failed for fastrpc_shell_3. (No such file or directory)    
03-20 15:10:28.027 17034 17034 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1029: open_shell failed. domain 69                                        
03-20 15:10:28.027 17034 17034 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1151: Error ffffffff: apps_dev_init failed. domain 3, errno No such file or directory                                                                                                                                                                                   
03-20 15:10:28.027 17034 17034 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1234: Error ffffffff: open dev -1 for domain 3 failed                     
03-20 15:10:28.027 17034 17034 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:663: Error 2c: remote handle invoke failed. domain -1544594464, handle ffffffff, sc 30100, pra 0x7fea08ca00                                                                                                                                                             
03-20 15:10:28.027 17034 17034 V /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1011: /dsp/fastrpc_shell_3 load failed 45, searching...                   
03-20 15:10:28.027 17034 17034 E /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:695:Error 45: fopen failed for fastrpc_shell_3. (No such file or directory)    
03-20 15:10:28.027 17034 17034 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1029: open_shell failed. domain 69                                        
03-20 15:10:28.027 17034 17034 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1151: Error ffffffff: apps_dev_init failed. domain 3, errno No such file or directory                                                                                                                                                                                   
03-20 15:10:28.027 17034 17034 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:1234: Error ffffffff: open dev -1 for domain 3 failed                     
03-20 15:10:28.027 17034 17034 D /data/local/tmp/blur/test: vendor/qcom/proprietary/adsprpc/src/fastrpc_apps_user.c:663: Error 2c: remote handle invoke failed. domain -368523776, handle ffffffff, sc 6010200, pra 0x7fea08c5d0  

Note: I have made change to Makefile to target arm-64-android-hvx_128 instead of arm-64-android.

-       $^ -g halide_blur -e $(GENERATOR_OUTPUTS) -o $(@D) target=$* 
+       $^ -g halide_blur -e $(GENERATOR_OUTPUTS) -o $(@D) target=$(HL_TARGET)   

It runs with target arm-64-android, but HVX scheduler does not run. I changed it to arm-64-android-hvx_128 to be able to profile Hexagon HVX. Am I doing anything wrong?
Attached for reference
Makefile.txt

@dgajaria-ADI
Copy link

Need help to resolve the issue.

I get similar errors as above with Hexagon SDK calculator example with CDSP_FLAG=1, however I am able to run Hexagon SDK example with ADSP_FLAG=1.

I tried doing something similar with Halide Example by setting CDSP_FLAG=0 export CDSP_FLAG=0, but I still get same errors.

Tried running in debug mode and capturing log message using adb logcat | grep halide, get the following

07-25 21:18:54.793  3344  3344 I halide  : Hexagon: halide_hexagon_initialize_kernels (user_context: 0x0, state_ptr: 0xde395e700, *state_ptr: 0x0, code: 0xde3922520, code_size: 8752)                                                          
07-25 21:18:54.793  3344  3344 I halide  : , code: 0xde3924760, code_size: 90792)                                      
07-25 21:18:54.793  3344  3344 I halide  :     Initializing shared runtime                                            
07-25 21:18:54.793  3344  3344 I halide  :     Writing shared object 'libhalide_shared_runtime.so'                      
07-25 21:18:54.794  3344  3344 I halide  :     failed to write shared object to 'libhalide_shared_runtime.so'           
07-25 21:18:54.794  3344  3344 I halide  :     halide_remote_load_library(libhalide_shared_runtime.so) ->               
07-25 21:18:54.795  3344  3344 I halide  : Hexagon: remote_poll_log failed 44                                           
07-25 21:18:54.795  3344  3344 I halide  :         44                                                                   
07-25 21:18:54.795  3344  3344 I halide  : Error: Initialization of Hexagon kernels failed
07-25 21:18:54.776  3344  3344 W test    : type=1400 audit(0.0:48): avc: denied { associate } for name="libhalide_shared_runtime.so" scontext=u:object_r:rootfs:s0 tcontext=u:object_r:labeledfs:s0 tclass=filesystem permissive=0   

@silver-rocket
Copy link

@dgajaria-ADI hi ! did you manage to resolve this issue? i have quite similar situation right there

@dgajaria-ADI
Copy link

@dgajaria-ADI hi ! did you manage to resolve this issue? i have quite similar situation right there

No I was not able to resolve this issue, please let me know if you have any success

@pranavb-ca
Copy link
Contributor

Depending on the device you are using you might need to install a testsig on your device. See Tools_Signing.html in the SDK documentation.

@silver-rocket
Copy link

I did not run test example from repository, but my own Mk file, however i eventually made it work.
I don't remember what was exactly the problem, but i believe i just accurately repeated the steps described in tutorials (from QC web site). I signed device with testsig as mentioned above, not separate libraries. Make sure you pushed everything in right places, libraries are linking well, and your code is correct (in my case i believe it was not, because i was not running prepared example)

@dgajaria-ADI
Copy link

dgajaria-ADI commented Oct 10, 2019

Thanks @pranavb-ca and @degot88 . I will try again. I had tried on two different dev boards Intrinsyc 835 and Inforce 820 and was getting same abort error. I was generating and pushing the testsig as per Qualcomm Hexagon SDK document, but was not successful in running Halide Hexagon DSP code. I was able to run Qualcomm SDK calculator example with ADSP flag as 1.

Could you please give me details about the dev board you are using with Halide.

@pranavb-ca
Copy link
Contributor

d

Need help to resolve the issue.

I get similar errors as above with Hexagon SDK calculator example with CDSP_FLAG=1, however I am able to run Hexagon SDK example with ADSP_FLAG=1.

I tried doing something similar with Halide Example by setting CDSP_FLAG=0 export CDSP_FLAG=0, but I still get same errors.

Tried running in debug mode and capturing log message using adb logcat | grep halide, get the following

07-25 21:18:54.793  3344  3344 I halide  : Hexagon: halide_hexagon_initialize_kernels (user_context: 0x0, state_ptr: 0xde395e700, *state_ptr: 0x0, code: 0xde3922520, code_size: 8752)                                                          
07-25 21:18:54.793  3344  3344 I halide  : , code: 0xde3924760, code_size: 90792)                                      
07-25 21:18:54.793  3344  3344 I halide  :     Initializing shared runtime                                            
07-25 21:18:54.793  3344  3344 I halide  :     Writing shared object 'libhalide_shared_runtime.so'                      
07-25 21:18:54.794  3344  3344 I halide  :     failed to write shared object to 'libhalide_shared_runtime.so'           
07-25 21:18:54.794  3344  3344 I halide  :     halide_remote_load_library(libhalide_shared_runtime.so) ->               
07-25 21:18:54.795  3344  3344 I halide  : Hexagon: remote_poll_log failed 44                                           
07-25 21:18:54.795  3344  3344 I halide  :         44                                                                   
07-25 21:18:54.795  3344  3344 I halide  : Error: Initialization of Hexagon kernels failed
07-25 21:18:54.776  3344  3344 W test    : type=1400 audit(0.0:48): avc: denied { associate } for name="libhalide_shared_runtime.so" scontext=u:object_r:rootfs:s0 tcontext=u:object_r:labeledfs:s0 tclass=filesystem permissive=0   

Hi @dgajaria-ADI - Can you please give me more information

  1. Which device is this?
  2. Are you building Halide from this github repository or are you using Halide from inside the Hexagon SDK?

@dgajaria-ADI
Copy link

d

Need help to resolve the issue.
I get similar errors as above with Hexagon SDK calculator example with CDSP_FLAG=1, however I am able to run Hexagon SDK example with ADSP_FLAG=1.
I tried doing something similar with Halide Example by setting CDSP_FLAG=0 export CDSP_FLAG=0, but I still get same errors.
Tried running in debug mode and capturing log message using adb logcat | grep halide, get the following

07-25 21:18:54.793  3344  3344 I halide  : Hexagon: halide_hexagon_initialize_kernels (user_context: 0x0, state_ptr: 0xde395e700, *state_ptr: 0x0, code: 0xde3922520, code_size: 8752)                                                          
07-25 21:18:54.793  3344  3344 I halide  : , code: 0xde3924760, code_size: 90792)                                      
07-25 21:18:54.793  3344  3344 I halide  :     Initializing shared runtime                                            
07-25 21:18:54.793  3344  3344 I halide  :     Writing shared object 'libhalide_shared_runtime.so'                      
07-25 21:18:54.794  3344  3344 I halide  :     failed to write shared object to 'libhalide_shared_runtime.so'           
07-25 21:18:54.794  3344  3344 I halide  :     halide_remote_load_library(libhalide_shared_runtime.so) ->               
07-25 21:18:54.795  3344  3344 I halide  : Hexagon: remote_poll_log failed 44                                           
07-25 21:18:54.795  3344  3344 I halide  :         44                                                                   
07-25 21:18:54.795  3344  3344 I halide  : Error: Initialization of Hexagon kernels failed
07-25 21:18:54.776  3344  3344 W test    : type=1400 audit(0.0:48): avc: denied { associate } for name="libhalide_shared_runtime.so" scontext=u:object_r:rootfs:s0 tcontext=u:object_r:labeledfs:s0 tclass=filesystem permissive=0   

Hi @dgajaria-ADI - Can you please give me more information

  1. Which device is this?
  2. Are you building Halide from this github repository or are you using Halide from inside the Hexagon SDK?

Hi @pranavb-ca,

The above error message was on Intrinsyc 835 Dev board.

I get the above error with both, Halide from github repo and also Halide library included with Hexagon SDK.

@dsharletg
Copy link
Contributor

I was able to run Qualcomm SDK calculator example with ADSP flag as 1.

Can you run this example on the CDSP? In the past we had problems where the CDSP was not turned on by default, maybe this is happening here?

@dgajaria-ADI
Copy link

Note: I have made change to Makefile to target arm-64-android-hvx_128 instead of arm-64-android.

-       $^ -g halide_blur -e $(GENERATOR_OUTPUTS) -o $(@D) target=$* 
+       $^ -g halide_blur -e $(GENERATOR_OUTPUTS) -o $(@D) target=$(HL_TARGET)   

Source Link

I compile and run it as

HL_TARGET=arm-64-android-hvx_128 ./adb_run_on_device.sh 

Is this correct, if i don't do the above change to makefile, it compiles for arm-64-android and runs the CPU scheduler, does not run DSP scheduler. Hence I changed target to be HL_TARGET

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants