Repository navigation
[Fix] runtime: Version FlashInfer caches for default-tactic tuning. - #44514
Conversation
|
/rerun-test test/registered/unit/model_executor/runner/test_flashinfer_autotune_sync.py::TestAutotuneCachePath.test_default_candidate_uses_new_stable_cache_namespace test/registered/unit/model_executor/runner/test_flashinfer_autotune_sync.py::TestAutotuneCachePhases.test_target_and_draft_cache_reuse |
|
🚀 |
|
/rerun-test test/registered/e2e/quantization/test_modelopt_fp8.py::TestModeloptFP8.test_gsm8k |
|
🚀 |
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
|
[by Claude Code] I've started babysitting the NVIDIA CI of this PR. I'll check it every 30 minutes until all NV pipelines pass. If a relevant job fails, I may rerun it, merge the latest Anyone can stop me at any time: just post a comment asking me to stop (for example, |
|
[by Claude Code] The relevant CI failure (https://github.com/sgl-project/sglang/actions/runs/39121740889/job/117700615733) is not caused by this PR. It is a known breakage on |
Picks up sgl-project#45038, which fixes the unrelated CI failure https://github.com/sgl-project/sglang/actions/runs/39121740889/job/117700615733 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
[by Claude Code] I've started babysitting the NVIDIA CI of this PR. I'll check it every 30 minutes until all NV pipelines pass. If a relevant job fails, I may rerun it, merge the latest Anyone can stop me at any time: just post a comment asking me to stop (for example, |
|
[by Claude Code] All NV pipelines have passed. |
|
CI passed. @Fridge003 could you review this one line change? Thanks! |
…gl-project#44514) (cherry picked from commit 1897575) (cherry picked from commit 60b750c98cdf0936b96c4bd99e7d5d7ff0e35cc0)
sgl-project#44514 from port-autotune (entries 257-260) Batch 2 of the 2026-10-28 second wave. Four picks landed CLEAN in strict order onto the comm docs tip -- code tip 2705ebb: f46e547 sgl-project#40420 (open port, EP autotune-cache digest: per-rank caches no longer dropped every startup; worker RED-proof 2F->2P), 894d4a7 sgl-project#45543 (open port, seeded distinct dummy token ids for the decode MoE autotune; base_runner union preserves the entry-176 EXTEND call site; upstream-only TestModelPrefillAutotune NOT carried in -- autotune_prefill_kernels absent, grep-verified), 6c866f3 sgl-project#43927 (merged pick 33618d4, default tactic joins tuning -- PARTIALLY SATISFIES the C0a sweep-gap record; entry-243/246 'no tactic=-1' PASS-needles STALE, CAVEATS bullet added), 2705ebb sgl-project#44514 (merged pick 1897575, cache-key bump -> exactly ONE cold autotune boot, entry-228 boot-cost practice). Header bookkeeping for BOTH batches: STACK bumped to qwennext-stack-260-2026-10-28 with the comm + autotune wave lines, entries 1-260, tip 2705ebb, updated: 2026-10-28 (entries 255-260) block. FAM-A1 LANDED + NEW TODO S-EXT1 (stack-owned: EXTEND autotune still tunes on zero-filled dummies -- the bug sgl-project#45543 fixed for decode). Verified at landed tips (prod venv, CVD=9), all EXACT vs predictions: sync+gate 22P/1S/5sub, runner dir 89P/1S/47sub, MoE set 139P/22S/141sub, qwen4_exp_ple_staging 37P; comm named set 114P/1S/30sub, dir 120P/1S/35sub 0F, new comm files collect 18. In-flight workers NOT landed -- no drift attributable. NOTHING PUSHED.
…kens (stack-owned, follows sgl-project#45543) Rationale: our entry-176 EXTEND pass (maybe_flashinfer_autotune_extend) allocates fresh ZERO-FILLED dummy buffers via _alloc_dummy_decode_buffers and ran its prefill-sized tuning forward on them -- every row embedded token 0, the MoE router sent all rows to the same experts, and FlashInfer ranked the extend-bucket tactics on a routing pattern no real prefill produces. That is the exact lie sgl-project#45543 fixed for the decode pass (claimed 13-16%/layer MoE gains, measured on different hardware: direction, not measurement), and since sgl-project#44514 these picks persist under the v2_default cache key, so the zero-tuned extend records were being reused boot after boot. Fix: wrap the single extend-pass dummy forward in the SAME seeded autotune_dummy_input_ids helper sgl-project#45543 landed -- reuse, no forked second implementation. One wrap point covers every extend-pass dummy forward: both base_runner call sites (~:295 target, ~:299 draft) route through this function. Buffer lifecycle verified at the site before choosing (S-EXT1's open check): the helper fills ids BEFORE the tuning context and zeroes AFTER it, exactly like the decode wrap; the extend buffers are function- local and released in the finally, which the zeroed re-check preserves. Default-on semantics and the entry-176 size/shape logic are UNCHANGED -- this is a dummy-INPUT fix, not a scope expansion. Skipped (input-dependent, already covered): the MegaMoE prefill profile inside flashinfer_autotune_context profiles topk_ids/topk_weights captured from the DECODE-shaped dummy forward -- distinct since sgl-project#45543 -- and builds its capacity profiles independently of buffers.input_ids; wrapping it too would retune nothing. eager_runner/prefill_cuda_graph_runner EXTEND sites are runtime/capture paths, not autotune, and take real batch tokens. Cache-key finding (checked, not changed): neither the v2_default cache path nor the sgl-project#40420 sync digest hashes anything about dummy tokens, so this patch does NOT cold-boot the cache. Consequence: extend-bucket records tuned on zeros under an existing v2_default key stay VALID and keep hitting. Entry 260's scheduled cold boot has not happened yet (the 2026-10-28 batch is live-only-after-restart), so landing S-EXT1 before the next restart folds the forced retune into that boot at zero extra cost. If any prod boot with a warm cache happens FIRST, a forced-retune needle is required: delete the per-rank rank_tpX_ppY_dpZ.json files -- note SGLANG_FLASHINFER_AUTOTUNE_CACHE=0 does NOT refresh the canonical file (the cache-disabled path writes a timestamped runs/ copy only) -- or add a one-time dummy_tokens=seeded key part mirroring sgl-project#44514's precedent, deliberately left out of this patch's scope. Tests: test_flashinfer_autotune_sync.py gains TestExtendAutotuneDummy- InputIds (4 CPU tests mirroring the sgl-project#45543 class): extend forward sees seeded distinct in-vocab ids and releases buffers zeroed; ids equal the helper's own output (guards against a divergent second implementation); equal across runs (rank determinism); zeroed after a failing forward. Teeth: production hunk reverted -> 3 failed / 1 passed ("1 != 16384"); restored -> 4 passed. Battery at tip vs after, CVD=9 CPU mode: sync+gate 22P/1S/5sub -> 26P/1S/5sub; runner dir 89P/1S/47sub -> 93P/1S/47sub; qwen4_exp_ple_staging 37P -> 37P; MoE set 139P/22S/141sub -> identical. ruff 0.15.1 (F401,F821,F823,UP037) + format clean on both files. (no upstream PR; fork debt S-EXT1)
… (upstream sgl-project#45543) Layer 6 of the Kimi-K3 release line on upstream main 586355a (base branch kimi-k3-nightly-586355a8, the nightly-dev-cu13-20261028-586355a8 image). Written as layer 5 of the 27 Oct line on upstream main 5884e4f, where the checks below ran; the patch applies to this base unchanged. The decode-shaped autotune forward ran on zero-filled static buffers, so every row embedded token 0, the MoE router sent all rows to the same experts and FlashInfer ranked its MoE tactics on that pattern. Give the decode dummy forward seeded distinct token ids and zero the buffer after. Serving paths are unchanged; it acts at start-up only. Kimi-K3 MXFP4 on 8x B300 (TP8 DCP8 EP8, FlashInfer 0.7.2): tactics tuned on realistic routes are 13-16 % faster per MoE layer at 24-32 rows; on the 3c56008 line this layer took the decode step 1.2-1.5 ms down at 16-64 rows. Source: bd5f49b on the kimi-k3-nightly-3c560089 line (fork PR sgl-project#21), a mirror of upstream sgl-project#45543 (head 44b7dfd); applies without conflict. Upstream changes since 3c56008 to base_runner.py (sgl-project#44913, sgl-project#44994) and flashinfer_autotune.py (sgl-project#44514, sgl-project#46140) leave the decode autotune forward as it was: it still runs in _flashinfer_autotune with mr = self.model_runner and the decode buffers' input_ids. Tests (CPU): test_flashinfer_autotune_sync.py with this commit's version on the parent does not import (autotune_dummy_input_ids does not exist there); with this commit 15 passed, 1 skipped (CUDA). Upstream: sgl-project#45543 Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit bee9e09) (cherry picked from commit 2d17538)
Motivation
#43927 enables FlashInfer v2's default-tactic (
-1) comparison on cache misses. Existing v1 winners are accepted before that comparison, and their cache paths did not change. Version the cache identity so fresh startup retunes these configurations with the expanded candidate set.This continues v2 candidate-selection adoption with existing v1 persistence.
Modifications
Add a stable
candidate_selection=v2_defaultcomponent to the existing cache key.All previous cache files become cold once, including caches created since #43927 and MegaMoE namespaced records sharing the file. Existing files remain untouched for rollback; subsequent startups reuse the new namespace through the existing v1 load/save path.
Measurement policy remains unspecified. Cache-disabled behavior, skip controls, streams, and distributed synchronization are unchanged. No managed-store migration or MegaMoE integration changes.
Accuracy Tests
6a32decdb5a216b53f35cfb53659308f223da91c: existing registered autotune suite 12 tests in 19.625 seconds; 11 passed, 1 CUDA-only skipped. macOS arm64, Python 3.12.12, Torch 2.14.1, installed FlashInfer 0.7.1.git diff --checkpassed. No new unit test is included in the final diff.55eb0808e8ca008163a7fa10ff59c4bb2d9a1be3merges this PR head6a32decdb5into upstream4cca7fcd3e644f22a61c7a6e6b57bb89b568d62a. H100 80 GB, Torch 2.14.1, FlashInfer 0.7.1.332a055bae(identical production code). This is historical validation, not a new-head rerun of that unit case.TestRustMmMMMU.tearDownClass: its accuracy test passed, butkill_process_treecould not reap a process within 60 seconds after SIGKILL. Eleven other Stage B jobs then failed fast; Stage C was skipped. Full Base remains incomplete pending recovery of this cleanup failure; no retry has been triggered.Speed Tests and Profiling
No performance measurements or serving-performance claim. Upgrading incurs a one-time startup retune.
Checklist
CI States
Latest PR Test (Base): ✅ Run #39185016498
Latest PR Test (Extra): ❌ Run #39185016503
Latest PR Test (AMD ROCm 10): ❌ Run #39185016563