Repository navigation
[Perf] deepseek_v4: run FlashInfer autotune for block-FP8 models served as MXFP8 - #44842
Conversation
e60e94e to
bf8fec1
Compare
This comment has been minimized.
This comment has been minimized.
|
/rerun-test registered/unit/model_executor/runner/test_flashinfer_autotune_sync.py registered/unit/server_args/test_server_args.py |
|
🚀 🚀 |
|
/rerun-test registered/e2e/models/test_deepseek_v41_flash_gb300_tp4ep4.py registered/e2e/models/test_deepseek_v4_flash_fp4_megamoe_b200.py |
|
🚀 🚀 |
bf8fec1 to
1abc2e1
Compare
|
/rerun-test registered/unit/model_executor/runner/test_flashinfer_autotune_sync.py registered/unit/server_args/test_server_args.py registered/e2e/models/test_deepseek_v41_flash_gb300_tp4ep4.py registered/e2e/models/test_deepseek_v4_flash_fp4_megamoe_b200.py |
|
|
GB300 validation, DEP2 (TP2 attention-DP2 EP2), MegaAttention + MegaMoE + Mega-mHC, decoder bounded replay, eager prefill, device prefix cache only, same stack with and without this change (jobs 3471 / 3470, torch profiler on rank 0). The worker log shows
Launch count is unchanged (1,854 per step), and this eager step is dispatch-bound, so the single-chunk wall barely moves even though 18 ms of kernel time disappears; the gain shows where steps run back to back (128K prompt, -7%) and will show fully once the launch-count reductions land. Cached-prefix extend cells report the full expected cached-token count. |
1abc2e1 to
a7d12e3
Compare
|
/rerun-test registered/unit/model_executor/runner/test_flashinfer_autotune_sync.py registered/unit/server_args/test_server_args.py registered/e2e/models/test_deepseek_v41_flash_gb300_tp4ep4.py registered/e2e/models/test_deepseek_v4_flash_fp4_megamoe_b200.py |
|
🚀 🚀 🚀 🚀 |
…s MXFP8 `should_run_flashinfer_autotune` only recognised FP8 dense GEMMs as tunable for `quantization == "mxfp8"` (and modelopt per-tensor FP8). DeepSeek-V4.1 checkpoints are block-FP8 [32, 32] with ue8m0 scales that the FP8 linear method serves through the MXFP8 view on FlashInfer CuTe-DSL (the same `mm_mxfp8` op), and the model's `autotune_prefill_kernels` hook exists to tune exactly those GEMMs at the prefill token ceiling. Because the gate returned False, neither the decode pass nor that hook ever ran, and every dense MXFP8 GEMM in prefill used FlashInfer's untuned fallback tactic (`pin_tactic` stays on since `mxfp8_prefill_autotune_min_tokens` is never set). Measured on GB300 with the torch profiler, one 16K-token DEP2 prefill chunk per rank: the FlashInfer `dense_blockscaled_gemm_sm100` kernel runs 210 times per step at 221 us average, 46.5 ms of a 322 ms step; the shapes are the fused wqkv_a (N=1792, K=5120), wq_b (N=32768, K=1280) and wo_b (N=5120, K=8192) at M=16384, all on the untuned tactic. The same kernel's tuned tactics for these shapes are what the FlashInfer autotuner selects at warmup when it is allowed to run. The gate now also returns True when a resident FP8 linear serves block-FP8 as MXFP8 on a FlashInfer backend, so the existing decode pass and the DeepSeek-V4.1 prefill hook run and persist their tactics under SGLANG_CACHE_DIR as for mxfp8 models. Numerics: the tuned tactics change only the GEMM tile/cluster schedule; batch-invariant and deterministic modes keep the pinned tactic as before. Also drops the stale "temporarily skips mxfp8_gemm" help text (the workaround set is empty). Co-Authored-By: Claude Fable 5.1 <[email protected]>
a7d12e3 to
faba28a
Compare
|
/rerun-test registered/unit/model_executor/runner/test_flashinfer_autotune_sync.py registered/unit/server_args/test_server_args.py registered/e2e/models/test_deepseek_v41_flash_gb300_tp4ep4.py registered/e2e/models/test_deepseek_v4_flash_fp4_megamoe_b200.py |
|
🚀 🚀 🚀 🚀 |
…nchors -- entries 244/247-era surfaces, 301, sgl-project#44842, sgl-project#42973 Battery damage classes re-derived per-file POST-MERGE (CVD=9, prod venv, PYTHONPATH=python) with the B5-3/B5-4 code state: (1) test_modelopt_nvfp4_moe_scales 2F (SUBFAILED pair): merge took upstream's sgl-project#45289 test file and DROPPED the fork's entry-244 stub block (the small-M workspace gate reads placement attrs in process_weights_after_loading regardless of kernel support -- kwargs evaluate first). Stub block re-planted VERBATIM from the 309 tip. 20P/44sub (>= the pre-merge 20P/42sub: upstream grew two subtests). (2) test_fp4_gemm_backend_sm120 3F: upstream sgl-project#44842 (in-range) grew the autotune gate with get_parallel().enable_kv_cache_sharding (sgl-project#42973) + the FP8->MXFP8 module-tree pre-check; the gate tests' stubs predate both. Test re-anchored (get_parallel stub + empty module tree); the three beliefs (b12x keeps the pass, cutlass autotunes, marlin doesn't) unchanged. 12P/0F. (3) test_mem_pool_ep_unit 1F: the DOCUMENTED tip-era class, now attributed exactly: the test's id-contract predates entry-247 -- dispatcher skip TRUE for b12x vs the stale expected-False. Set re-pinned: dispatcher_global_ids += FLASHINFER_B12X_W4A16 (its expert_map contract, the very arm B5-3 re-planted into _keeps_global_expert_ids) and the LoRA subtraction gains b12x (no LoRA path). EXPERIMENTAL_SGL_TRTLLM verified HARMLESS without its removed arm: is_flashinfer_trtllm() covers the value by design (utils.py:212-217), confirming B5-3's upstream-churn verdict on that branch. 49P/0F/4sub -- class CLOSED, one fewer env-class than the pre-merge baseline. ENV CLASSES CONFIRMED (not new, not fixable here): trtllm_gen 8F == documented 8F; moe_fused_gate 52F == documented ~52F ALL 'No CUDA GPUs are available'; triton_fused_moe 96F == documented ~96F; round_robin 38F (documented 37 + 1 upstream-grown CUDA case, ALL 'No CUDA GPUs'); mega_moe_deepgemm 1F == documented 1F (test's deep_gemm fake vs mxfp4.py's in-range wrapper import -- NOT my redirect: fails identically at b3207c7 with mega_moe pre-B5-3; B2 marker :905 covers the test-side fix). GATE RE-CHECK: standard_dispatcher 21P (grew again, green), runner_backend 16P, fold probe 9P, overrides 121P/1S/210sub.
Motivation
Torch-profiler trace of DeepSeek-V4.1-Flash DEP2 prefill on GB300 (MegaAttention, MegaMoE, DSpark, 16K-token prefill budget per rank), one 16K-token cold chunk per rank, rank 0:
flashinfer_mm_mxfp8→ CuTe-DSLdense_blockscaled_gemm_sm100)Every one of these launches runs on FlashInfer's untuned fallback tactic: the server log has no autotune pass at all, and
Fp8LinearMethod.applykeepspin_tactic=Truefor block-FP8-as-MXFP8 layers until the prefill autotune hook setsmxfp8_prefill_autotune_min_tokens, which never happens.Why
should_run_flashinfer_autotunetreats FP8 dense GEMMs as tunable only forquantization == "mxfp8"(and modelopt per-tensor FP8). DeepSeek-V4.1 checkpoints are block-FP8[32, 32]withue8m0scales, whichFp8LinearMethodserves through the MXFP8 view on FlashInfer CuTe-DSL, the same tunablemm_mxfp8op. The model already hasautotune_prefill_kernels/wants_prefill_autotune(from #38798) to tune exactly those GEMMs at the prefill token ceiling, but it is only reached from the gated autotune pass, so it never ran.Modifications
should_run_flashinfer_autotune: also return True when a resident FP8 linear serves block-FP8 as MXFP8 on a FlashInfer CuTe-DSL/CUTLASS backend (_model_serves_block_fp8_as_mxfp8_on_flashinfer). The existing decode-shaped pass and the DeepSeek-V4.1 prefill hook then run and persist tactics underSGLANG_CACHE_DIR/flashinfer/autotune/...exactly as formxfp8models, so restarts stay fast.--flashinfer-autotune-skip-ops;FLASHINFER_AUTOTUNE_WORKAROUND_SKIPShas been empty since enable TRT-LLM for MiniMax M3 by preserving SwiGLU params #33962.pin_tacticoverride inFp8LinearMethod.applyis unchanged).Measured
GB300, DEP2 (TP2 + DP attention, EP2), DeepSeek-V4.1-Flash, MegaMoE, Mega-mHC, decoder bounded replay, eager prefill, 16K-token prefill budget per rank, rank 0. Main (job 3470,
2d3dd3168d) against this branch (job 3471). Startup log on the branch, both ranks:Running FlashInfer autotune with cache: .../flashinfer/autotune/0.7.1/sm103/.../rank_tp0_pp0_dp0.json.The step is dispatch-bound, so most of the 16.6 ms of removed GEMM time hides behind launch gaps on a single chunk; it shows fully on the 128K prompt.
Before: main, layer 6, 5.00 ms between the two mHC kernels.
After: this branch, same layer, 4.48 ms; the three dense GEMMs are the shorter purple slices.
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #39011298394
Latest PR Test (Extra): ❌ Run #39011298229
Latest PR Test (AMD ROCm 10): ❌ Run #39011298257