[OpenCL][android_deploy] CL_OUT_OF_RESSOURCES on Mali T-760


#1

Hi,

I am learning TVM, trying to make the examples for deploying to android work.
Running the android_deploy with OpenCL backend raises me a CL_OUT_OF_RESSOURCES error:

05-09 08:34:42.680 24450 24728 E AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
05-09 08:34:42.680 24450 24728 E AndroidRuntime: Process: ml.dmlc.tvm.android.demo, PID: 24450
05-09 08:34:42.680 24450 24728 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at android.os.AsyncTask$3.done(AsyncTask.java:318)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:242)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:762)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: Caused by: ml.dmlc.tvm.Base$TVMError: TVMError: Check failed: ret == 0 (-1 vs. 0) : Check failed: e == CL_SUCCESS: OpenCL Error, code=-5: CL_OUT_OF_RESOURCES
05-09 08:34:42.680 24450 24728 E AndroidRuntime: Stack trace:
05-09 08:34:42.680 24450 24728 E AndroidRuntime:   File "/home/SERILOCAL/n.perto/Documents/tvm/apps/android_deploy/app/src/main/jni/../../../../../../include/../src/runtime/module_util.cc", line 73
05-09 08:34:42.680 24450 24728 E AndroidRuntime:   File "/home/SERILOCAL/n.perto/Documents/tvm/apps/android_deploy/app/src/main/jni/../../../../../../include/../src/runtime/opencl/opencl_module.cc", line 82
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at ml.dmlc.tvm.Base.checkCall(Base.java:173)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at ml.dmlc.tvm.Function.invoke(Function.java:130)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at ml.dmlc.tvm.android.demo.MainActivity$ModelRunAsyncTask.doInBackground(MainActivity.java:344)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at ml.dmlc.tvm.android.demo.MainActivity$ModelRunAsyncTask.doInBackground(MainActivity.java:278)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at android.os.AsyncTask$2.call(AsyncTask.java:304)
05-09 08:34:42.680 24450 24728 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)

Do you know an idea of what could cause the problem?
PS: I am targetting opencl and not using the mali target.


#2

Did you autotune for your device? It could be that the default implementation allocates too many resources.


#3

No I didn’t, I am just running the code in the example.

Edit:
After trying autotuning (just running the tune_relay_mobile_gpu.py example in tutorials/autotvm directory), I get the error:

tvm/src/runtime/opencl/opencl_device_api.cc:263: No OpenCL platform matched given existing options ...

and it makes the android_rpc app client stop and restart itself.
The device is a Galaxy S6, running android API 24 64bit.
I don’t understand why it tells me that there are no opencl platform matching because I have found the opencl library in the device.
I have linked the android_rpc app with it and correctly set USE_OPENCL = 1 as well as APP_ABI = arm64-v8a.
Also TVM_NDK_CC is pointing to aarch64-linux-android-g++ which should be fine.