mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

<uses-native-library> missing in Android LLM Inference Guide

Open bringert opened this issue 1 year ago • 4 comments

Description of issue (what needs changing)

Add manifest tags <uses-native-library> to Android LLM Inference Guide

Clear description

The Android LLM Inference Guide https://developers.google.com/mediapipe/solutions/genai/llm_inference/android doesn't mention the need to add <uses-native-library> to AndroidManifest.xml.

Those tags are present in the example code https://github.com/googlesamples/mediapipe/blob/main/examples/llm_inference/android/app/src/main/AndroidManifest.xml:

        <!-- Required to initialize the LlmInference -->
        <uses-native-library
            android:name="libOpenCL.so"
            android:required="false"/>
        <uses-native-library android:name="libOpenCL-car.so" android:required="false"/>
        <uses-native-library android:name="libOpenCL-pixel.so" android:required="false"/>

Without them, I get a SIGABRT with these messages:

E0000 00:00:1713429439.990396    7017 calculator_graph.cc:887] FAILED_PRECONDITION: CalculatorGraph::Run() failed: Calculator::Open() for node "LlmGpuCalculator" failed: Can not open OpenCL library on this device - undefined symbol: clSetPerfHintQCOM
F0000 00:00:1713429439.990602    7017 llm_engine.cc:126] Check failed: graph_->WaitUntilIdle() is OK (FAILED_PRECONDITION: CalculatorGraph::Run() failed: Calculator::Open() for node "LlmGpuCalculator" failed: Can not open OpenCL library on this device - undefined symbol: clSetPerfHintQCOM) 
terminating.
F0000 00:00:1713429439.990602    7017 llm_engine.cc:126] Check failed: graph_->WaitUntilIdle() is OK (FAILED_PRECONDITION: CalculatorGraph::Run() failed: Calculator::Open() for node "LlmGpuCalculator" failed: Can not open OpenCL library on this device - undefined symbol: clSetPerfHintQCOM) 
terminating. 

Correct links

No response

Parameters defined

No response

Returns defined

No response

Raises listed and defined

No response

Usage example

No response

Request visuals, if applicable

No response

Submit a pull request?

No response

bringert avatar Apr 18 '24 08:04 bringert

Hi @bringert,

Thank you for bringing this to our attention. We are forwarding the issue internally and will work to include it in our documentation soon.

Thank you!!

kuaashish avatar Apr 19 '24 09:04 kuaashish

Hi @schmidt-sebastian,

Could you please look into this issue?

Thank you!!

kuaashish avatar Apr 19 '24 09:04 kuaashish

cc @ktonthat

schmidt-sebastian avatar Apr 19 '24 17:04 schmidt-sebastian

Also seeing this in the image generator example:

2024-09-24 07:04:37.256 15964-16036 native com...pipe.examples.imagegeneration E E0000 00:00:1727175877.254845 16036 diffuser_gpu.cc:88] FAILED_PRECONDITION: Can not open OpenCL library on this device - undefined symbol: clSetPerfHintQCOM 2024-09-24 07:04:37.251 15964-15964 mediapipe/16036 com...pipe.examples.imagegeneration W type=1400 audit(0.0:1415): avc: denied { getattr } for path="/dev/pmsg0" dev="tmpfs" ino=381 scontext=u:r:untrusted_app_32:s0:c193,c256,c512,c768 tcontext=u:object_r:pmsg_device:s0 tclass=chr_file permissive=0 app=com.google.mediapipe.examples.imagegeneration 2024-09-24 07:04:37.258 15964-16031 native com...pipe.examples.imagegeneration E E0000 00:00:1727175877.258202 16031 calculator_graph.cc:898] INTERNAL: CalculatorGraph::Run() failed: Calculator::Open() for node "mediapipe_tasks_vision_image_generator_imagegeneratorgraph__StableDiffusionIterateCalculator" failed: ; RET_CHECK failure (mediapipe/tasks/cc/vision/image_generator/diffuser/stable_diffusion_iterate_calculator.cc:253) context_ 2024-09-24 07:04:37.271 15964-16031 AndroidRuntime com...pipe.examples.imagegeneration E FATAL EXCEPTION: DefaultDispatcher-worker-1 Process: com.google.mediapipe.examples.imagegeneration, PID: 15964 com.google.mediapipe.framework.MediaPipeException: internal: CalculatorGraph::Run() failed: Calculator::Open() for node "mediapipe_tasks_vision_image_generator_imagegeneratorgraph__StableDiffusionIterateCalculator" failed: ; RET_CHECK failure (mediapipe/tasks/cc/vision/image_generator/diffuser/stable_diffusion_iterate_calculator.cc:253) context_ at com.google.mediapipe.framework.Graph.nativeWaitUntilGraphIdle(Native Method) at com.google.mediapipe.framework.Graph.waitUntilGraphIdle(Graph.java:471) at com.google.mediapipe.tasks.core.TaskRunner.create(TaskRunner.java:74) at com.google.mediapipe.tasks.vision.imagegenerator.ImageGenerator.createFromOptions(ImageGenerator.java:167) at com.google.mediapipe.tasks.vision.imagegenerator.ImageGenerator.createFromOptions(ImageGenerator.java:96) at com.google.mediapipe.examples.imagegeneration.ImageGenerationHelper.initializeImageGenerator(ImageGenerationHelper.kt:32) at com.google.mediapipe.examples.imagegeneration.diffusion.DiffusionViewModel$initializeImageGenerator$3.invokeSuspend(DiffusionViewModel.kt:66) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@92a9449, Dispatchers.Default]

TEC-IST avatar Sep 24 '24 11:09 TEC-IST