Forums - Is there a way to run it on devices without OpenCL?

14 posts / 0 new
Last post
Is there a way to run it on devices without OpenCL?
daquexian566
Join Date: 26 Jul 17
Posts: 8
Posted: Thu, 2017-07-27 19:12

I am using a Google Pixel (Snapdragon 821), but Google didn't support OpenCL on all its phone. When I ran the example on my phone, I got an exception:

Unable to create network! Cause: 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=-731907728; opencl_error=-59

But I think the runtime I selected is "CPU". The "GPU Runtime" component shouldn't have be loaded.

Is there a way to run my model on devices without OpenCL? And by the way, can I use dsp on Pixel? In the document I saw dsp on 821 is available but I got an exception that it is not supported when I switch runtime to "DSP"

Thanks in advance.

  • Up0
  • Down0
moljaca moderator
Join Date: 25 Jul 17
Location: San Diego
Posts: 40
Posted: Fri, 2017-07-28 12:19

GPU runtime requires OpenCL driver on device, CPU runtime does not. 

So error you see is expected when GPU runtime is selected.  You should not see it with CPU runtime. Could you please make sure that indeed you selected CPU runtime when that error message came out?

As for DSP runtime error, could you please provide the error message? Also, what kind model are you trying to load?

Thanks

  • Up0
  • Down0
moljaca moderator
Join Date: 25 Jul 17
Location: San Diego
Posts: 40
Posted: Fri, 2017-07-28 18:22

Hi, 

an update regarding DSP runtime on Pixel. DSP runtime doesn't work on Pixel phone. FastRPC feature required by DSP runtime has been disabled for apps.

DSP runtime support is device OEM dependent. Not all OEMs enable support for DSP. Pixel is an example.

  • Up0
  • Down0
daquexian566
Join Date: 26 Jul 17
Posts: 8
Posted: Fri, 2017-07-28 19:35

Thanks for your reply! I didn't edit the example project and just run it. Here is my screencord.

http://quexian.me/snpe_error.mp4

You can see the runtime is "CPU" and then I got an exception. Is there something wrong?

Thanks in advance.

  • Up0
  • Down0
daquexian566
Join Date: 26 Jul 17
Posts: 8
Posted: Fri, 2017-07-28 19:46

Thanks for your reply. I uploaded a screenrecord. I hope I didn't do something wrong :)

  • Up0
  • Down0
moljaca moderator
Join Date: 25 Jul 17
Location: San Diego
Posts: 40
Posted: Fri, 2017-07-28 22:29

Thanks for the screen capture. It appears you are doing everything correctly. Please give us a bit more time to investigate further. Do you perhaps have any other Android phone to try it on in mean time?

  • Up0
  • Down0
daquexian566
Join Date: 26 Jul 17
Posts: 8
Posted: Sat, 2017-07-29 00:55

Thanks for your support :)

I tried the same apk on my friend's Xiaomi Mi 6 (with Snapdragon 835 and OpenCL support). CPU works fine on this device (and also GPU and DSP but it is not surprised)

  • Up0
  • Down0
moljaca moderator
Join Date: 25 Jul 17
Location: San Diego
Posts: 40
Posted: Mon, 2017-07-31 19:03

Hi, 

Thanks for trying it out on different phone.

We have confirmed the behavior you described. There is an issue in Snapdragon NPE 1.2.2 code which will cause it to not be able to run on any device which does not have OpenCL support (like Pixel), with similar symptoms that you have reported. Currently the only workaround is to use device which has OpenCL support. We will fix this issue in the future SDK release. 

Thanks for helping uncoverng the issue, and sorry for the inconvenience.

 

  • Up0
  • Down0
daquexian566
Join Date: 26 Jul 17
Posts: 8
Posted: Mon, 2017-07-31 20:35

It's my honor to report a valid bug. Hope that it can be fixed quickly :)

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

The same behaviour on Snapdragon 625 Linux camera.

SNPE does not see OpenCL on board somehow and fails. But OpenCL is there and simple clpeak benchmark tool shows that:

Platform: QUALCOMM 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
Is there any workaround for that issue?
  • Up0
  • Down0
oferr Moderator
Profile picture
Join Date: 26 Jul 17
Location: San Diego
Posts: 22
Posted: Wed, 2017-08-09 13:59

Hi,

Thank you for your interest in Snapdragon NPE.

The scenaio that you have (which you also describe on another thread) is different, as you are running on Linux and not Android, and your Linux has openCL library. This SDK is intended for running on Android.

I believe that there is a work-around for your scenario. See reply on the other thread.

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

I see that libraries are available for android and linux in snpe-1.2.2/lib:

aarch64-linux-gcc4.9  
arm-linux-gcc4.9sf 
arm-android-gcc4.9
 
Could you confirm that linux is not in plans for supporting them?
  • Up0
  • Down0
Rex
Join Date: 8 Aug 15
Posts: 45
Posted: Sat, 2017-09-16 17:28

Thanks for SNPE - it works great on many of our devices.

Unfortunately, we also ran into this problem of SNPE trying the GPU runtime even when the CPU runtime is the only one selected.

Our device is a stock Google Pixel XL running Android 7.1.2 security patch level August 5, 2017.

We explicitly set only the CPU runtime with :

snpeBuilder = new SNPE.NeuralNetworkBuilder((Application)(context.getApplicationContext()));

snpeBuilder.setModel(dlcModelFile);

snpeBuilder.setRuntimeOrder(NeuralNetwork.Runtime.CPU);

snpeNetwork = snpeBuilder.build(); // <-- CRASH

The error is : 

Caused by: java.lang.IllegalStateException: Unable to create network! Cause: 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=-264866508; opencl_error=-59

Thanks.

Rex

  • Up0
  • Down0
Rex
Join Date: 8 Aug 15
Posts: 45
Posted: Tue, 2017-10-10 15:06

CPU runtime now works on devices without OpenCL like most Google devices (Pixel, etc...)

It would be great to release a gradle packaged version (I have one decompiled from the AAR) as using AAR less Android Studio debug friendly.

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