ggml-opencl: add opt-in Adreno xmem F16xF32 GEMM for prefill#22755
Open
happyyzy wants to merge 1 commit intoggml-org:masterfrom
Open
ggml-opencl: add opt-in Adreno xmem F16xF32 GEMM for prefill#22755happyyzy wants to merge 1 commit intoggml-org:masterfrom
happyyzy wants to merge 1 commit intoggml-org:masterfrom
Conversation
|
Hi @happyyzy, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
Author
|
Thanks for the note. I closed the other open PR (#22117) and will focus on this smaller xmem GEMM PR first. |
Contributor
|
Thank you - this is much easier. Will take a closer look in the next few days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an opt-in Adreno xmem GEMM path for OpenCL prefill matmul.
Scope:
GGML_OPENCL_USE_ADRENO_KERNELSGGML_OPENCL_ADRENO_XMEM_GEMM=1F16 x F32 -> F32GGML_OP_MUL_MATN > 1, so token-generation / GEMV decode is not routed through this pathThe implementation keeps the existing ggml tensor layout externally and uses a small bridge around the xmem GEMM:
The generic OpenCL matmul path remains unchanged unless the new runtime opt-in is set.
Results
Tested on Adreno 830 with OpenCL:
Qwen2.5 1.5B F16
Before, baseline OpenCL:
After, with
GGML_OPENCL_ADRENO_XMEM_GEMM=1:Prefill improved from
204.98 tok/sto356.19 tok/s, about1.74x.Qwen2.5 3B F16
Before, baseline OpenCL:
After, with
GGML_OPENCL_ADRENO_XMEM_GEMM=1:Prefill improved from
101.26 tok/sto163.90 tok/s, about1.62x.Decode is intentionally unchanged. Decode-only profiling confirmed that token generation stays on the existing OpenCL path (
adreno_xmemcount = 0).Correctness
Checked end-to-end generation with the xmem path enabled on Qwen2.5 1.5B F16 and Qwen2.5 3B F16. Both models produced normal decode output.
Notes
This path depends on Qualcomm Adreno OpenCL subgroup constant-load extensions and is therefore guarded behind the existing Adreno kernel build option plus an explicit runtime environment variable.
Requirements