Skip to content

opencl: do not call OpenCL 3.0 API functions for older drivers - #25673

Merged
lhez merged 1 commit into
ggml-org:masterfrom
qualcomm:hq/opencl-pre-30-buffer-props
Jul 15, 2026
Merged

opencl: do not call OpenCL 3.0 API functions for older drivers#25673
lhez merged 1 commit into
ggml-org:masterfrom
qualcomm:hq/opencl-pre-30-buffer-props

Conversation

@wanghqc

@wanghqc wanghqc commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Overview

The PR is to fix a bug for older OpenCL drivers. The API functions clCreateBufferWithProperties and cl_mem_properties are OpenCL 3.0. Building with GGML_OPENCL_TARGET_VERSION < 300 fails to compile, and linking against a pre-3.0 driver fails with "cannot locate symbol clCreateBufferWithProperties" -- so the backend cannot be built for an Adreno whose driver predates 3.0 (e.g. the Adreno 642L, which reports OpenCL 2.0).

No functional change for any device that reports OpenCL 3.0.

Additional information

For Adreno A6x. A7x and beyond all supports OpenCL 3.0.

Requirements

clCreateBufferWithProperties and cl_mem_properties are OpenCL 3.0. Building with
GGML_OPENCL_TARGET_VERSION < 300 fails to compile, and linking against a pre-3.0
driver fails with "cannot locate symbol clCreateBufferWithProperties" -- so the
backend cannot be built for an Adreno whose driver predates 3.0 (e.g. the Adreno
642L, which reports OpenCL 2.0).

The call is the cl_qcom_large_buffer allocation retry, which only runs when
adreno_use_large_buffer is set. That is never the case on such a driver, so the
path is dead there. Compile it out below 3.0.

No functional change for any device that reports OpenCL 3.0.
@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning OpenCL Issues specific to the OpenCL backend labels Jul 14, 2026
@lhez
lhez marked this pull request as ready for review July 14, 2026 20:58
@lhez
lhez requested a review from a team as a code owner July 14, 2026 20:58
@lhez
lhez requested a review from max-krasnyansky July 14, 2026 21:03
@lhez
lhez merged commit 12127de into ggml-org:master Jul 15, 2026
26 checks passed
@wanghqc
wanghqc deleted the hq/opencl-pre-30-buffer-props branch July 19, 2026 15:59
CowboyTim pushed a commit to aardbeiplantje/llama.cpp that referenced this pull request Jul 21, 2026
smalinin pushed a commit to smalinin/llama.cpp that referenced this pull request Aug 4, 2026
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning OpenCL Issues specific to the OpenCL backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants