Skip to content

opencl: add q4_k coop-k c8 GEMM for spec verify - #32716

Merged
max-krasnyansky merged 2 commits into
ggml-org:masterfrom
qualcomm:lh/coopk-q4_k-c8
Nov 23, 2026
Merged

max-krasnyansky merged 2 commits into
ggml-org:masterfrom
qualcomm:lh/coopk-q4_k-c8

Conversation

@lhez

@lhez lhez commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Overview

This PR adds c8Q4_K coop-k GEMM that handles up to 8 tokens. This kernel is dispatched for verification with tokens of 5 ~ 8.

Additional information

The kernel name kernel_gemm_coopk_q4_k_q8_1_dp4a_bin_c8 means it uses the bin kernel layout, does not mean that it is a bin kernel.

Details

gemma-4-E4B-it-Q4_K_M

with --spec-draft-n-max 7

master

I encoded 32099 tokens in   35.739 seconds, speed:  898.158 t/s
I decoded  257 tokens in    9.463 seconds, speed:   27.158 t/s
I
I n_draft   = 7
I n_predict = 257
I n_drafted = 469
I n_accept  = 190
I accept    = 40.512%

PR 

I encoded 32099 tokens in   35.869 seconds, speed:  894.904 t/s
I decoded  259 tokens in    8.020 seconds, speed:   32.294 t/s
I
I n_draft   = 7
I n_predict = 259
I n_drafted = 446
I n_accept  = 194
I accept    = 43.498%

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: Yes, Codex did guided implementation and refactoring.

@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 Nov 21, 2026
@lhez
lhez marked this pull request as ready for review November 22, 2026 05:32
@lhez
lhez requested a review from a team as a code owner November 22, 2026 05:32
@lhez

lhez commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

@max-krasnyansky @wanghqc please review/ack when you get a chance

@max-krasnyansky
max-krasnyansky merged commit 44d5087 into ggml-org:master Nov 23, 2026
35 of 37 checks passed
Kidplayer666 pushed a commit to Kidplayer666/llama.cpp that referenced this pull request Nov 23, 2026
* opencl: add q4_k coop-k c8 GEMM for spec verify

Co-authored-by: Hongqiang Wang <[email protected]>
Assisted-by: Codex

* opencl: enable q4_k c8 GEMM for n >= 2 for X2

---------

Co-authored-by: Hongqiang Wang <[email protected]>
wanghqc added a commit to qualcomm/llama.cpp that referenced this pull request Nov 26, 2026
OpenCL: x2ue's gated_delta_net kernel takes upstream's replay
(ggml_gated_delta_net_ext, ggml-org#31669) as a -DREPLAY build, on top of its
cache-fused state input/output and chunked prefill (which is not used with
replay). xielu, compact FA bias (indexed bias declined), softplus and async
input copies come from upstream. Upstream's coop-k c8 verify GEMMs
(ggml-org#32716, ggml-org#32909) are not taken: x2ue keeps its cok8 GEMMs. ggml-org#33013 (E17
quirks off by default) does not apply to x2ue's E17 handling. The coopmat
GEMM and MoE kernels (ggml-org#32686, ggml-org#32971) and the GDN QK offset fix (ggml-org#32747)
were already in x2ue.
speculative.cpp keeps x2ue's single DFlash implementation. GDN tests follow
upstream (no snapshot K); x2ue's verify-width perf cases now compare replay
and plain.
Mr-J-369 pushed a commit to Mr-J-369/llama.cpp-Android that referenced this pull request Nov 26, 2026
* opencl: add q4_k coop-k c8 GEMM for spec verify

Co-authored-by: Hongqiang Wang <[email protected]>
Assisted-by: Codex

* opencl: enable q4_k c8 GEMM for n >= 2 for X2

---------

Co-authored-by: Hongqiang Wang <[email protected]>
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