vulkan: add IQ4_XS MMQ/MMV matmul kernels - #28415
Conversation
|
As some general feedback, please avoid making ggml-vulkan codepaths that are unnecessarily vendor-specific. I don't think there's a reason for this to be limited to AMD, you can probe the layout in the shader and avoid hardcoding vendor- and compiler-version-specific layouts in the shader. I asked codex to fix this and it took all of five minutes and it runs fine on NV. Similarly, I don't think there's a reason this is iq4_xs-specific, though I didn't go through the exercise of enabling and testing the other types. From a skim it looks like the code is there, it just needs to be plugged in. FWIW, on the n=512 iq4_xs perf test, I get 106 TFLOPS on the original coopmat1 path, 134 TFLOPS on this change's coopmat1 path, though still trailing coopmat2's 171 TFLOPS. There could still be room for improvement with some tile size tuning! |
|
The vendor-specific part is an unmarked copy of #27952 ... |
|
@jeffbolznv you can move that feedback to my PR, but the reason was simply that probing the layout costs registers that I do not have available. I'd rather wait to make it generic once maintenance1 is available in the main drivers (non-beta). |
|
Yeah, this is my bad, I should've split it into the part stacked on top of #27952 and the separate one. Will do so. |
Assisted-by: OpenAI Codex
3eec699 to
deb084b
Compare
|
All right, @jeffbolznv @0cc4m this branch now only has the standalone changes, the coopmat1 changes were moved to another PR that targets #27952 |
|
See #28426 (comment) for a comparison of this PR to #28426 on unsloth/Qwen3.8-27B-UD-Q3_K_XL (40% of runtime is IQ4_XS). #28426 performs slightly better than this variant on my RX 9070 XT (radv) |
Here you go llama-bench -m Qwen3.8-27B-UD-Q3_K_XL.gguf -ngl 99 -fa on -n 3 -r 4096 -p 0
But as @WakeUpMorty mentioned in #28426 (comment), it might not be an "either or" for the two approaches. Also they got slightly different numbers
so the two variants are probably pretty close in practice |
|
I am about to head out on vacation and will be away from my system. Since I wasn't expecting three PRs with overlapping or identical changes to arrive at the same time, I wanted to provide some initial data before I leave. These updates will definitely need more extensive testing across a broader range of hardware. However, I managed to run a few quick benchmarks on my setup. Here is what I found: Models:
Qwen3.8-27B-UD-Q3_K_XL.gguf
Qwen3.8-27B-UD-IQ4_XS.gguf
gemma-4-12b-it-IQ4_XS.gguf
Qwen3.8-27B-UD-Q3_K_XL.ggufSource: C:\Users\PC\Desktop\llama-28415\bench-28415-3models fa.bat
Binaries:
Environment InfoOS:
|
|
Please rebase |
Overview
Added dedicated MMV / MMQ IQ4_XS MAT_MUL kernels that avoid the generic path with float conversion which was slow.
Additional information
IQ4_XS MUL_MAT
IQ4_XS MUL_MAT_ID
Requirements