Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not open OpenCL library on this device - undefined symbol: clGetCommandBufferInfoKHR #886

Open
AIWintermuteAI opened this issue Feb 14, 2025 · 0 comments
Assignees
Labels
type:support Support Issues

Comments

@AIWintermuteAI
Copy link

When using TFLite shared lib with GPU delegate (compiled from the tag 2.16.1 by following https://ai.google.dev/edge/litert/build/cmake#cross-compilation and applying the patch from this issue) in Android studio, I get

2025-02-14 16:00:03.179  7456-7456  xample.test_cpp         com.example.test_cpp                 W  Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
2025-02-14 16:00:03.188  7456-7456  CompatChangeReporter    com.example.test_cpp                 D  Compat change id reported: 309578419; UID 10208; state: ENABLED
2025-02-14 16:00:03.204  7456-7456  xample.test_cpp         com.example.test_cpp                 W  Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
2025-02-14 16:00:03.221  7456-7456  tflite                  com.example.test_cpp                 I  Initialized TensorFlow Lite runtime.
2025-02-14 16:00:03.222  7456-7456  tflite                  com.example.test_cpp                 I  Created TensorFlow Lite delegate for GPU.
2025-02-14 16:00:03.231  7456-7456  tflite                  com.example.test_cpp                 I  Replacing 46 out of 46 node(s) with delegate (TfLiteGpuDelegateV2) node, yielding 1 partitions for the whole graph.
2025-02-14 16:00:03.240  7456-7456  tflite                  com.example.test_cpp                 E  Can not open OpenCL library on this device - undefined symbol: clGetCommandBufferInfoKHR
2025-02-14 16:00:03.240  7456-7456  tflite                  com.example.test_cpp                 E  Falling back to OpenGL
2025-02-14 16:00:03.240  7456-7456  tflite                  com.example.test_cpp                 E  TfLiteGpuDelegate Init: OpenGL-based API disabled
2025-02-14 16:00:03.240  7456-7456  tflite                  com.example.test_cpp                 I  Created 0 GPU delegate kernels.
2025-02-14 16:00:03.240  7456-7456  tflite                  com.example.test_cpp                 E  TfLiteGpuDelegate Prepare: delegate is not initialized
2025-02-14 16:00:03.240  7456-7456  tflite                  com.example.test_cpp                 E  Node number 46 (TfLiteGpuDelegateV2) failed to prepare.
2025-02-14 16:00:03.240  7456-7456  tflite                  com.example.test_cpp                 E  Restored original execution plan after delegate application failure.
2025-02-14 16:00:03.240  7456-7456  MAIN                    com.example.test_cpp                 E  Inference error code -3
2025-02-14 16:00:03.303  7456-7456  HWUI                    com.example.test_cpp                 W  Unknown dataspace 0
2025-02-14 16:00:03.361  7456-7471  EGL_emulation           com.example.test_cpp                 I  Opening libGLESv1_CM_emulation.so
2025-02-14 16:00:03.361  7456-7471  EGL_emulation           com.example.test_cpp                 I  Opening libGLESv2_emulation.so
2025-02-14 16:00:03.379  7456-7471  HWUI                    com.example.test_cpp                 W  Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2025-02-14 16:00:03.379  7456-7471  HWUI                    com.example.test_cpp                 W  Failed to initialize 101010-2 format, error = EGL_SUCCESS

That happens both when running the app in Emulator (Android 15 Medium Phone API 35) on Mac M1, and also when running on the physcial phone connected with wireless debugging (Samsung A34 running Android 13 Tiramisu). The error appears here (I'm around 95% sure this is the place)

        auto* delegate = TfLiteGpuDelegateV2Create(/*default options=*/nullptr);
        if (new_state->interpreter->ModifyGraphWithDelegate(delegate) != kTfLiteOk) {
            printf("ERROR: ModifyGraphWithDelegate failed\n");
        }

I have already tried solution offered in most of the places, which is adding libOpenCL.so to Android Manifest...

Image

Unfortunately, the error still persists.

@gaikwadrahul8 gaikwadrahul8 self-assigned this Feb 18, 2025
@gaikwadrahul8 gaikwadrahul8 added the type:support Support Issues label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:support Support Issues
Projects
None yet
Development

No branches or pull requests

2 participants