Skip to content

cuda : GGML_CUDA_PREFILL_OPT default on for Ada (cc 8.9) too - #480

Open
sb32445 wants to merge 1 commit into
PrismML-Eng:prismfrom
sb32445:pr-prefill-opt-ada
Open

sb32445 wants to merge 1 commit into
PrismML-Eng:prismfrom
sb32445:pr-prefill-opt-ada

Conversation

@sb32445

@sb32445 sb32445 commented Nov 26, 2026

Copy link
Copy Markdown

Overview

Turns GGML_CUDA_PREFILL_OPT on by default for Ada (cc 8.9), as suggested in #445. One line in ggml_cuda_prefill_opt plus the comment.

RTX 4070 (cc 8.9), Ternary-Bonsai-2-27B PTQ1_0, q4_0 K/V, llama-bench -p 2048 -n 0 -b 2048, 5 reps x 2 order-swapped passes, against GGML_CUDA_PREFILL_OPT=0:

-ub off (tok/s) default on (tok/s) change
512 1425.0 1509.5 +5.9 %
2048 1342.2 1459.4 +8.7 %

The gain comes from GGML_CUDA_FWHT_MMQ with GGML_CUDA_FWHT_MMQ_GLU: setting only those two gave the same numbers (1503.6 / 1456.5 against 1504.2 / 1456.2 with GGML_CUDA_PREFILL_OPT=1, separate run).

Additional information

Test results

  • Hardware / software: RTX 4070 12 GB (AD104, cc 8.9), Linux 6.18, NVIDIA driver 620.73, CUDA 13.5, GCC 16.2; Release build, -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=89.
  • Base: prism at f70247610.
  • Model: Ternary-Bonsai-2-27B (PTQ1_0), q4_0 K/V, flash attention on.

Requirements

🤖 Generated with Claude Code

Measured 2026-11-26 on an RTX 4070 (cc 8.9) with llama-bench pp2048, 5 reps x 2 order-swapped passes,
against GGML_CUDA_PREFILL_OPT=0: PTQ1_0 prefill +5.9 % (-ub 512) and +8.7 % (-ub 2048). The gain comes
from GGML_CUDA_FWHT_MMQ with _GLU (same numbers with only those two switches). Perplexity is identical
and 3 chat prompts x 128 greedy tokens are byte-identical. PQ2_0 not measured.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@bri-prism bri-prism left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this is a clean one. The table plus the check that the gain comes from GGML_CUDA_FWHT_MMQ with FWHT_MMQ_GLU alone makes the attribution clear, and identical perplexity, byte-identical greedy outputs and a full CUDA test-backend-ops pass cover the "byte-identical" contract this switch promises. PQ2_0 and other Ada cards being unmeasured is fine here since the paths are output-identical, so the worst case is no gain. Approving. Heads-up: this and #310 both touch the FWHT q8 path in ggml-cuda.cu, so whichever lands second may need a quick rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants