Repository navigation
cuda: enable the Hopper wgmma Q1_0/PQ2_0 prefill path by default - #171
Merged
Merged
Conversation
Inverts the runtime gate from opt-in (GGML_HOPPER_Q1) to opt-out (GGML_HOPPER_Q1_DISABLE) for builds configured with GGML_CUDA_HOPPER_Q1. The build-time flag is unchanged and still off by default, since it requires a CUTLASS checkout. Validated internally: prefill improves for the shapes this path serves and decode is unaffected. A control arm with the path disabled matches baseline, so the sm_90a plus CUTLASS build costs nothing by itself. The per-128-K activation scale is coarser than q8_1's per-32, so results are not bit-identical. The deviation was measured against a same-path control; it is small and the tail is bounded.
4 of 5 tasks
…ment GGML_CUDA_CC_BLACKWELL is 1200, the sm120 family, not the start of Blackwell. Blackwell spans CC 1000, 1100 and 1200, so the old cc >= GGML_CUDA_CC_BLACKWELL bound let sm_100 and sm_110 reach an sm_90a wgmma kernel. That was unreachable while the path was opt-in and becomes reachable once it defaults on, so bound the dispatch to the 900 series. Also use GGML_CUDA_CC_HOPPER instead of a literal 900. The macro does exist in this tree, contrary to the comment that was there. The file comment is shortened to the concise form AGENTS.md asks for and no longer points at notes a reader of this repo cannot open.
bri-prism
force-pushed
the
perf/hopper-q1-default-on-prism
branch
from
September 14, 2026 03:33
29ed1bb to
2c66a75
Compare
imaami
pushed a commit
to imaami/llama.cpp
that referenced
this pull request
Oct 13, 2026
Build the CUTLASS-based sm_90a path when GGML_CUDA_HOPPER_Q1 is enabled. Select it for supported prefill shapes and retain the existing MMQ fallback. Source: PrismML-Eng#171 Source commits (PrismML-Eng/llama.cpp): 0845962 6ac5eb0 Co-authored-by: bri-prism <[email protected]> Assisted-by: GitHub Copilot Assisted-by: OpenAI Codex Ported and rebased by Codex.
imaami
pushed a commit
to imaami/llama.cpp
that referenced
this pull request
Oct 13, 2026
Build the CUTLASS-based sm_90a path when GGML_CUDA_HOPPER_Q1 is enabled. Select it for supported prefill shapes and retain the existing MMQ fallback. Source: PrismML-Eng#171 Source commits (PrismML-Eng/llama.cpp): 0845962 6ac5eb0 Co-authored-by: bri-prism <[email protected]> Assisted-by: GitHub Copilot Assisted-by: OpenAI Codex Ported and rebased by Codex.
imaami
pushed a commit
to imaami/llama.cpp
that referenced
this pull request
Nov 2, 2026
Build the CUTLASS-based sm_90a path when GGML_CUDA_HOPPER_Q1 is enabled. Select it for supported prefill shapes and retain the existing MMQ fallback. Source: PrismML-Eng#171 Originally written by bri-prism in PrismML-Eng#39: 576fdf6 0ce8b19 Source commits (PrismML-Eng/llama.cpp): 0845962 6ac5eb0 Co-authored-by: Pasha Khosravi <[email protected]> Assisted-by: GitHub Copilot Assisted-by: OpenAI Codex Ported and rebased by Codex.
imaami
pushed a commit
to imaami/llama.cpp
that referenced
this pull request
Nov 24, 2026
Build the CUTLASS-based sm_90a path when GGML_CUDA_HOPPER_Q1 is enabled. Select it for supported prefill shapes and retain the existing MMQ fallback. Source: PrismML-Eng#171 Originally written by bri-prism in PrismML-Eng#39: 576fdf6 0ce8b19 Source commits (PrismML-Eng/llama.cpp): 0845962 6ac5eb0 Co-authored-by: Pasha Khosravi <[email protected]> Assisted-by: GitHub Copilot Assisted-by: OpenAI Codex Ported and rebased by Codex.
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.
Replaces #169, which had its base changed in place from
prism-v7toprismand picked up four unrelated commits as a result. This is a fresh branch offprismwith only the two Hopper commits cherry-picked, which is what @khosravipasha asked for on that PR. It applies without conflict.What
Turns the Hopper wgmma Q1_0/PQ2_0 prefill path on by default when the build option is set, and tightens the architecture guard. One file, +7/-7.
GGML_HOPPER_Q1(opt-in) becomesGGML_HOPPER_Q1_DISABLE(opt-out). The path is active by default when built withGGML_CUDA_HOPPER_Q1. A default build is unaffected: the file is compiled out.cc >= GGML_CUDA_CC_BLACKWELLtocc >= 1000.Why the bound changed
GGML_CUDA_CC_BLACKWELLis 1200 in this tree, and the define carries its own comment noting that Blackwell spans CC 1000, 1100 and 1200 with the macro naming the sm_120 family specifically. So the old guard admitted sm_100 and sm_110 Blackwell parts into an sm_90a wgmma path they cannot run.cc >= 1000excludes the whole Blackwell range, which is what the surrounding comment always claimed the guard did.The lower bound now uses
GGML_CUDA_CC_HOPPER(900) instead of a literal. The old inline comment said no such macro existed in this tree. It does, atcommon.cuh:56.Validation
@khosravipasha ran these two commits cherry-picked onto
prismhead on an L40S (sm_89, CUDA 12.8):GGML_CUDA_HOPPER_Q1=ONwith CUTLASS, arch 89 + 90a: builds clean,GGML_CUDA_CC_HOPPERresolves,test-backend-ops -o MUL_MAT1283/1283 in both buildsThat confirms the runtime gate keeps Ada on standard MMQ even with the path compiled in.
Still outstanding
The H100 re-run after the gate inversion has not been done. The original measurements were taken with the path opt-in. Nobody has re-measured on actual Hopper since it became default-on, and since the architecture bound changed. Neither @khosravipasha nor I have a Hopper card in front of us. Please do not treat this as a validated Hopper result until that runs.
Nothing in shipped release binaries changes either way, since the build option stays off by default.