fix(engine): load prefill triton kernels at startup, not mid-request - #169
fix(engine): load prefill triton kernels at startup, not mid-request#169jason-fxz wants to merge 2 commits into
Conversation
|
Tested on sm_89 (2x RTX 6000 Ada), which is the card this PR most wants a data point from:
Model Setup: 2x RTX 6000 Ada (48 GiB, sm_89, PCIe Gen4, no NVLink), 2x Xeon Gold 6526Y, 503 GiB RAM, CUDA 13.3, torch 2.11+cu130, sgl_kernel 0.4.5; Update 2026-09-05, merged into the deploy branch. Tried on 2 x RTX 6000 Ada (sm_89) serving Qwen3.8-Flash-Next (RadixArk NVFP4) at TP=2, offload backend, fp8 KV pool of 8 x 262,144 tokens, merged onto my deploy branch (main af71ba4 + #385/#386/#389/#392/#354 and ten other open PRs), tests run on the box, then put in production. On this model the QSA sparse backend got no prefill warmup at all before this PR (the call was gated on the triton backend), so the first request of each size bucket compiled on the request path after a Triton-cache-cold start. With this PR: |
…ernels at startup, not mid-request Upstream FlashML-org#169 at a8326af, merged onto deploy/chatdnp for the PR sweep. Conflict in engine/engine.py: both sides add a method at the same place (FlashML-org#231's _emit_moe_stats, FlashML-org#169's _warmup_prefill_lens); kept both. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0173pf9k9fSVtwbm3f898HDt
Brings the quantization refactor (FlashML-org#418 config/scheme/method layers, FlashML-org#427 the QuantConfig reaching the weight readers) and FlashML-org#426, which takes qwen4_exp's expert quant kind from the checkpoint QuantConfig. Resolutions, all taken from the rebased PR branches so the deploy tree and the upstream PRs stay identical where they overlap (rb/tp, rb/vision, rb/fp8 -> rb/all): - qwen4_exp attention/gdn/moe/config/model, layers/linear.py, layers/embedding.py, models/nvfp4_banks.py: the rebased versions. Notably o_proj stays LinearOProj (row-parallel); main's LinearReplicated is correct only at TP=1. - NVFP4 expert TP sharding moved to the new seam: the piece stream is sliced along the intermediate axis in nvfp4_banks, and the kernel sizes its banks from MoEConfig.local_intermediate. The old _Placer/_alloc_nvfp4_host_banks are gone with the functions they lived in. - models/quant_linear.py: deleted, as upstream did; nothing imports it. - DROPPED, superseded upstream: the FlashML-org#320 cherry-pick (_dense_is_block_fp8, _block_fp8_fusions, _load_maybe_block_fp8). FlashML-org#320 is CLOSED upstream because FlashML-org#426 does the same job through QuantConfig. This checkpoint's dense side is bf16 (a 292-entry modelopt ignore list), so none of those paths were exercised here. - KEPT: the --num-tokens/--num-pages KV reserve fix (issue FlashML-org#383, still unfixed on main), FlashML-org#231's collect_decode_freq, FlashML-org#169's prefill_warmup, and every other deploy-only commit -- they merged clean. - tests/engine/test_cache_budget.py keeps both the KV-reserve test and upstream's new slot_limit test; _resolve_auto_moe_cache_size's new method arg is optional. deploy/chatdnp stays at adc32da as the rollback point. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0173pf9k9fSVtwbm3f898HDt
Two changes, one goal: no triton compile / cuModuleLoadData on the request path.
fla/l2norm:do_not_specialize=["T"],Twastl.constexpr: a new module per unseen prompt length, forever._warmup_prefillruns on every attention backend (wastriton-only, sofi/fahad no prefill warmup), over a config-derived ladder covering every in-repo size bucket instead of[80, 128]. New--skip-prefill-warmup;FREETOKEN_WARMUP_MAX_LENcaps the ladder.Suspected trigger of the sm_89 silent hangs (#123, #72; #31 has a py-spy stack inside cuModuleLoadData): a first-launch module load mid-forward on the scheduler thread.
Tested on H100 (driver 580.95.05, torch 2.11.0+cu130),
nvidia/Qwen3.6-35B-A3B-NVFP4, offload + fi: l2norm bitwise equal, same latency; a 11..2560-token sweep loads zero in-repo kernels at request time (main: 4-10 per new size); first-request TTFT on a cold cache 15.1 s -> 0.6 s; warmup adds 4.1 s to startup on a warm cache.The hang does not reproduce on sm_90. This PR removes the trigger; confirming the fix needs
an sm_89 card.
Refs #123, #72.