Repository navigation
qwen3_5 CUDA: windows of 2-8 rows run at 4 and 8 rows, not 16 (#2909) - #2934
Merged
Merged
Conversation
Owner
Author
|
GB10 checks on this head (Qwen3.8-27B MLX 4-bit, main against this PR, base new new base):
One-stream code cells are level (+0.0% to +0.3%). Tokens are equal, and the chat cell (serial and concurrent turns over a 30k-token history, thinking off and on) resumes with every reply equal on both arms. CI is green. Queued to land.
|
ashhart
force-pushed
the
lead/q35-cuda-small-buckets
branch
from
November 13, 2026 00:30
3edd7e7 to
1572881
Compare
A decode window of 4 rows was captured at 16 rows, so lane_gemv loaded and stored 12 padding rows and attention launched their dead blocks. Shape.init now buckets 1 row as 1, 2-4 as 4, 5-8 as 8, and larger windows as before. Every kernel takes its live rows from the staged segment table and MMA rows are independent, so a row keeps the bits of the same one-row step. Warm-up and the cost table follow the new keys: seven buckets instead of five warm at start, and the live-width tests pin the new call counts. The shapes tests now run in the qwen35 module and get their own host step.
ashhart
force-pushed
the
lead/q35-cuda-small-buckets
branch
from
November 13, 2026 17:03
1572881 to
f32e6cc
Compare
ashhart
added a commit
that referenced
this pull request
Nov 13, 2026
Figures and scope corrected to the PRs (#2948, #2863, #2934, #2933, #2921, #2906, #2878, #2892, #2851, #2728, #3072, #2915, #2864, #2854 and others), promises of later work removed (#2903, #2875, #1630, #1720), #3074 and #3047/#3046 said as their PRs scope them, the duplicate #2861, #2585, #2321 and #2719 entries and two copies of released 1.2.5 lines removed, #1953's line named for its PR, and a line for #3255. Released sections unchanged.
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.
Fixes #2909.
On CUDA, every Qwen 3.5/3.6/3.8 window over one row padded to a multiple of 16. At four streams, a 4-row decode window ran as 16:
lane_gemvloaded, multiplied and stored 12 padding rows, and attention launched the matching dead blocks.Shape.initnow buckets 1 row as 1, 2-4 as 4, 5-8 as 8, and larger windows as before (cuda_shapes.zig:19). An audit of everyShape.totalread inqwen3_5/cuda_*.zigfound nothing that assumes a multiple of 16: they're per-row counts and grids, row-table lengths, real rows, a trace label and the prompt tail. Warm-up already captures each distinct key.Exact: every kernel takes its live rows from the segment table, and MMA rows are independent. Cheaper 2-8-row windows change the measured window costs, so the lanes may pick different widths, but replies must not change.
Tests: the shape test fails on main ("expected 4, found 16") and passes here (4 for 2-4 rows, 8 for 5-8, 16 for 9).
Not yet checked on a GB10: a 4- and an 8-row window's logits equal to the same window at total 16 and to one-row steps, served 4-stream replies byte-equal to main, and the A/B (expected +0.5-2% at four streams).