]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
vulkan: Switch MUL_MAT_VEC to 4 K per iteration for F16/32 (#22887)
authorMatt Corallo <redacted>
Wed, 27 May 2026 15:19:23 +0000 (15:19 +0000)
committerGitHub <redacted>
Wed, 27 May 2026 15:19:23 +0000 (17:19 +0200)
commitc6e40883767cafcad79e54de62dfe48e373f77e2
treef10b84071ae5011c997510e3dcdc8bc20f6c304a
parentb36eefc1b3fc805a4615ac05e8c5766d25ef0f76
vulkan: Switch MUL_MAT_VEC to 4 K per iteration for F16/32 (#22887)

* vulkan: Switch MUL_MAT_VEC to 4 K per iteration for F16/32

Against mesa git, this shows a 4.8% performance improvement for
tg128 on Qwen3.5-9B:BF16 on Intel BMG.

Note that this breaks some tests until the last commit which fixes
OOB A reads.

* vulkan: Use aligned loads in mul_mat_vec when available

Against mesa git, this shows a 3.3% performance improvement for
tg128 on Qwen3.5-9B:BF16 on Intel BMG.

* Make explicit that `num_rows` is <= `NUM_ROWS` in mul_mat_vec

Mesa's UUB logic can't see through conditionals, limiting its
ability to understand the bounds on the `num_rows` field in the
cleanup run. Making it explicit that `num_rows` is, indeed, always
<= `NUM_ROWS` helps mesa make slightly better codegen.

Against mesa git, this currently shows a 1% performance improvement
in tg128 on Qwen3.5-9B:BF16 on Intel BMG.

* vulkan: Fix OOB A reads in MUL_MAT_VEC for odd sizes

There was a TODO to fix the OOB reads from the A matrix which we do
here.

It is within performance noise (+<0.1%) in tg128 for
Qwen3.5-9B:BF16 on Intel BMG.
ggml/src/ggml-vulkan/vulkan-shaders/dequant_funcs.glsl
ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec.comp
ggml/src/ggml-vulkan/vulkan-shaders/types.glsl