Skip to content

fix(llama_cpp): disable OpenCL backend to avoid Adreno CB.dll crash on Windows-on-Snapdragon - #1430

Closed
Joshua Timothy (jdtimothy) wants to merge 1 commit into
qualcomm:mainfrom
jdtimothy:fix/disable-opencl-cb-dll-crash
Closed

fix(llama_cpp): disable OpenCL backend to avoid Adreno CB.dll crash on Windows-on-Snapdragon#1430
Joshua Timothy (jdtimothy) wants to merge 1 commit into
qualcomm:mainfrom
jdtimothy:fix/disable-opencl-cb-dll-crash

Conversation

@jdtimothy

Copy link
Copy Markdown

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 the qcdx8480 driver store) fail-fast crashes any process that calls clGetPlatformIDs.

llama.cpp's OpenCL backend (used for Adreno GPU offload) initializes at startup regardless of --compute cpu/npu, because ggml.dll statically imports ggml-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:

  • Load OpenCL.dll alone -> survives
  • Call clGetPlatformIDs() -> instant 0xC0000409
  • Windows WER fault module = CB.dll in qcdx8480.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 on clGetPlatformIDs. Until then, disabling OpenCL unblocks NPU/CPU hybrid GGUF inference on Snapdragon Windows.

…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.
@Davidqian123

Copy link
Copy Markdown
Contributor

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

@jdtimothy

Joshua Timothy (jdtimothy) commented Sep 4, 2026

Copy link
Copy Markdown
Author

Hi Joshua Timothy (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
Go ahead and close this PR, as it is only a workaround for people trying to serve genieX in Hermes Agent or OpenClaw. It would be great to get the OpenCL issue fixed.

@jdtimothy
Joshua Timothy (jdtimothy) deleted the fix/disable-opencl-cb-dll-crash branch September 4, 2026 21:18
@jdtimothy
Joshua Timothy (jdtimothy) restored the fix/disable-opencl-cb-dll-crash branch September 4, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants