fix(llama_cpp): disable OpenCL backend to avoid Adreno CB.dll crash on Windows-on-Snapdragon - #1430
Conversation
…n Windows-on-Snapdragon The Qualcomm Adreno OpenCL driver (CB.dll v32.0.172.0) fail-fast crashes (0xC0000409) any process that calls clGetPlatformIDs on Windows-on-Snapdragon builds (OS 26000+). llama.cpp's OpenCL backend initializes at startup regardless of --compute, so linking it poisons the whole process: every GGUF/llama_cpp model load crashes the server before any compute begins. The Hexagon (NPU) and CPU backends cover the Snapdragon NPU/CPU path and do not touch the OpenCL driver, so disable OpenCL in the llama_cpp plugin build. NPU+CPU hybrid offload continues to work (verified: GGUF models run, NPU and CPU both active). Qairt models were unaffected because QNN/HTP talks to the NPU directly and never loads the OpenCL driver.
|
Hi Joshua Timothy (@jdtimothy) thanks for your contribution, if you can deep dive on this issue? We can not simply disable OpenCL flag because it will influence on others like CLI |
David Qian (@Davidqian123) I apologize; I meant for this PR to land on my fork. But here is the issue, As of right now we cannot use GenieX in Hermes Agent to run GGUF models because the GenieX serve crashes instantly. I tracked it down to a driver issue with OpenCL. Once that is disabled, you can run models in Hermes Agent with GenieX on the NPU and CPU. Here's the issue: #1431 |
Problem
On Windows-on-Snapdragon (OS build 26000+), every GGUF/llama_cpp model crashes the geniex serve process with exit code
0xC0000409(STATUS_STACK_BUFFER_OVERRUN / fail-fast) — before any inference begins. Qairt models work fine.Root cause
The Qualcomm Adreno OpenCL driver (
CB.dll, v32.0.172.0, in theqcdx8480driver store) fail-fast crashes any process that callsclGetPlatformIDs.llama.cpp's OpenCL backend (used for Adreno GPU offload) initializes at startup regardless of
--compute cpu/npu, becauseggml.dllstatically importsggml-opencl.dll. So merely loading a GGUF model triggers OpenCL init -> CB.dll crashes the whole process.Isolated reproduction confirms it is not geniex or llama.cpp:
OpenCL.dllalone -> survivesclGetPlatformIDs()-> instant0xC0000409CB.dllinqcdx8480.inf_arm64_*Why Qairt worked
The QNN/HTP runtime talks to the Hexagon NPU directly and never loads the OpenCL driver.
Fix
Disable the OpenCL backend in the llama_cpp plugin build (
set(GGML_OPENCL OFF)). The Hexagon (NPU) + CPU backends cover the Snapdragon path and do not touch the broken OpenCL driver.Verification
After disabling OpenCL and rebuilding, GGUF models (lfm2, gemma-4-4B, gpt-oss-20b) serve successfully on geniex. Task Manager shows both the NPU and CPU active during inference (hybrid offload working). A full Hermes agent session ran end-to-end against a GGUF model through geniex.
Note
This is a workaround for a Qualcomm OpenCL driver bug. The ideal long-term fix is a corrected Adreno OpenCL driver (
CB.dll) that does not crash onclGetPlatformIDs. Until then, disabling OpenCL unblocks NPU/CPU hybrid GGUF inference on Snapdragon Windows.