Skip to content

glm cuda tp2: opt-in one routed-expert pass per prompt pair with 128-row items - #4493

Merged
ashhart merged 7 commits into
mainfrom
lead/glm-pair-experts
Nov 22, 2026
Merged

ashhart merged 7 commits into
mainfrom
lead/glm-pair-experts

Conversation

@ashhart

@ashhart ashhart commented Nov 22, 2026

Copy link
Copy Markdown
Owner

What this changes

In a GLM prompt pair, each chunk's routed NVFP4 experts ran as separate gate/up and down launches with 64-row items, so an expert with many tokens re-read its weights. With TF_GLM_PAIR_EXPERTS=1, router and shared experts run for A then B, then one grouped gate/up and one down launch serve both chunks with 128-row items (WM=2, RT=4), each chunk keeping its own weights, activations and outputs and the same prompt_tiles arithmetic and epilogues. Four routed launches per MoE layer become two. Default off; included in the rank agreement.

Checks

  • compile-cuda-tests, host tests, fmt, ast-check, lean, 600-line cap.

Still to run

Two GB10s: kernel contract (paired vs independent outputs byte for byte, skewed routing, empty experts), then pp8k and pp32k A-B-B-A with final prompt logits and 256 following decode tokens compared. Kill on any difference or under +5% on either.

@ashhart

ashhart commented Nov 22, 2026

Copy link
Copy Markdown
Owner Author

GB10 TP=2 A/B (GLM-5.3-Flash NVFP4, two boxes, --parallel 2, 64K context, no prompt cache). Base = this PR with the switch off, new = the same tree with TF_GLM_PAIR_EXPERTS on (a local flip-default commit), both on main with #4427; order base new new base, four prompts per size per run:

base new
pp8k prefill 5.36-5.41 s 5.12-5.15 s (+4.8% tok/s)
pp32k prefill 21.32-21.52 s 20.25-20.52 s (+5.4% tok/s)
pp2k, steady 1.26-1.27 s 1.25-1.27 s (level)

Tokens 36/36 equal. The first 2K prompt after boot is slow in some runs of both arms (2.50 s new, 1.74 s base), so it is not counted. Exact and faster on long prompts, so this goes into the landing train as an opt-in.

  • Synthena

Add an opt-in 128-pair routed pass for two prompt chunks, retaining separate shared experts, combines and chunk scratch. Cover routing skew and production-size byte equality in the CUDA oracle.
…fill

#3659 (TF_GLM_MOE_DIRECT) sums a direct decode window with combineTail inside
fill; this PR split fill into shared and combine. shared now stops after the
shared expert on a direct window (no slot put), and fill does the combineTail
there, so the direct path runs the same launches in the same order as on main.
Paired prompt chunks never take the direct path.
@ashhart
ashhart force-pushed the lead/glm-pair-experts branch from 94ccda2 to 1bc687b Compare November 22, 2026 12:04
@ashhart
ashhart merged commit 2e637e6 into main Nov 22, 2026
3 of 12 checks passed
@ashhart
ashhart deleted the lead/glm-pair-experts branch November 22, 2026 12:04
ashhart added a commit that referenced this pull request Nov 22, 2026
Under TF_GLM_PREFILL_REDUCE=split (the default), #4510 made the partials
exchange send peers' partials only, and glueRows takes the rank's own partial
as its own argument. The paired path (#4493, TF_GLM_PAIR_EXPERTS=1) passed 0
there since its rebase onto #4510, so hc_post read an unwritten slot for the
rank's own rows. It now passes r.b.part at the rank's first row, as the
unpaired path does. The default path (switch off) is unchanged.
ashhart added a commit that referenced this pull request Nov 22, 2026
Under TF_GLM_PREFILL_REDUCE=split (the default), #4510 made the partials
exchange send peers' partials only, and glueRows takes the rank's own partial
as its own argument. The paired path (#4493, TF_GLM_PAIR_EXPERTS=1) passed 0
there since its rebase onto #4510, so hc_post read an unwritten slot for the
rank's own rows. It now passes r.b.part at the rank's first row, as the
unpaired path does. The default path (switch off) is unchanged.
plotarmordev added a commit to plotarmordev/TensorFold that referenced this pull request Nov 23, 2026
… beside Mini's soft-capped limit2 and keep_full_lone
plotarmordev added a commit to plotarmordev/TensorFold that referenced this pull request Nov 24, 2026
…s pair arguments and the soft-cap limit2; host test drops promptSmem asserts main moved to experts_prompt_layout.zig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant