Repository navigation
Conversation
|
@LingZ315 thanks for the quick refresh! As promised, results from our setup. Short version: it works on SM120 RTX PRO 6000 in real production traffic (served our live traffic for ~1 h, 0 errors, 0 tracebacks), quality unchanged, big decode win at long context. Setup: 1× RTX PRO 6000 Blackwell Workstation (SM120, 96 GB), TP1, Correctness (our agent harness, temperature 0.6): tool calls 12/12 (medium) + 12/12 (xhigh), vision 4/4 (skewed invoice OCR, UI screenshot, chart), needle-in-~32k-tokens 4/4. CUDA graphs on, MTP accept length 2.97 vs 3.02 baseline. KV capacity: 990,208 tokens vs 715,591 with FP8 (+38%) at the same mem fraction; 1,075,760 with Long-context decode (~84k-token unique prompt, 400 output tokens, measured while serving live traffic):
Live traffic, warm cache (our agent workload, 25–60k-token contexts):
Notes:
Thanks again, happy to re-test follow-ups. |
|
Follow-up with HiCache back on: #43356 + #43240 (HiCache FP4 host-pool fix, validated in #43240 (comment)), same SM120 setup, Throughput, live agent traffic with warm cache (most contexts 25–35k tokens), vs our v0.5.21 FP8 KV + FlashInfer + HiCache baseline at similar load:
So on SM120 the NVFP4 path wins clearly only at long context (+60% decode at ~84k, earlier comment) and loses ~20–25% at mid-length contexts. Our guess is the mandatory |
|
@AppNetDeveloper your data is exactly why we shipped #43471 last night — same SM120 platform, same Qwen3.8-27B-NVFP4 + MTP stack. It may change the tradeoff you backed away from. To be precise about what it does not touch: your mid-length decode regression (~134→106 tok/s at 1–2 running) is on the trtllm_mha/XQA decode path + page-64 reuse, and #43471 doesn't move decode kernels — your conclusion holds there. What #43471 removes is the FP8 dequant workspace from the prefill path entirely: NVFP4 prefill now goes through FlashInfer's native packed-FP4 paged prefill (
Reference numbers (same rig, native-FP4 prefill, greedy, cold disjoint prefixes — full A/B vs the workspace route running as I type; these are the absolute values):
Notes for a trial on your rig:
If the decode side is what keeps you on FP8 KV, one data point worth having on your radar: on SM120 the decode loss looks like an XQA/page-size property of the NVFP4 route, not of the KV format's arithmetic — if FP8-KV decode at page 64 ≈ page 16 on your harness, the mid-length story may be fixable independently of this. |
|
@chengye75-star @LingZ315 thanks for the pointer to #43471. We tried it on the same SM120 setup. Short version: native NVFP4 prefill + MTP verify is correct but crashes under CUDA graphs at bs=16, and on SM120 there is currently no graph-safe native verify path. Tree: #43356 @ What works
What breaks (decode CUDA graphs on) The error is async, so the faulting kernel is probably the previous graph replay of target verify through the native
The trtllm verify path views the packed FP4 pool ( Why this matters on SM120: the only graph-safe verify path today is #43356's speculative dequant workspace. It re-dequantizes every running request's whole cached prefix into FP8 on every verify step. We suspect that is behind the −20–25% mid-context (25–35k) decode we reported earlier. A graph-safe native verify (#43471's route) would likely remove it and keep the +67% capacity. FP8 KV baseline on the same box for reference (unique prefixes, 400 output tokens, per-request decode): ~27k: 124.5 tok/s c1 / 57.8 c4 / 37.2 c8 · ~50k: 105.0 c1 / 24.1 c8 · ~141k: 83.5 c1 / 22.3 c4. Happy to run a fix on this rig and report the same table for NVFP4. |
…ack to the workspace path CUDA-graph replay of the native kv_cache_sf path is only proven stable for plain prompt-prefill. Target-verify / draft-extend now fall back to the dequant workspace route (graph-safe via sgl-project#43356) unless the operator opts in via SGLANG_NVFP4_NATIVE_SPEC=1 (small capture lists only). Also plans speculative prefill wrappers with float8_e4m3fn when downgraded.
|
@AppNetDeveloper your bs=16 crash report was exactly the evidence we needed — thank you. Confirmed: the gap is in our PR, not in your merge. #43471's native branch as written covers Fix pushed to the PR branch (
What we ask you to re-test on the PRO 6000 (we can't reach bs=16 on 16 GB×2 — your rig is the only bs=16 evidence that matters):
On that last point we agree with your framing: a genuinely graph-safe native verify (stable plan buffers across replays at captured shapes) is the real prize, and your Reference, same-PR guard build on our SM120 TP2 rig just now: decode 90.4 (counting) / 76.9 (short) / 70.5 (creative), cold prefill 45K/100K at 12.2/34.9 s, memory flat — bit-for-bit the same as ungarded native, as expected for a guard that only moves speculative forwards. |
Refresh against a99c7d0, preserve physical slots and global scales, account for independent draft workspaces, reject unsafe graph padding, and bound SM120 speculative DQ launch workers to eight CTAs per SM. Core source validated independently with HiCache disabled.
|
@merrymercy could you please run This branch now includes upstream main The earlier GPU/model and benchmark results in the PR descriptions apply to the documented a99c7d0-based validation snapshot; they have not been rerun on these new heads. If GitHub requires approval for fork workflows, could you approve those as well? |
…mily + S-EXT1 + riders + S-RACE + LLGUARD/ENVREG), S-EXT1 and S-RACE items CLOSED, entry-256's raw-env deviation and LL-vs-PCIe-IPC collision warning both marked CLOSED with the BOOT_DELTA (h') needle in landing terms, sgl-project#35617 left as the sole FAM-A7 survivor, sgl-project#44732 re-pointed to the operator's merge-sgl-project#5 answer, and the KV-ROUTE DECISION RECORD added (HOLD NVFP4-KV until armed PCIe-IPC is measured post-merge; preferred-if-ever sequence merge -> sgl-project#43356-delta -> sgl-project#46452 NOT sgl-project#43240 -> optional sgl-project#43471 -> fork BUILD-A QSA FP4 reads (template sgl-project#38724) -> BUILD-B L3 scale sidecar -> one GPU window; sgl-project#46141 template, sgl-project#44462 NEXT, MXFP4 declined, entry-247 re-sync watch-string modelopt_e4m3_k32)
…m re-plant, flashinfer_backend 175/208/233 re-plants + spec-workspace pool pair, trtllm_mha fail-loud, qsa folds, dsv4 wrapper redirect -- entries 54,57,64,102,120,166,175,176,178,192,194,200,203,208,210,213,233,241,125,118,184 gdn_backend.py (54/120/203): THE FULL fork delta RE-PLANTED onto the post-merge structure (the merge took upstream's file and the saved hunks were the loss): extend-side circular replayssm fold (metadata wiring + once-per-forward fold before _prefill_gates), the lossless-verify (u,k,g) tuple plumbing through target_verify (buffer kwargs + recurrent-fallback _lossless arm + the EAGLE-tree assert), _assert_lossless_verify_kernel (the FlashInfer verify kernel swallows **kwargs -- silent zero-ring class, fail here instead), and the SGLANG_GDN_REPLAYSSM_VERIFY_NUM_STAGES pin. Every supporting seam (spec_utils fold pair re-homed by B4-4 onto mamba_pool, TritonGDNKernel u/k/g params, pool-side buffers) verified live; hybrid_linear's accept-side twin survived. flashinfer_backend.py (175/178/192/194/208/233): marker file with THREE confirmed losses re-planted -- (a) entry-233 sgl-project#45092 wrapper REUSE on both per-bs dicts (the double-capture wrong-output class is ACTIVE on this stack: graph_variants capture the same bs twice; merge restored the unconditional overwrite); (b) entry-208 sgl-project#43524 None-if-workspace scale arms on both forward_extend consumers (the merged pool DOES global-scale in dequantize_prev_kv -- unconditional k_scale_float double-scales); (c) entry-175 sgl-project#43356 speculative workspace: forward_extend mode split + eager draft-extend paged branch + pool methods (MHATokenToKVPool main + HybridLinearKVPool + SWA wrapper delegations; the quant-method seam dequantize_speculative_prefix_to_workspace arrived in-range and the pool accessor + backend wiring are OUR half). B3-8's 'no caller' dedupe was WRONG-DIRECTION: the callers are this route and its test. VERIFIED-PRESENT: entry-194 spec_kv_index_token_blocks at :2576, KVWriteLoc.for_layer x3, is_draft_extend_v2 x3; the 39-hunk saved delta is mostly re-sited fork content (access-kind refactor upstream itself landed in-range). hybrid_linear_attn_backend.py (102/176/203): upstream-side patch dry-run proves ALREADY-FOLDED at the merge (36/36 hunks previously-applied); side-state getattr pair rides memory_pool's compat properties (:1721-34). trtllm_mha_backend.py (64/178): entry-64 layers_mapping arm ABSORBED by layer_router (the merged pool routes full/SWA + waits there); entry-178 SM120-FP8-KV fail-loud construction guard RE-PLANTED (FMHAv2 e4m3 raise class returns otherwise). qsa folds (15/118/125/166/184/200/210/212/213): metadata VERIFIED- SUPERSEDED (the merged pack-kernel + sharded + CP-subset path is beyond the window delta); qsa_indexer folded (project_qk ensure_cos_sin_cache param -- the CP caller as merged TypeErrors without it -- + the guarded out-of-capture sizing safety net at both sites); sparse_attn folded the SLOT_INDICES int64 overflow guard (comment-hunk superseded by the fork's KV_IS_FP8 form); qwen_sparse_attn_backend folded the CP K/V side-stream PREFETCH MACHINERY (prefetch_cp_kv/_gather_cp_kv/_cp_kv_pending + leak-guard + join + release-ordering -- qwen4_exp.py:2614 CALLS prefetch_cp_kv so as merged the CP path AttributeErrors), the sync-free slot-table prefix reads, the device-built cu_k and max_q pass-through, and upstream's in-place paged-prefill fast path WITH a fork FP8 guard (our scaled stores need the descale pack loop; unscaled pools take the fast path exactly as upstream intends). deepseek_v4.py (57/176): shared-experts symbols verified present; raw 'from deep_gemm import' restored by the merge RE-REDIRECTED to the guarded wrapper (mega_moe sibling). glm5_next.py (176): upstream-side fold verified fully PRESENT (stale marker). Battery ACTUALS (CVD=9, prod venv, PYTHONPATH=python, import sglang OK): test_flashinfer_nvfp4_speculative: 6F -> **6P** (re-anchored: iteration- ids plan seam, kv_layers store seam, dispatch_reason/ragged_verify_layout stub fields; all entry-175 beliefs PRESERVED, none weakened) test_qsa_cp_unit: 50F -> **65P/0F** across the pair gdn/replayssm CPU surface (extend_fold + verify_ple_commit + stages + prefill_graph): 5P/2S (stages honest-CUDA-skip) ruff F821+E9 + format: clean on all 14 files touched KNOWN CARRY: test_mega_moe_deepgemm_api 1F is the DOCUMENTED mega_moe class (pre-existing at b3207c7 with and without the B5-3 redirect; mxfp4.py's in-range wrapper import vs the test's deep_gemm fake) -> B2 marker at :905 covers the test-side re-anchor.
… C closure -- the post-merge port queue is now decided ARRIVAL SCAN (git log 12dc623..2a6c204 --grep) + LIVE gh STATE + head-sha comparison for EVERY deferred item. Verdicts: RELEASED-BY-MERGE: sgl-project#42689 (@ 7a632cf in-range -- the SECTION-B cherry is now redundant; behavior note rides the restart). CLOSED (C-items whose PRs arrived and whose integration this stack performed): C1 (the dedicated merge week WAS merge sgl-project#5; all eight precursor PRs in-range), C2 (sgl-project#44993/sgl-project#44994 -- B5), C3 (sgl-project#45232/ sgl-project#45236/sgl-project#45334 -- B2), C4 (sgl-project#45238/sgl-project#45241/sgl-project#45242 -- B3), C5 (sgl-project#44912/ sgl-project#44913 -- arrived; entry-230 canary re-planted as its guard), C9 (sgl-project#39727 -- verified OPT-IN, no purge; BOOT_DELTA anti-needle), C0a (arrival shas already recorded at entry 310 -- Section C now carries NO open code-integration items: C6/C10 retain only their explicitly-named docs/boot-measurement remainders, re-stated). STILL-OPEN: sgl-project#44342 (head unchanged; auto-merge comfort LOST to #46970x), sgl-project#46153/sgl-project#37106/sgl-project#32479/sgl-project#45391 (gh CONFLICTING -- stale bases, rebase before any port), sgl-project#41624/sgl-project#42525/sgl-project#42660/sgl-project#44462/sgl-project#35617 (open, heads unchanged), sgl-project#46191/sgl-project#39845-class (watch-list, none in range). HOLD STANDS (operator decision, binding): sgl-project#43356/sgl-project#46452/sgl-project#43240/ sgl-project#43471 KV route -- step-1 'MERGE sgl-project#5 lands first' is NOW MET; the sequence may be re-visited ONLY with the post-merge PCIe-IPC measurement at an operator sitting. sgl-project#44732: the 'one purge if done WITH the merge' premise LAPSED when merge sgl-project#5 completed without it -- later execution costs the SAME single purge once; no penalty, no haste. Recorded for the operator, not decided by B6.
…NSUS ZERO (39/39) - pool_configurator FP4 draft pricing RE-PLANTED (entry-175 sgl-project#43356, never landed upstream -- verified absent at eb73a50): _compute_eagle_fp4_draft_ cell_size + the FP4 arm in the non-DSA draft branch, folded onto upstream's in-window DCP-aware else (the draft's heads stay unreplicated; dcp only scales the DSA-indexer term, unreachable in this branch, so the fork's 2-arg _compute_cell_size call is byte-equivalent here). copy import restored. - decode_cuda_graph_runner: _init_model_hooks() call RE-PLANTED (entry-61 boot-integrity class -- the def + the _replay_prepare_hook consumer survived the merge, only the call was dropped, so every real DecodeCudaGraphRunner build would AttributeError on replay; the fork-only method is NOT upstream -- git-verified: no call at eb73a50, no def at base 2a6c204). - eager_runner region@326/367 ADOPTED (_execute_extend_cp + the inline group-sharing predicate == fork's runner_owns_cp_boundary, byte-equivalent; sgl-project#44994 (299a75a) is an in-window ancestor so upstream owns the shape now; the cp_extend module stays live for base_runner's forward_context path). - memory_pool grafted lossless-verify tuple VERIFIED (check gate, u/k/g supersession, configurator supply, gdn_backend consumer -- all present; marker replaced with the verification note). - layer_list make_layers empty_cache hunk VERIFIED re-homed (code + rationale already at the new home; marker downgraded to a plain comment). Targeted: 223P/0F/193sub (dcp_logical+load_inquirer+page_invariants+ init_req+prefill_adder+page_interleave). Gates: ruff repo ruleset + format; registration trio rc=0.
|
Thanks @chengye75-star, and sorry for the slow reply. We haven't re-run the bs=16 test on the 00f2216 guard yet, and here is why, plus everything we've learned on the same SM120 box since. On the guard (00f2216)Our reason for going back to FP8 KV was the mid-context decode loss (−20–25% at 25–35k). On SM120, MTP verify runs through the prefill path ( We also noticed @LingZ315's refresh of #43356 ( We'll re-run the full table (bs=16 burst with decode graphs on, the same quality set, 27k/50k/141k c1/c4/c8, MTP accept at 1–4 and 10–19 running) as soon as either (a) a graph-safe native verify candidate exists, or (b) #43356 with the 8-CTA dequant is rebased on current What changed on our side
HiCache + container memory: the 1/3-throughput trap
Hybrid (GDN/mamba) HiCache: host hits need their own mamba-state budget
SM120 small-M kernels (decode at 1–16 concurrent)A decode trace at c1 / ~45k context showed the step bound by GEMMs that run at ~50% of memory bandwidth (FP8 10.6 ms, NVFP4 7.7 ms out of a 30.7 ms step; attention only 0.86 ms). Microbenchmarks with the real shapes in CUDA graphs:
Scheduler ceilings at higher concurrency
Two serving-side gotchas (not NVFP4-specific)
Happy to test either candidate on this rig and post the same table. Thanks again to both of you. |
|
Updated this PR to work with the latest main. The new head is |
Motivation
SM120 speculative verification and draft extension need an NVFP4-to-FP8 workspace with the correct physical KV slots and sequence lengths. Reusing prompt-prefill metadata during speculative replay can select the wrong cached rows. Applying global scales again after workspace dequantization also changes attention outputs.
Modifications
--disable-cuda-graph-paddingfor SM120Qwen3_5ForConditionalGeneration+ NEXTN + NVFP4 decode graphs. Exact captured batch sizes use graphs; uncaptured sizes retain eager fallback.Packed payload/scale transport is in the separate HiCache companion PR.
Current-main refresh (2026-11-22)
Merged main
4916e5a56ab0e2c90d9065cd6116091a79f28f55into the existing branch; refreshed head:1e06d0262d98302a0911f8d36a37b550168c1e8f. This preserves the previous PR history.Adapted the speculative path to
IterationIdsand window write locations, updated dtype resolution toquant_config, and reconciled private-draft workspace sizing with main's DCP accounting. Added DCP regression coverage and updated fixtures to the current layer-router APIs.Fresh validation on two RTX 5090 GPUs, TP2, Qwen3.8-27B ModelOpt NVFP4 with integrated MTP, NEXTN 5/1/6, FlashInfer 0.7.4, sglang-kernel 0.4.11:
TRTLLM FMHAv2 prefill ... does not support fp8_e4m3 KV cache).Both arms used a 196608-token pool, chunk 8192, page 64, Mamba state pool 96, no HiCache or FR-Spec, and custom all-reduce disabled. Mamba pool 64 capped actual concurrency at 12 with this five-slot-per-request setup; the C16 validation uses 96. Decode Graph capture sizes are 1/2/4/8/16 with padding disabled.
This refresh does not implement native packed-FP4 verify: speculative verification still dequantizes cached prefixes into the workspace. The eight-CTA optimization remains restricted to 512-element rows; this model's TP1 geometry has 1024-element rows and retains the previous launch geometry. No fresh speedup claim is made for RTX PRO 6000 TP1.
Historical Accuracy Tests
Based on
a99c7d050fae, tested with Qwen3.8-27B ModelOpt NVFP4 weights on two RTX 5090 GPUs (SM120), TP2:T8192K5,T8192K7,T25000K5,T25000K7,T32000K5. Each performance point's ten measured batches also has stable output IDs within each path.CPU rerun:
Kernel reproducer:
python -m pytest -q test/registered/kernels/ops/quantization/test_nvfp4_kv_cache.py.These results do not establish native packed-FP4 attention, SM100, RTX PRO 6000 TP1, 141K decode performance, or the complete reasoning/tool/vision/needle quality suite.
Historical Speed Tests and Profiling
The following measures the combined core + HiCache candidate, with HiCache ON. A=NVFP4 KV + FP8 workspace; B=FP8 KV. Both use the same NVFP4 weights,
trtllm_mhadecode backend (FP8 uses XQA), page 64, TP2, NEXTN 3/1/4, fixed pool 196608, chunk 8192, Mamba 96 and decode Graph sizes 1–16 with padding disabled. Runtime: FlashInfer 0.7.2, sglang-kernel 0.4.10, PyTorch 2.14.1+cu130.Complete A1/B1/B2/A2: one warmup plus five measured batches per point per launch, 128 output tokens per request. Throughputs below are pooled medians of ten measured batches per path; ratios are the geometric mean of the two launch-pair ratios, calculated separately.
Request time runs from HTTP open to receipt of
[DONE], including TTFT, transport, stream parsing and in-loop raw writes; flush/seed, memory checkpoints and post-stream validation are excluded. Decode throughput excludes each request's first SSE event and is client-observed, not pure GPU time. Both launch pairs agree in direction at every point. Request throughput is 5.7%/1.1% higher at shared 25K C1/C4 and 9.9–11.9% lower at the other points. TTFT p90 is also higher for A at shared 25K C4 (608 vs 236 ms) and shared 50K C4 (1051 vs 588 ms). Two pairs do not establish statistical significance or isolate a kernel's contribution.At the fixed pool size, ready-state known KV/scales/workspace storage per rank is 2.169 vs 3.189 GiB (31.99% lower); total PyTorch allocated memory is 19.985 vs 21.031 GiB (4.97% lower), and reserved memory is 20.512 vs 21.559 GiB. These quantities were identical across both ranks and both launches of each path; they are not whole-device memory or per-request peaks.
Automatic token-pool capacity, separately measured at memory fraction 0.9 with the same Graph/Mamba settings, is 782,592 vs 565,568 tokens (+38.37%). Each path completed one 25K request. This does not establish full-pool stability or a larger single-request context limit.
Checklist
The repository-pinned
pre-commitstage passed on all 11 changed files in a disposable checkout of this exact core patch; the hooks left source unchanged.CI States
Latest PR Test (Base): ⊘ Skipped -- add the
run-cilabel to run CI tests.Latest PR Test (Extra): ⊘ Skipped -- add the
run-cilabel to run CI tests.Latest PR Test (AMD ROCm 10): ⊘ Skipped -- add the
run-cilabel to run CI tests.Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: