Commit 263d181
committed
feat(paged): default-on full-step MoE-decode CUDA graph (grouped MMQ, patch 0043)
D1 lever. The MUL_MAT_ID CUDA-graph guard ([TAG_MUL_MAT_ID_CUDA_GRAPHS])
disables CUDA graphs for the WHOLE decode step whenever a MUL_MAT_ID node has
ne[2] > mmvq_mmid_max (8 for NVFP4 on sm_121) - i.e. for every multi-token
decode. Patch 0025 showed the path actually taken on Blackwell NVFP4,
should_use_mmq()==true -> grouped stream-k MMQ id-branch, launches on one
stream with NO host sync (only the per-expert host-loop fallback synchronizes),
so the disable is conservative and graphs are safe for the grouped path - but
0025 left it behind an opt-in env (LLAMA_MOE_FORCE_GRAPHS), so by default the
host re-issued every kernel of the step.
D1 profiling (GB10 sm_121, q36-35b-a3b-nvfp4, batched-bench -fa on, npl128)
settled the mechanism:
- The grouped MMQ NVFP4 path IS what runs in decode: cudaStreamSynchronize
count is IDENTICAL with graphs on vs off (1457 either way) - the per-expert
host-loop fallback (the only device->host routing readback) is never hit.
MoE routing is already device-side.
- Steady-decode GPU-busy is ~99% (1% idle): static decode is GPU-bound, not
host-sync-bound. The host cost is per-step kernel RE-ISSUE, removed by
replaying a captured full-step graph (incl. the MoE dispatch).
So make the grouped-path graph capture ON BY DEFAULT; LLAMA_MOE_NO_FORCE_GRAPHS=1
forces the conservative pre-0025 disable for A/B. should_use_mmq() is the exact
guard: it returns FALSE for the large-M NVFP4 prefill (patch 0034), which
deliberately drops to the per-expert host-sync loop, so PREFILL keeps graphs
disabled (correct - that path syncs). Decode-only behaviour change; prefill and
the stock llama-cpp backend are untouched.
BIT-EXACT: greedy md5 byte-identical default(on)==LLAMA_MOE_NO_FORCE_GRAPHS(off)
==legacy LLAMA_MOE_FORCE_GRAPHS - paged-MoE 8cb0ce23777bf55f92f63d0292c756b0,
paged-dense 5951a5b4d624ce891e22ab5fca9bc439 (both match the recorded baselines).
Measured (GB10, batched-bench paged decode S_TG, default-on vs opt-out):
npl 32 467.3 vs 444.3 t/s +5.2%
npl 128 788.2 vs 768.1 t/s +2.6%
Assisted-by: Claude:opus-4.8 [Claude Code]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>1 parent 920ab5f commit 263d181
1 file changed
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3358 | 3358 | | |
3359 | 3359 | | |
3360 | 3360 | | |
3361 | | - | |
3362 | | - | |
3363 | | - | |
3364 | | - | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
3365 | 3375 | | |
3366 | | - | |
| 3376 | + | |
3367 | 3377 | | |
3368 | 3378 | | |
3369 | 3379 | | |
| |||
0 commit comments