cuda: enable the Hopper wgmma Q1_0/Q2_0 prefill path by default - #106
Open
bri-prism wants to merge 1 commit into
Open
cuda: enable the Hopper wgmma Q1_0/Q2_0 prefill path by default#106bri-prism wants to merge 1 commit into
bri-prism wants to merge 1 commit into
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.
bri-prism
force-pushed
the
perf/hopper-q1-default-on
branch
from
August 3, 2026 17:39
11ce95e to
89a1103
Compare
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
Flips the runtime gate on the Hopper (sm_90a) wgmma prefill path from opt-in to opt-out. In a build configured with
GGML_CUDA_HOPPER_Q1, the path is now active unlessGGML_HOPPER_Q1_DISABLEis set.The build-time option is deliberately left off by default, because it requires a CUTLASS checkout via
GGML_CUDA_CUTLASS_DIRand would otherwise break configuration for everyone else. See "Scope" below for what that means in practice.Why
The path had never been built or exercised. It turns out to work, and to be worth having on for the shapes it serves.
Validated internally on Hopper with a three-arm comparison: baseline build, this build with the path off, and this build with the path on. The path-off arm matches baseline closely on every measurement, so the sm_90a plus CUTLASS build costs nothing by itself and the improvement is attributable to the path rather than to the build. Prefill improves; decode is unaffected, which is the expected behaviour for a prefill-only path and a useful check that nothing leaked into the wrong dispatch.
The gain is larger for the wider of the two low-bit types, consistent with it having more unpack work for int8 wgmma to absorb, and shrinks as the token count grows, so standard MMQ closes the gap on long prompts. Numbers are in the internal notes rather than here.
Numerics
This path is not bit-identical to standard MMQ. It quantizes activations to int8 with a coarser per-128-K absmax scale where q8_1 uses per-32, and the original source comment flagged it for validation. That validation has now been done, using the same binary with only the env flag differing, against a same-path control to establish the floor.
The deviation is small and the tail is bounded. Perplexity moves well inside its error bar, and a small fraction of tokens change their argmax. It is acceptable for the prefill gain, but it is a behaviour change rather than a pure optimization, which is why the opt-out exists and why the measured figures are recorded in the source comment for whoever reads this next.
Scope and what is not changed
GGML_CUDA_HOPPER_Q1still defaults off at configure time. Shipping this in release binaries is a separate CI question, since the build image would need CUTLASS. Happy to do that as a follow-up if we want it in prebuilt artifacts.Test plan
arch=compute_90a,code=[compute_90a,sm_90a]with CUTLASS includes.test-backend-ops test -b CUDA0, zero failures in both arms.