An error occurred: clGetPlatformIDs returned -30

On MTK platform, OpenCL calls GPU for deep learning inference, error occurred: clGetPlatformIDs returned -30.


tflite  : Initialized TensorFlow Lite runtime.
tflite  : Created TensorFlow Lite delegate for GPU.
tflite  : Replacing 70 node(s) with delegate (TfLiteGpuDelegateV2) node, yielding 1 partitions.
vndksupport: Could not load from sphal namespace: dlopen failed: library "" not found.
tflite  : clGetPlatformIDs returned -30
tflite  : Falling back to OpenGL
tflite  : Initialized OpenGL-based API.
tflite  : TfLiteGpuDelegate Init: No shader implementation for transpose
tflite  : Created 0 GPU delegate kernels.
tflite  : TfLiteGpuDelegate Prepare: delegate is not initialized
tflite  : Node number 70 (TfLiteGpuDelegateV2) failed to prepare.
tflite  : Restored original execution plan after delegate application failure.


Errors similar to this when running on Android can be found in the TensorFlow issues: For instance:

Immediately preceding Falling back to OpenGL is typically some OpenCL load or init failure.

Best guess: your shared library load error:

vndksupport: Could not load from sphal namespace: dlopen failed: library "" not found.

possibly triggered while dynamically loading the OpenCL shared library, might be the cause of your OpenCL init failure.

Related info on Android VNDK and SP-HALs:

And it could be that the “GSL” in refers to the user-mode Graphics Support Layer:

for instance, in Qualcomm Adreno graphics drivers (in this context, KGSL refers to the kernel-mode graphics support layer, fwiw).

Hi @Dark_Photon

Thank you for your answer.

Yes, the key log that causes the GPU call to fail should be:

vndksupport: Could not load from sphal namespace: dlopen failed: library "" not found.

The problem is most likely to occur when init opencl.

You have listed some documentation below related to Qualcomm support for GSL, is this adapted by the chip manufacturer (e.g. Qualcomm)?
Indeed, we have it working fine on the Qualcomm platform, but it’s on the MTK platform that the GPU calls fail.

Is there any way to run OpenCL properly on the MTK platform?


You didn’t really provide much info. Re “MTK Platform”, you didn’t specify what that was or even provide a context in which that makes sense. It may mean something specific in your company or organization, but not to the world.

Does this stand for MediaTek? If so, that still doesn’t specify a platform, including a specific GPU and GPU drivers. Some (all?) MediaTek chipsets make use of other vendor’s GPUs. For instance:

these make use of ARM Mali GPUs, …and so probably use ARM firmware, drivers, and libraries to support them.

So what is “MTK Platform”?

Re the Qualcomm links, my point in mentioning them was just because you didn’t state what is supposed to be on your platform. At least in the Qualcomm GPU world, seems to be used for Graphics Support Layer code, which their GPU libraries such as OpenCL might reasonably be depending on.

But regardless, you’ll need to figure out what this library is on your system, why it’s not being found, and resolve that. Get with whoever provided you that platform or MediaTek for details. I’m guessing, but I suspect that fixing that issue will resolve your problem trying to load+use the OpenCL library on that platform.

Hi @Dark_Photon

I’m sorry I didn’t describe my problem correctly.

The “MTK platform” mentioned above is the MediaTek mt6895, with a Mali-G610 GPU.

I have created a new issue to MTK for help, thank you for your help!