Skip to content

opencl: optimize mul_mat_f16_f32 for decode - #24504

Merged
max-krasnyansky merged 1 commit into
ggml-org:masterfrom
qualcomm:lh/mul_mat_f16_f32_l4-improve
Jun 17, 2026
Merged

max-krasnyansky merged 1 commit into
ggml-org:masterfrom
qualcomm:lh/mul_mat_f16_f32_l4-improve

Conversation

@lhez

@lhez lhez commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Overview

The mul_mat_f16_f32 kernels do not perform well for decoding due to its work assignment, where each subgroup either produces a single result or in some cases half of a subgroup stays idle. This PR increase the work of each workgroup to better utilize the GPU.

Additional information

Details

X2-90

PR

Qwen3-4B-Q4_K_M

0.48.598.452 I common_perf_print: prompt eval time =   20985.58 ms /  4676 tokens (    4.49 ms per token,   222.82 tokens per second)
0.48.598.455 I common_perf_print:        eval time =   14928.94 ms /   256 runs   (   58.32 ms per token,    17.15 tokens per second)
3.26.829.685 I common_perf_print: prompt eval time =  169048.42 ms / 14325 tokens (   11.80 ms per token,    84.74 tokens per second)
3.26.829.702 I common_perf_print:        eval time =   25120.13 ms /   256 runs   (   98.13 ms per token,    10.19 tokens per second)

gpt-oss-20b

0.47.013.699 I common_perf_print: prompt eval time =   18237.25 ms /  4300 tokens (    4.24 ms per token,   235.78 tokens per second)
0.47.013.703 I common_perf_print:        eval time =    8852.76 ms /   256 runs   (   34.58 ms per token,    28.92 tokens per second)
2.52.422.941 I common_perf_print: prompt eval time =  136160.84 ms / 14407 tokens (    9.45 ms per token,   105.81 tokens per second)
2.52.422.944 I common_perf_print:        eval time =   12214.52 ms /   256 runs   (   47.71 ms per token,    20.96 tokens per second)

master

Qwen3-4B-Q4_K_M

0.54.648.710 I common_perf_print: prompt eval time =   21189.76 ms /  4676 tokens (    4.53 ms per token,   220.67 tokens per second)
0.54.648.713 I common_perf_print:        eval time =   21339.95 ms /   256 runs   (   83.36 ms per token,    12.00 tokens per second)
3.15.272.259 I common_perf_print: prompt eval time =  137888.39 ms / 14325 tokens (    9.63 ms per token,   103.89 tokens per second)
3.15.272.267 I common_perf_print:        eval time =   45096.29 ms /   256 runs   (  176.16 ms per token,     5.68 tokens per second)

gpt-oss-20b

0.50.996.600 I common_perf_print: prompt eval time =   17975.28 ms /  4300 tokens (    4.18 ms per token,   239.22 tokens per second)
0.50.996.604 I common_perf_print:        eval time =   13886.47 ms /   256 runs   (   54.24 ms per token,    18.44 tokens per second)

2.50.939.564 I common_perf_print: prompt eval time = 123867.44 ms / 14407 tokens ( 8.60 ms per token, 116.31 tokens per second)
2.50.939.573 I common_perf_print: eval time = 27281.53 ms / 256 runs ( 106.57 ms per token, 9.38 tokens per second)

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: Yes, used claude to perform profiling to identify the issue and suggest fix.

@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 Jun 12, 2026
@lhez
lhez marked this pull request as ready for review June 16, 2026 03:07
@lhez
lhez requested a review from a team as a code owner June 16, 2026 03:07

@max-krasnyansky max-krasnyansky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice perf bump!

@lhez

lhez commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@ggml-org/maintainers Can I get another approval please?

@max-krasnyansky
max-krasnyansky merged commit 5157172 into ggml-org:master Jun 17, 2026
28 of 33 checks passed
adrianhoehne pushed a commit to adrianhoehne/llama.cpp that referenced this pull request Jul 5, 2026
zommiommy pushed a commit to zommiommy/llama.cpp that referenced this pull request Aug 18, 2026
zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Sep 10, 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