Forums - Snapdragon 625 (linux) OpenCL issue

12 posts / 0 new
Last post
Snapdragon 625 (linux) OpenCL issue
oostap1
Join Date: 4 Apr 17
Posts: 12
Posted: Wed, 2017-08-09 12:00

Hi,

I've tried to run snpe 1.2.2 on Snapdragon camera with Linux:

Linux apq8053 3.18.44 #1 SMP PREEMPT Thu Apr 27 09:21:52 MDT 2017 aarch64 GNU/Linux 

Did run small OpenCL benchmark tool "clpeak" and OpenCL is there:

Platform: Snapdragon(TM)
  Device: QUALCOMM Adreno(TM)
    Driver version  : OpenCL 2.0 QUALCOMM build: commit #e08994c changeid # Date: 04/27/17 Thu Local Branch:  Remote Branch:  Compiler E031.33.00.02 (Linux ARM)
    Compute units   : 1
    Clock frequency : 1 MHz
SNPE application fails to run on both modes CPU/GPU with the same error:
error_code=809; error_message=OpenCL function has returned error. OpenCL Error (-59) CL_INVALID_OPERATION; error_component=GPU Runtime; line_no=121; thread_id=3854962688; opencl_error=-59
Tried to remove them and the same result. It seems snpe does not see OpenCL libraries. 
Board has them under:
/usr/lib/libOpenCL.so
/usr/lib64/libOpenCL.so
Is there any workaround to make it work on linux?
 
  • Up0
  • Down0
oferr Moderator
Profile picture
Join Date: 26 Jul 17
Location: San Diego
Posts: 22
Posted: Wed, 2017-08-09 15:50

Hi, Thank you for the interest in Snapdragon NPE, and trying to run it on the configuration described above.

The current version of Snapdragon NPE targets Android OS. As such, it is designed to look for OpenCL in the "typical" locations for Android Drivers, which are different than Linux.

However, and this is where you may have a workaround ( :-) ) it is looking for "LD_LIBRARY_PATH" environment variable. if this environment variable exists, it will look for OpenCL library in these locations as well.

I suggest you'll try this first - define LD_LIBRARY_PATH with /usr/lib in it, or add /usr/lib to the LD_LIBRARY_PATH if its already defined.

  • Up0
  • Down0
oostap1
Join Date: 4 Apr 17
Posts: 12
Posted: Wed, 2017-08-09 17:56

Thank you for quick answer. Adding to LD_LIBRARY_PATH was first thing I did try.  It did not help.

Checking SNPE library dependencies showed libdl.so in list. If I correctly understood it is dynamic linkage library which loads shared library at runtime. So LD_LIBRARY_PATH might not help with that. Anything else I can try?

Is there any way to get verbose log for library? 

  • Up0
  • Down0
oferr Moderator
Profile picture
Join Date: 26 Jul 17
Location: San Diego
Posts: 22
Posted: Wed, 2017-08-09 19:37

Thanks for checking it. Can you try one more option - place the OpenCL library here : "/system/vendor/lib/libOpenCL.so"

Ofer.

  • Up0
  • Down0
oostap1
Join Date: 4 Apr 17
Posts: 12
Posted: Thu, 2017-08-10 12:10

Thanks, already tried that.

Just discovered that depend on "/usr/lib" place in LD_LIBRARY_PATH behaviour is different. Tried demo application snpe-net-run now

At first place: crash
 export LD_LIBRARY_PATH=/usr/lib/:/mnt/sd
card/snpe-1.2.2/lib/arm-linux-gcc4.9sf/
/mnt/sdcard/snpe-1.2.2/models/alexnet # ../../bin/arm-linux-gcc4.9sf/snpe-net-ru
n --container dlc/bvlc_alexnet.dlc --input_list data/cropped/raw_list.txt --debu
g
*** Error in `../../bin/arm-linux-gcc4.9sf/snpe-net-run': free(): invalid pointer: 0x0003cc4a ***
Aborted (core dumped)
 
At second place or missing in LD_LIBRARY_PATH, just exit with error -137 (Killed). Have no idea who is killing it
/mnt/sdcard/snpe-1.2.2/models/alexnet # export LD_LIBRARY_PATH=/mnt/sdcard/snpe-
1.2.2/lib/arm-linux-gcc4.9sf/
/mnt/sdcard/snpe-1.2.2/models/alexnet # ../../bin/arm-linux-gcc4.9sf/snpe-net-ru
n --container dlc/bvlc_alexnet.dlc --input_list data/cropped/raw_list.txt --debu
g
Killed
/mnt/sdcard/snpe-1.2.2/models/alexnet # export LD_LIBRARY_PATH=/mnt/sdcard/snpe-
1.2.2/lib/arm-linux-gcc4.9sf/:/usr/lib
/mnt/sdcard/snpe-1.2.2/models/alexnet # ../../bin/arm-linux-gcc4.9sf/snpe-net-ru
n --container dlc/bvlc_alexnet.dlc --input_list data/cropped/raw_list.txt --debu
g
Killed
If my application is run with missing/second place in LD_LIBRARY_PATH, it shows error (believe that means not found):
error_code=809; error_message=OpenCL function has returned error. OpenCL Error (-59) CL_INVALID_OPERATION; error_component=GPU Runtime; line_no=121; thread_id=3860553728; opencl_error=-59
If /usr/lib is first in LD_LIBRARY_PATH list, just crash
Check runtime
SNPE Version: 1.2.2.0
*** Error in `./app': free(): invalid pointer: 0x000cde32 ***
Something really weird is going on with LD_LIBRARY_PATH parsing. Depends how it is written different crash:
 
export LD_LIBRARY_PATH=/usr/lib:/mnt/sdcard/output/lib --> Segmentation fault (core dumped)
export LD_LIBRARY_PATH=/usr/lib/:/mnt/sdcard/output/lib/ --> *** Error in `./app': free(): invalid pointer: 0x000cde32 *** Aborted (core
dumped)
export LD_LIBRARY_PATH=/usr/lib//:/mnt/sdcard/output/lib// --> *** Error in `./app': munmap_chunk(): invalid pointer: 0x000cde33 *** Aborted (core dumped)
Do you have verbose output in library?

 

  • Up0
  • Down0
oostap1
Join Date: 4 Apr 17
Posts: 12
Posted: Thu, 2017-08-10 12:24

Hmm, It seems found different bug. If LD_LIBRARY_PATH has more than one item in list, application will crash.

But having everything in one folder still does not help with OpenCL issue.

 

  • Up0
  • Down0
oferr Moderator
Profile picture
Join Date: 26 Jul 17
Location: San Diego
Posts: 22
Posted: Thu, 2017-08-10 14:33

Thanks for making these extensive testings.

Looking at the list of experiments, i'm not clear on one scenario - what happens when LD_LIBRARY_PATH has only one item, and it is "/usr/lib" ?

I'm checking on other options to enable more information from these crashes.

  • Up0
  • Down0
oostap1
Join Date: 4 Apr 17
Posts: 12
Posted: Thu, 2017-08-10 16:04
OK. Copied libSNPE.so to /usr/lib now. No change
 
export LD_LIBRARY_PATH=/usr/lib
 
/mnt/sdcard/snpe-1.2.2/models/alexnet # ../../bin/arm-linux-gcc4.9sf/snpe-net-ru
n --container dlc/bvlc_alexnet.dlc --input_list data/cropped/raw_list.txt --debu
g --use_gpu
 
The selected runtime is not available on this platform. Continue anyway to observe the failure at network creation time.
error_code=101; error_message=Invalid parameter in user config. Attempted to set a neural network configuration option GPU that is not supported on this platform.; error_component=System Configuration; line_no=86; thread_id=3918757888
 
  • Up0
  • Down0
oferr Moderator
Profile picture
Join Date: 26 Jul 17
Location: San Diego
Posts: 22
Posted: Thu, 2017-08-10 17:33

<p>OK, so that's some progress. Now SNPE managed to find and load the OpenCL library -&nbsp;which is great :-)
BTW, I thought that you mentioned at early stages that libSNPE.so was already located under /usr/lib&nbsp; - was that not the case ?

Can you provide some more information using the CLpeak tool ? I would like to see the CL_DRIVER_VERSION, CL_DEVICE_VERSION, CL_DEVICE_NAME,

Thanks,
Ofer

  • Up0
  • Down0
oostap1
Join Date: 4 Apr 17
Posts: 12
Posted: Fri, 2017-08-11 11:30

I'm afraid I dod not see symptoms that libOpenCL.so has been found by SNPE. Error is the same as before, just no more crash in SNPE due to LD_LIBRARY_PATH parsing

export LD_LIBRARY_PATH=/mnt/sdcard/snpe-1.2.2/lib/arm-linux-gcc4.9sf/
USE GPU
/mnt/sdcard/snpe-1.2.2/models/alexnet # ../../bin/arm-linux-gcc4.9sf/snpe-net-ru
n --container dlc/bvlc_alexnet.dlc --input_list data/cropped/raw_list.txt --debu
g --use_gpu
The selected runtime is not available on this platform. Continue anyway to observe the failure at network creation time.
error_code=101; error_message=Invalid parameter in user config. Attempted to set a neural network configuration option GPU that is not supported on this platform.; error_component=System Configuration; line_no=86; thread_id=3881582592
USE CPU
/mnt/sdcard/snpe-1.2.2/models/alexnet # ../../bin/arm-linux-gcc4.9sf/snpe-net-ru
n --container dlc/bvlc_alexnet.dlc --input_list data/cropped/raw_list.txt --debu
Killed
clpeak gives me following for OpenCL:
 <platform name="QUALCOMM Snapdragon(TM)">
 <device name="QUALCOMM Adreno(TM)" driver_version="OpenCL 2.0 QUALCOMM build: commit #e08994c changeid # Date: 04/27/17 Thu Local Branch:  Remote Branch:  Compiler E031.33.00.02" compute_units="1" clock_frequency="1" clock_frequency_unit="MHz">
 

 

  • Up0
  • Down0
oostap1
Join Date: 4 Apr 17
Posts: 12
Posted: Fri, 2017-08-11 12:32

Sligtly modified clpeak:

Device:              QUALCOMM Adreno(TM)
Device VER:      OpenCL 2.0 Adreno(TM) 506
Driver version  : OpenCL 2.0 QUALCOMM build: commit #e08994c changeid # Date: 04/27/17 Thu Local Branch:  Remote Branch:  Compiler E031.33.00.02 (Linux ARM)
 
  • Up0
  • Down0
oostap1
Join Date: 4 Apr 17
Posts: 12
Posted: Thu, 2017-08-17 18:18

It was issue with OpenCL driver or library on camera. Rolling back to older version fixed issue.

  • 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.