cuda : backport GGML_CUDA_FA_QUANTS from upstream (ggml-org/llama.cpp#28079) - #317
cheese-cakee wants to merge 1 commit into
Conversation
…er what is compiled (ggml-org#28079) * CUDA: add configurable FA quant combinations Assisted-by: Codex * remove all flags but , add runtime fallback with warning for uncompiled combination * Update docs/build.md Co-authored-by: Johannes Gäßler <johannesg@5d6.de> * apply code review comments --------- Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
|
Agreed on the order: #317 first. On #307 vs the FA commit in #285 (quantized-KV GQA decode on the in-place MMA kernel): one change, #307 with the On splitting #285: the branch was six commits, each of which applies cleanly on its own and on the current
The FA GQA-decode commit stays out, per the above. On the two speculative-deferral defects from the #221 review: both are fixed in |
Overview
Fixes #267.
Backport of upstream ggml-org#28079 (5a4d0fe, by @pwilkin). With the default CUDA build, a K/V type pair without a compiled vector kernel (for example q8_0/q4_0) is now converted to f16 on the GPU with a one-time warning, instead of being rejected by the CUDA backend and running flash attention on the CPU without any message:
GGML_CUDA_FA_QUANTSselects which pairs get native kernels (defaultq4_0-q4_0;q8_0-q8_0;f16-f16;bf16-bf16, orall).GGML_CUDA_FA_ALL_QUANTSstays as a deprecated alias forall.Additional information
The cherry-pick conflicted only in the
docs/build.mdoptions table (keptGGML_CUDA_PEER_MAX_BATCH_SIZE).fattn.cumerged without conflicts. The in-place q4_0/q8_0 MMA path from #221 still requiresK->type == V->type, so mixed pairs take the f16 conversion path.Testing on RTX 4050 Laptop (cc 8.9), CUDA 12.6, Linux (WSL2),
-DCMAKE_CUDA_ARCHITECTURES=89:test-backend-ops -o FLASH_ATTN_EXT:prismdefault build 2994/2994 with all mixed cases "not supported"; this PR default build 4007/4007, mixed cases pass against CPU.prismwithGGML_CUDA_FA_ALL_QUANTS=ONis also 4007/4007.-ngl 99 -fa 1,GGML_SCHED_DEBUG=2: onprismthe FLASH_ATTN_EXT nodes of all 28 layers run on CPU for q8_0/q4_0, f16/q8_0 and q4_0/q8_0; with this PR they run on CUDA0, and the warning is printed once per process.llama-bench, Qwen3-0.6B-Q8_0,-ngl 99 -fa 1 -t 8 -r 3, q8_0 K / q4_0 V, t/s, median of 5 alternating rounds:prismdefault (FA on CPU)prism+GGML_CUDA_FA_ALL_QUANTS=ONThe f16 conversion is much faster than the CPU fallback, but decode at long context is still slower than a compiled pair, which is what the warning says. For q8_0/q8_0 (already supported) the three builds are within run-to-run spread, except pp512 at depth 0, which varies by up to 15% between runs on this laptop.
Requirements