Repository navigation
qwen3_5 cuda: decode MLP gate and up as one segmented launch off GB10 (TF_QWEN_MLP_SEG, default off) - #6163
qwen3_5 cuda: decode MLP gate and up as one segmented launch off GB10 (TF_QWEN_MLP_SEG, default off)#6163jojomondag wants to merge 1 commit into
Conversation
… (TF_QWEN_MLP_SEG, default off) With the switch set, a decode window of 1 to 16 rows on a GPU with the split form runs the dense MLP gate and up projections through projMany, the segmented launch the key and value projections already take, instead of two launches. Each member keeps the bits of its own decode launch. Prompt rows, wider windows, learning runs and GB10 are unchanged. Refs ashhart#6153
Synthena Initial Review — Initial diff check passed (awaiting device run) (
|
|
The red I have not pushed it, since the hash is only right against the main it lands on and changes again when #6095 or #6098 lands first. If you would rather have it from me, say so and I merge main and re-pin. |
|
Thanks @jojomondag for the switch, the receipts and the pin diagnosis. What stands: the change is one gated condition and a 28-line module, the switch is default-off and registered as a profile-identical flag, the launch is the existing segmented What we still need is the A/B on our side, plus the cells your own checklist leaves open: a resumed prompt against a fresh one, and concurrent against solo, were not run on this change. Several streams and the drafter off were also not measured. The serving pin is the other open item — the re-pin depends on which main it lands on, so it stays with the landing. The A/B: RTX 5090, Qwen3.8-27B MLX-4bit with the DFlash2 drafter, the switch unset/set/set/unset in one run, token equality per cell, and the resumed-versus-fresh and concurrent-versus-solo cells added.
|
What this changes
Off GB10, a drafted decode round of the dense Qwen3.8-27B launches each layer's MLP gate and up projections as two GEMV launches over the same input; the key and value projections of the same round already share one segmented launch, and GB10 already runs gate and up as one. With
TF_QWEN_MLP_SEG=1(default off), on a GPU with the split form (e.affine.split != null, every GPU but GB10), a decode window of 1 to 16 rows runs gate and up throughprojMany, the segmented launch the key and value projections take. No kernel is added or changed:gemvSeggives each member the bits of its owndecode()launch, so gate and up are the same words and replies are unchanged. Unset, nothing changes.cuda_mlp_seg.zig(takeswithoutset) and the switch's registration removed, whenever you want it.0ba35fe6d, one commit (e37365463: the newzig/src/families/qwen3_5/cuda_mlp_seg.zigof 28 lines with its host test, one changed condition incuda_forward.zig, the switch's registration; 10 files, +42 −2). The branch merges into current main4e232d7c9without a conflict.atc overlap --json: run at 2026-12-03 08:54 UTC with ATC 0.9.6 one37365463. 57 open pull requests share files with this one. Of the 10 that could be test-merged, 4 conflict: EXL3 Flash Next: draft lane guard for offloaded experts (8/8) #1446 (2 files), GLM on CUDA: the latent split's per-rank page book and owner (TF_GLM_KV_SPLIT, #1431 part 1; stacked on #1411) #2415 (1), kv classes (#2444 C1): admission by owner class, the owner chosen once inside the reservation #3676 (1), MiMo-V2.6-Flash on CUDA (2x GB10) with DFlash as the drafter #728 (2). 47 could not be test-merged within ATC's limits (complete: false:timeLimit,pullRequestsLimit,pullFilesLimit,otherPullRequestsLimit,pullFilesUnavailable). Nothing is claimed or started.Checks on this head
e37365463on main0ba35fe6d.python3 tools/zig/lean_check.py, on the base and on this head: 88 and 88, the same findings (0 new).zig build -Dfixed-cpu test-host: exit 0, no failed step.zig build test-qwen35-mlp-seg-host(reached bytest-host): exit 0; with a wrong expectation planted (17 to 64 rows taking one launch), exit 1.zig fmt --check build.zig zigandgit diff --check: clean.zig build native -Dsm=120: compiles.Receipt
Main against branch: cells and numbers, or why they can't be run: the switch unset against set on the branch (unset is main's path), one RTX 5090, one server an arm (the switch is read once), order unset, set, set, unset in one run;
--drafter --kv-cache fp8 --prompt-precision int8 --context 262144 --parallel 1,tools/bench_long_decode.py --tokens 256, sampled replies (T=1, seed 1234) and one greedy reply an arm and cell; tok/s is all tokens over all decode time of a cell's replies:Ten more starts on the first cell (four unset, then six set, 4 replies each): 249.2 to 249.9 tok/s unset, 253.0 to 253.2 set (+1.4 %), every reply equal to the first server's. No
panicline in any server log. These ran on the tree before the commit named qwen3_5 cuda: decode MLP gate and up as one segmented launch off GB10 (opt-in TF_QWEN_MLP_SEG): decode +0.9 to +1.7 % on one RTX 5090, replies equal #6153; that tree differs from the head in one string, the issue number in the profile row.Hash runs (
tools/perf_receipt.pyof ci: add tamper-evident performance receipt hash run and GitHub verifier #6078), on this head, base0ba35fe6dagainst heade37365463,--pairs 2 --draft --check-draft, servers with--drafter --kv-cache fp8 --context 262144 --parallel 1; in all three the tokens are equal on all four prompts, the planted control diverged and drafted equals"draft": false(receipts attached in qwen3_5 cuda: decode MLP gate and up as one segmented launch off GB10 (opt-in TF_QWEN_MLP_SEG): decode +0.9 to +1.7 % on one RTX 5090, replies equal #6153 (comment)):TF_QWEN_MLP_SEG=1TF_QWEN_MLP_SEG=1The two runs with the switch set, back to back, do not agree on the size (0.4 and 1.3 %);
verifyfails run 1 on the 0.5 % floor and passes run 2. The receipts are in the issue comment, not committed: a receipt committed on the branch cannot name the commit that holds it (the question is open on cuda w4a8: smaller tiles of the int8 prompt GEMM where the 128x128 grid leaves SMs idle (TF_QWEN_INT8_TILES, default off) #6098).One start I cannot explain, as in the issue: in my first run of this branch, made while a compiler was building on the same host, one of the two set servers returned other replies than the other three from its first decode on. 62 further starts (30 unset, 32 set), 40 of them during a build and 8 under memory pressure, all returned the first server's replies. I kept that server's log and can send it.
Boxes it reaches: Qwen 3.5/3.8 dense with MLX affine 4-bit weights on CUDA off GB10, decode windows of 1 to 16 rows, only with the switch set. Prompt rows, windows of 17 or more rows, learning runs, EXL3 and ModelOpt MLPs and GB10 (its own one-launch path) keep their launches.
New switch? Default, accepted values, profile row:
TF_QWEN_MLP_SEG,0or1, unset0, profile classidentical, indocs/environment.md,docs/environment-names.md,platform/environment.zig,environment_valid_cases.zig,core/profile.zigand the CLI's environment list. No stored-data change.Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: head
e37365463on main0ba35fe6d,zig build native -Dsm=120, Zig 0.17.0, nvcc 13.4; one RTX 5090 32 GB (170 SMs), driver 615.78.08, Ryzen 7 9800X3D, Linux, nothing else on the GPU during a timed run;TensorFold/Qwen3.8-27B-MLX-4bit@22d8d538, drafterz-lab/Qwen3.8-27B-DFlash2@50307d4c.Paths and platforms the change reaches, which I ran and which I could not: ran on sm_120 (170 SMs): one stream, drafted, greedy and sampled, cold and 20k/86k cached. Could not run: other SM classes, several streams.
Exactness, from
tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: the fixture's token and output hashes in every server (one start excepted, above), and the hash runs' four prompts (base and head token-equal, drafted equal to"draft": false).Main against this branch, same machine and checkpoint, posted before asking for a run on our machines (or why you can't): the table above (unset is main's path) and the hash runs (main's binary against the head's).
Decode speed before and after, from
tools/bench_openai.py: the tables above.Prompt speed before and after: n/a, the switch is read only for decode windows of 1 to 16 rows.
Licence of any new weights or drafter, or "n/a": n/a
Checklist
The title and description match the head commit, including the receipt and the stack.
New tests fail before the change, pass after it, and skip cleanly without their dependency.
Comments and docstrings are one line. No measurements or history in the source.
No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
Drafted output equals
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. Drafted against"draft": falseis shown by the hash runs on one prompt; a resumed prompt against a fresh one and concurrent against solo were not run on this change.No precision traded for speed. If the bits change, the description says which sums change and why.
Decode and prompt processing are no slower than main at one stream and the widest admitted; with
--drafter, no slower than without it, greedy and sampled. Measured: one stream with--drafter. Several streams and the drafter off were not measured.