What phone support tensorflow lite GPU delegate?
Hi @ldfandian 

Can you please add the following to the Android manifest in order to detect GPU delegate.

```
<uses-library android:name="libOpenCL.so"
           android:required="false"/>

<uses-library android:name="libOpenCL-pixel.so"
           android:required="false"/>
```

Thanks.
 > Hi @ldfandian
> 
> Can you please add the following to the Android manifest in order to detect GPU delegate.
> 
> ```
> <uses-library android:name="libOpenCL.so"
>            android:required="false"/>
> 
> <uses-library android:name="libOpenCL-pixel.so"
>            android:required="false"/>
> ```
> 
> Thanks.

Thanks for the quick response.

I tried to add the following code in AndroidManifest.xml, but it does not work.

```
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:taskAffinity=""
        tools:ignore="AllowBackup">

        <uses-native-library
            android:name="libOpenCL.so"
            android:required="false" />
        <uses-native-library
            android:name="libOpenCL-pixel.so"
            android:required="false" />
        <uses-native-library
            android:name="libGLESv2.so"
            android:required="false" />
        <uses-native-library
            android:name="libGLESv3.so"
            android:required="false" />
        <uses-native-library
            android:name="libvulkan.so"
            android:required="false" />
        <uses-native-library
            android:name="libneuralnetworks.so"
            android:required="false" />

        <uses-library
            android:name="libOpenCL.so"
            android:required="false" />
        <uses-library
            android:name="libOpenCL-pixel.so"
            android:required="false" />
        <uses-library
            android:name="libGLESv2.so"
            android:required="false" />
        <uses-library
            android:name="libGLESv3.so"
            android:required="false" />
        <uses-library
            android:name="libvulkan.so"
            android:required="false" />
        <uses-library
            android:name="libneuralnetworks.so"
            android:required="false" />
        ...
```

Btw, on the Xiaomi 12s Ultra, I checked that the file "/system/vendor/lib64/libOpenCL.so" does exist.
However, it looks like it does not show in the "/system/etc/public.libraries.txt".
Maybe it is the cause? Meaning that the mobile vendor blocks the GPU delegate?

The content of "/system/etc/public.libraries.txt" and "/etc/public.libraries.txt" is like:
```
# See https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md
libandroid.so
libaaudio.so
libamidi.so
libbinder_ndk.so
libc.so
libcamera2ndk.so
libdl.so
libEGL.so
libGLESv1_CM.so
libGLESv2.so
libGLESv3.so
libicu.so
libicui18n.so
libicuuc.so
libjnigraphics.so
liblog.so
libmediandk.so
libm.so
libnativehelper.so
libnativewindow.so
liblistenjni.qti.so
liblistensoundmodel2.qti.so
libneuralnetworks.so nopreload
libOpenMAXAL.so
libOpenSLES.so
libRS.so
libstdc++.so
libsync.so
libvulkan.so
libwebviewchromium_plat_support.so
libz.so
```

The content of "/vendor/etc/public.libraries.txt" and "/system/vendor/etc/public.libraries.txt" is like:
```
libqti-perfd-client.so
libadsprpc.so
libcdsprpc.so
libsdsprpc.so
libfastcvopt.so
libOpenCL.so
libSNPE.so
libmialgo_ai_vision.so
libmialgo_utils.so
libxmi_slow_motion_mein.so
```


Here is the logcat info:
```
2023-06-10 01:19:29.175 30415-22047 AdrenoGLES-0            org....examples.imageclassification  I  QUALCOMM build                   : 5e81ec0141, Icc5bd9b9d5
                                                                                                    Build Date                       : 11/07/22
                                                                                                    OpenGL ES Shader Compiler Version: EV031.36.08.11
                                                                                                    Local Branch                     : 
                                                                                                    Remote Branch                    : 
                                                                                                    Remote Branch                    : 
                                                                                                    Reconstruct Branch               : 
2023-06-10 01:19:29.175 30415-22047 AdrenoGLES-0            org....examples.imageclassification  I  Build Config                     : S P 12.1.1 AArch64
2023-06-10 01:19:29.175 30415-22047 AdrenoGLES-0            org....examples.imageclassification  I  Driver Path                      : /vendor/lib64/egl/libGLESv2_adreno.so
2023-06-10 01:19:29.175 30415-22047 AdrenoGLES-0            org....examples.imageclassification  I  Driver Version                   : 0615.50
2023-06-10 01:19:29.181 30415-22047 AdrenoGLES-0            org....examples.imageclassification  I  PFP: 0x01730155, ME: 0x00000000

...

2023-06-10 01:30:26.249  6749-25290 libEGL                  org....examples.imageclassification  E  pre_cache appList: com.sina.weibo,com.ss.android.article.news,com.taobao.taobao,com.smile.gifmaker,com.ss.android.ugc.aweme,com.tencent.mm,tv.danmaku.bili,
...
2023-06-10 01:26:11.511  6746-24015 libEGL                  org....examples.imageclassification  E  call to OpenGL ES API with no current context (logged once per thread)
...


```
 An update, after adding those uses-library/uses-native-library settings in AndroidManifest.xml, OnePlus 8T works but the other three devices still don't work...

I compared the their content of /system/etc/public.libraries.txt, but find nothing different among these devices.

What's the magic here? Hi @ldfandian,

Have you tried using our acceleration service to see which configuration might be optimal for each of your phones? https://www.tensorflow.org/lite/android/acceleration_service

Have you checked the documentation here: https://www.tensorflow.org/lite/android/delegates/gpu_native ?

Also for more information, are you using an emulator or the actual phones? > Hi @ldfandian,
> 
> Have you tried using our acceleration service to see which configuration might be optimal for each of your phones? https://www.tensorflow.org/lite/android/acceleration_service
> 
> Have you checked the documentation here: https://www.tensorflow.org/lite/android/delegates/gpu_native ?
> 
> Also for more information, are you using an emulator or the actual phones?

Thanks for the advice.

Good to know it, but my phone does not have a Google play service installed~ No worries, @ldfandian did the documentation help at all? Additionally please let us know if you are using emulators or actual phones or some combination of them. Thanks. > No worries, @ldfandian did the documentation help at all? Additionally please let us know if you are using emulators or actual phones or some combination of them. Thanks.

All of these (Xiaomi 12s Ultra, OnePlus 8, Honor Nova 10, Oppo Reno 9) are real phones sold in China. Hi @sirakiin, can you please take a look? Triage to @grantjensen . Could you help on this? Thanks! Hi @ldfandian, looking at the GPU's used in these devices (Adreno 730, Adreno 642L) we have full support. I was able to confirm this via the following commands:

`bazel build -c opt --config=android_arm64 --copt=-DCL_DELEGATE_NO_GL third_party/tensorflow/lite/tools/benchmark:benchmark_model `

`adb push blaze-bin/third_party/tensorflow/lite/tools/benchmark/benchmark_model /data/local/tmp`

`adb push test.tflite /data/local/tmp`

`adb shell /data/local/tmp/benchmark_model --use_gpu=true --graph=/data/local/tmp/test.tflite`

This way we can confirm whether your issue is confined to TFL code or something broader. Please run the above code & let me know how it goes, thanks.
 This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60825">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60825">No</a>
 Actually, I have similar issue too. I cannot do GPU prediction on Phone. 

Tensorflow : 2.9
Androind : 13
Phone - Samsung A73 5G

I am getting this flag as False
compatList.isDelegateSupportedOnThisDevice: false
<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Support

### Have you reproduced the bug with TF nightly?

No

### Source

binary

### Tensorflow Version

2.12.0

### Custom Code

No

### OS Platform and Distribution

Android 13

### Mobile device

Android 13

### Python version

3.8.3

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

I tested multiple mobile phones (including Xiaomi 12s Ultra, OnePlus 8, Honor Nova 10, Oppo Reno 9) using the example Android apk at https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/android . On all of the devices, the app tells "GPU is not supported", but NNAPI and CPU is OK.

Anything I can do to enable the GPU delegate on these Qualcomm Snapdragon devices?

### Standalone code to reproduce the issue

```shell
the example Android apk at https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/android
```


### Relevant log output

_No response_</details>