Repository navigation
cuda : turn on the measured prefill and PQ2_0 decode defaults on A100, B200 and RTX PRO 6000 - #460
Merged
Merged
Conversation
…n the collapse kernel, extc keeps 5-8 (opt-in) The base-3 collapse multi-column kernel (GGML_METAL_PTQ1_MULTICOL=1, by @Karim-Mattar) computes the same dot product as mul_mv_ext over the integers; only the float accumulation order differs. Until now the extc path claimed 2-4 rows first whenever GGML_METAL_PTQ1_COEF was on, so the two could not be combined. With GGML_METAL_VERIFY_COLLAPSE=1, 2-4 rows take the collapse kernel and 5-8 rows keep extc. Measured on M5 Pro with a 4B ternary PTQ1_0 model, llama-bench -p N -n 0 -r 5, two passes, against the GGML_METAL_VERIFY_OPT default: pp2 150.9 -> 189.6 (+26%), pp3 132.6 -> 180.8 (+36%), pp4 129.4 -> 222.5 (+72%), pp5 and pp8 unchanged. KL against the stock path at -ub 2 and -ub 4 (16 wikitext chunks) is at the stock-vs-stock floor (mean 0, max 6.5e-5 and 6.1e-5). test-backend-ops -b MTL0 -o MUL_MAT -p type_a=ptq1_0: 255/255. Opt-in because the logits are not bit-identical to mul_mv_ext.
metal : PTQ1_0 verify at 2-4 rows on the collapse kernel, extc keeps 5-8 (GGML_METAL_VERIFY_COLLAPSE, opt-in)
…00 class GPUs too Measured 2026-11-24 with llama-bench pp2048, 5 reps x 2 order-swapped passes, against GGML_CUDA_PREFILL_OPT=0: PTQ1_0 prefill +37% (B200), +10% (A100), +27% (RTX PRO 6000); PQ2_0 +16% / +9% / +17%. 128 greedy tokens of PTQ1_0 are byte-identical on all three. Ada stays off (unmeasured).
…umn decode Measured 2026-11-24, llama-bench tg128, 5 reps x 2 order-swapped passes: +23% on A100 (86.4 -> 106.3) and +17% on B200 (147.6 -> 172.0). RTX PRO 6000 and RTX 4090 were neutral and keep the generic kernel for one and two columns. A100 greedy output is byte-identical. On B200 the float summation order differs from the generic kernel: llama-perplexity --kl-divergence at -ub 1 (16 chunks of 512) against the generic kernel at -ub 1 gives mean KL 1.15e-4, max 7.4e-3, same top token 99.56%. For scale, the generic kernel at -ub 1 against itself at -ub 512 gives mean KL 1.2e-4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Turns on the measured CUDA defaults from #452 on more GPUs.
Now targets
prism. #452 merged intoprismbefore #457 merged into the #452 branch, so #457 (the opt-in MetalGGML_METAL_VERIFY_COLLAPSEswitch, 2 Metal files) never reachedprism. This branch sits on top of #457 and brings it in too.GGML_CUDA_PREFILL_OPTis on by default for A100 (cc 800), B200 (cc 1000) and RTX PRO 6000 / RTX 50 (cc 1200-1299), not just Hopper.Why
#452 turned these on only for Hopper because H200 was the only GPU measured. The other datacenter and workstation GPUs gain about as much.
How
One file,
ggml/src/ggml-cuda/common.cuh: the architecture checks inggml_cuda_prefill_opt,ggml_cuda_pq2_mc_minandggml_cuda_pq2_multicol, plus aGGML_CUDA_CC_BLACKWELL_DC(1000) define.GGML_CUDA_PREFILL_OPT=0andGGML_CUDA_PQ2_MC_MIN=3restore the #452 behaviour.Measurements
One pod per GPU on 2026-11-24, built from this branch's code.
llama-bench -p 2048 -n 128 -r 5 -ngl 99 -fa 1, 2 order-swapped passes, tok/s, againstGGML_CUDA_PREFILL_OPT=0 GGML_CUDA_PQ2_MC_MIN=3:Correctness:
test-backend-ops -b CUDA0for MUL_MAT, GATED_DELTA_NET, ROT_MATVEC and RMS_NORM passes on all three GPUs. One run on RTX PRO 6000 had 1 MUL_MAT failure out of 3091. Both settings passed 3091/3091 on the A100 rerun, and B200 passed in its job.llama-perplexity --kl-divergence, 16 chunks of 512, both at-ub 1, gives mean KL 1.15e-4, max 7.4e-3 and same top token 99.56%. The generic kernel run twice gives 0. For scale, the generic kernel at-ub 1against-ub 512gives mean KL 1.2e-4. If B200 should stay bit-identical,ggml_cuda_pq2_mc_mincan keep 3 there, which gives up the +17% decode.Not measured:
GGML_CUDA_PREFILL_OPTon.