AnsweredAssumed Answered

OpenCL BSP for Android 6.0 i.MX6Q

Question asked by YOUXIN SU on Jan 23, 2018
Latest reply on Jan 24, 2018 by YOUXIN SU

Hello,

 

I've left reply in OpenCL Hello World, but thinking I should start a new question to attract eyeball.

 

I am working on running OpenCL Hello World on i.MX6q Android 6.0 BSP. 

 

I've downloaded libCLC_Android.so and libOpenCL_Android.so from OpenCL Hello World. When I create Android.mk I will need to include libVSC.so(using objectdump figured the gc functions out) in the dependencies, otherwise, it will fail to find gcXXXXX(CANNOT LINK EXECUTABLE: cannot locate symbol "gcSHADER_Destroy" referenced by "/system/lib/libOpenCL.so").

 

LOCAL_SHARED_LIBRARIES := \
libGAL \
libVSC \
libOpenCL \
libCLC \

 

After adding libVSC, the host executable compiled OK, so that I can run it on iMX6, 

 

However, if I run it on i.MX6 I will get a "Segmentation fault" when calling clBuildProgram, and I found crash report like this in logcat, 

01-01 18:15:21.069 3478 3478 F libc : Fatal signal 11 (SIGSEGV), code 2, fault addr 0xb6dd585c in tid 3478 (opencl)
01-01 18:15:21.171 218 218 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 18:15:21.171 218 218 F DEBUG : Build fingerprint: 'Ikegps/orca/orca:6.0.1/0.0.1-rc0/20171130:eng/release-keys'
01-01 18:15:21.171 218 218 F DEBUG : Revision: '0'
01-01 18:15:21.171 218 218 F DEBUG : ABI: 'arm'
01-01 18:15:21.171 218 218 F DEBUG : pid: 3478, tid: 3478, name: opencl >>> opencl <<<
01-01 18:15:21.172 218 218 F DEBUG : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xb6dd585c
01-01 18:15:21.177 218 218 F DEBUG : r0 b6a7d748 r1 b6ddcdd3 r2 00000001 r3 00000069
01-01 18:15:21.177 218 218 F DEBUG : r4 b6a7d704 r5 ae4fc0d4 r6 b6dd585c r7 00000000
01-01 18:15:21.177 218 218 F DEBUG : r8 beb20550 r9 b6ddcdc8 sl 0000004f fp 0000000e
01-01 18:15:21.177 218 218 F DEBUG : ip 00000064 sp beb20448 lr b6e66057 pc b6e66066 cpsr 00010030
01-01 18:15:21.181 542 612 W NativeCrashListener: Couldn't find ProcessRecord for pid 3478
01-01 18:15:21.196 218 218 F DEBUG :
01-01 18:15:21.196 218 218 F DEBUG : backtrace:
01-01 18:15:21.197 218 218 E DEBUG : AM write failed: Broken pipe
01-01 18:15:21.197 218 218 F DEBUG : #00 pc 00015066 /system/lib/libVSC.so (gcSHADER_AddAttribute+209)
01-01 18:15:21.197 218 218 F DEBUG : #01 pc 00054f51 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #02 pc 00026e31 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #03 pc 0002722f /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #04 pc 000d319d /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #05 pc 000f5913 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #06 pc 00046e0d /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #07 pc 00018aa1 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #08 pc 0003a7b7 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #09 pc 00044d67 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #10 pc 00018a65 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #11 pc 0003ed03 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #12 pc 00018435 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #13 pc 0003eba9 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #14 pc 00018435 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #15 pc 0001711f /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #16 pc 00017497 /system/lib/libCLC.so
01-01 18:15:21.197 218 218 F DEBUG : #17 pc 00015f0f /system/lib/libCLC.so (gcCompileKernel+42)
01-01 18:15:21.197 218 218 F DEBUG : #18 pc 0000bbb9 /system/lib/libOpenCL.so (clBuildProgram+324)
01-01 18:15:21.197 218 218 F DEBUG : #19 pc 00000da1 /system/bin/opencl
01-01 18:15:21.197 218 218 F DEBUG : #20 pc 00017365 /system/lib/libc.so (__libc_init+44)
01-01 18:15:21.197 218 218 F DEBUG : #21 pc 00001060 /system/bin/opencl

 

Which got a fault addr when calling gcSHADER_AddAttribute....

 

I am not sure if the libCLC_Android.so and libOpenCL_Android.so here is still usable for newer version kernel/Android BSP. If not, would somebody can help to build a library suits? 

 

Other method I had tried:

 

Download Linux 4.1.15 BSP used for YCOTO project, pulled out the libCLC.so and libOpenCL.so from /usr/lib, then I encounter dependency issue as expected, since Android has different libc, etc. 

 

Would be much appreciated if someone can provide any information or provide the suitable libraries.

 

The sample code I used to test is updated to here if you'd like to have a look.

 

Regards,

Youxin

Outcomes