Repository navigation
Conversation
|
Boot check of the rebased tree (
What this covers: the shared code the rebase touched (PLE table allocation through the backend switch, the prewarm reading the runtime context bags, the kernel registry, the env declarations) on the current |
7414165 to
bce5327
Compare
0d7d5ec to
b9e3478
Compare
Use the paged Triton path for sparse decode on SM120. Keep the environment override resolution cached for the process lifetime.
Mask non-owner PLE host loads so ranks that do not own a row no longer issue the clamped row-zero read over PCIe. The old read could not corrupt output, because the load mask already included the in-range predicate, but it was an out-of-range access pattern and wasted host bandwidth on every non-owner rank. Also retain the MQA fallback after a compile failure instead of dropping to torch silently, and prewarm the Qwen4 JIT kernels before graph capture so the first capture does not compile inside the graph.
Add Triton 3.7.1 FP8 blockwise configurations measured for the Qwen3.8 expert-parallel layouts on the RTX PRO 6000 Blackwell Server Edition.
Use split-K work partitioning for low-row sparse decode and register the SM120 benchmark with the kernel benchmark suite.
Use Triton for QSA MQA scoring on SM120 and register the architecture-gated benchmark with the kernel benchmark suite.
Merge split-K partials in the final decode program to remove the separate reduction launch.
Spread the GPU-read host table across online NUMA nodes before registering its pages. Keep node-local pinning as an explicit fallback.
Select the hc_mix Triton geometry from the row count on SM120 while preserving the existing path on other architectures.
Use the grouped W4A4 kernel for small routed-row counts on SM120 and register its architecture-gated benchmark.
Clamp sparse attention indices before lookup, keep KV pool address arithmetic in 64 bits, and guard the degenerate inputs the bounds work exposed: empty rows, negative and past-the-end indices, and prefill rows whose visible extent is shorter than the selected budget.
Choose the PLE prefetch buffer from the active capture state so graph replay uses the buffer that was actually captured.
Brings in 311 upstream commits up to f209e67 (sgl-project#39643, 2026-09-28). Conflict resolutions: - qwen_sparse_attn_backend.py: keep the SM120 triton decode branch and FP8 descales; adopt upstream's HIP packed-decode path and move the flash-attn resolve after it (matches the rebased sgl-project#36787 head). - cuda_graph_setup.py: prewarm after EagerRunner(run_warmup=...) and in elastic recapture (as in the rebased sgl-project#36787 head). - mega_moe.py: upstream flydsl early return + stack deep_gemm_wrapper import. - hybrid_cache_controller.py: upstream per-chain sidecar batch_get_v2, wrapped in the stack's degrade-to-miss guard. - unified_radix_cache.py: take upstream allocate_host_transfers (group.alloc already reclaims only the shortfall). - hiradix_cache.py: accept upstream deletion (sgl-project#40787). - hybrid_pool_assembler.py + its test, test_hc_mix.py: unions. - qsa kernel tests follow the ops/qsa -> ops/attention/qsa move (sgl-project#41243). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The 09-24 rebase of sgl-project#36787 (head 7431002) adapted three of its tests to upstream API drift that also arrived through the 09-28 merge: - test_cuda_graph_setup: EagerRunner now takes run_warmup=, and the new recapture_elastic_cuda_graph prewarm (carried in the merge resolution) gets its test. - test_nvfp4_moe_sm120: flashinfer_cutlass reads get_parallel().tp_group; get_tp_group no longer exists there. - test_nvfp4_smallm_dispatch: the fallback stub gains swiglu_alpha/beta/limit. Files taken verbatim from the PR head (a6c20ce, which keeps entry 93). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…prewarm Upstream sgl-project#41243 moved sglang.kernels.ops.elementwise.fast_topk to ops.attention.fast_topk. sgl-project#36787's _prewarm_cuda_graph_jit_kernels (also on its rebased head 7431002) still imported it from elementwise, so on SM120 the first CUDA-graph prewarm at boot raised ImportError. Caught by test_qwen4_ple_prefetch_buffers (2F -> 10P), which had the same import. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- test_hicache_fast_file_unit (sgl-project#39880): HiCacheFile._get_component_path was removed upstream (sgl-project#40963); build the path from _get_component_key. - test_qwen4_exp_ple_staging (sgl-project#40235): eager_runner no longer imports get_parallel (sgl-project#40638); patch it only where it is read. - test_elastic_cuda_graph_setup (upstream, new): give the runner stubs a device -- the stack's SM120 graph prewarm (sgl-project#36787) reads it first and is a no-op off CUDA. - test_serving_decisions (upstream, new): its ScoringManager fake gets request_preprocessor like the other fakes sgl-project#39716 updated, and the yield-order check no longer pins where the first encode lands (request conversion hops through sgl-project#39716's worker thread); it still fails when encodes run back to back while another request is waiting. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
#36497 merged into
mainthrough #37500 on 2026-09-08, so this branch now sits onmain(rebased at9c8d4641f) with no external dependency. The commits listed below are the whole diff.On sm120 the model from #36497 does not serve as written. The QSA sparse decode path is gated on
is_sm100_supported()and falls back to a packed gather plus a FlashAttention varlen call; the QSA MQA indexer scoring runs TileLang with a silent torch fallback; and the JIT modules are built during graph capture. The PLE host-load path also performs a wasted row-zero read on non-owner ranks (correct output, unnecessary PCIe traffic). This PR adds the sm120 paths: a direct-paged Triton sparse decode with a fused split-K merge, Triton MQA scoring, a fused small-row NVFP4 MoE kernel in the in-tree CUDA JIT, sm120 launch geometry for the hyperconnection mix, tuned FP8 fused-MoE configs for this GPU, NUMA-interleaved pinning for the offloaded PLE table, and correctness fixes for the items above. With this branch both checkpoints serve with CUDA graphs and NEXTN speculative decoding: FP8 at TP4/EP4 and NVFP4 at TP2/EP1.Motivation
sm120 is the workstation and consumer Blackwell architecture (RTX PRO 6000, RTX 5090, GB10 at sm_121). The QSA decode kernels this model depends on exist only for sm100: trtllm-gen has no sm120 cubins, so the gate is closed and the fallback gathers the selected tokens into a packed buffer before every attention call. Two day-0 reports describe the same gap: #36531 (the QSA fallback selects the pip FA4 path on sm120 and fails at the MLIR build) and the GB10 comment on #36497 asking to widen the sm100 gate. #36532 (FlashInfer GDN wanted fp32 state on sm120 while flag validation accepted bf16) is covered on
mainitself now, which converts the prefill state to fp32 on sm12x and ships the pooled bf16 decode kernel with FlashInfer 0.6.18, so the GDN commit this PR carried before the rebase is dropped.Widening the gate was measured and is not the right fix:
trtllm_batch_decode_with_kv_cachewithbackend="auto"routes compute capability below 10 to XQA, and forcingbackend="trtllm-gen"fails atfmhaRunner.cuh:37: Unsupported architecture. XQA cannot address the paged pool directly, so it pays a page-aligned gather that costs more than the attention itself at large batch (measured below). The contribution here is a direct-paged kernel that skips the gather at large batch and splits along the top-k axis to reach XQA-class latency at small batch.The irregular sparse-attention and gather paths are Triton: sparse decode, MQA scoring and the PLE gather have shape-dynamic index expansion where the compile keys are the fixed head and page tiles, not the sequence lengths. The quantized MoE GEMM is an in-tree sgl-kernel CUDA JIT kernel because it is a fixed-layout
mma.sync.kind::mxf4nvf4grouped GEMM with the architecture and model shape as compile keys. FlashInfer stays in place everywhere it owns the full production contract on sm100, including the NVFP4 MoE above 16 tokens, which remains the fallback.Modifications
Eleven commits, oldest first (hashes omitted; see
git log).SGLANG_QSA_DECODE_BACKENDselectsauto/triton/flash_attn/trtllm;autopicks Triton on sm120 (excluding sm121) and trtllm-gen where it exists. The MQA counterpartSGLANG_QSA_MQA_BACKENDacceptsauto/tilelang/triton/torch.SGLANG_QSA_MQA_BACKENDinstead of dropping to torch silently, prewarms the Qwen4Exp JIT kernels before graph capture.mmap+numa_interleave_memory+cudaHostRegisterinstead ofpin_memory=Trueso it does not exhaust the NUMA node local to the GPU. Goes through theallocate_ple_host_tablebackend switch thatmaingained with the file-backed table (pinned branch only; the mapping is read back withple_pinned_mapping). Opt-out env provided.main).New environment variables, all declared in
environ.pywith defaults that preserve non-sm120 behavior:SGLANG_QSA_DECODE_BACKEND,SGLANG_QSA_MQA_BACKEND,SGLANG_PLE_OFFLOAD_NUMA_INTERLEAVE, andSGLANG_NVFP4_MOE_SM120(a kill switch for the small-row kernel, default on; turning it off restores the FlashInfer CUTLASS path everywhere).New registered tests:
kernels/ops/qsa/test_qsa_sparse_decode_triton.py,kernels/ops/qsa/test_qsa_mqa_triton.py,kernels/ops/qsa/test_qsa_sparse_index_bounds.py,kernels/ops/moe/test_nvfp4_moe_sm120.py,unit/models/test_qwen4_ple_prefetch_buffers.py,unit/utils/test_interleaved_pinned_table.py,unit/layers/moe/test_nvfp4_smallm_dispatch.py(CPU), an extension ofunit/layers/moe/test_fused_moe_triton_config.py(CPU), plus additions to the existing QSA, PLE offload, PLE table, hc_mix and cuda graph tests. The three kernel benchmarks live undertest/manual/kernels/benchmark/(they need an sm120 GPU and, for the MoE one, local checkpoint tensors, so they are not registered CI jobs).Environment
PCIe workstation host, no NVLink; measured GDDR7 bandwidth 1.459 TB/s; two unequal NUMA nodes (257.6 GB and 128.9 GB), which is why the NUMA commit exists.
Accuracy Tests
Every serving and accuracy number below was measured at the branch tip. Sampling for
sglang.test.run_eval: T=1.0, top-p 0.95, top-k 20, max tokens 32768, thinking on. Server: CUDA graphs, NEXTN 3 steps / 4 draft tokens, PLE offloaded to host.The NVFP4 model card publishes 98.75% for AIME26 under the 8-pass protocol; the 96.25% above is the FP8 checkpoint under the same protocol (per-pass spread 93.3 to 100; repeated 8-pass runs during development landed between 96.3 and 98.3). Multimodal observations exist but their protocols are not all matched to published ones, so they are not claimed as comparisons.
Speed Tests and Profiling
QSA sparse decode
Isolated kernel benchmark at the model's full-attention shape: 24 query heads, 2 KV heads, head dim 256, bf16, 2051 selected-token slots per row, page size 64 for the gathered paths, ragged valid counts. CUDA events around the complete call, 10 warmups.
The final column carries a 3-4 us cost at small rows over the pre-review revision of this kernel; it combines a defensive reinitialization of the split-K reduction generation with a retuned split schedule, and still beats every fallback at every row count. At 64 rows the split count is 1, so the last two columns both run the non-split kernel and their near-identical times are expected. The XQA column is what widening the sm100 gate would select: at 64 rows it spends 0.363 ms of 0.548 in the gather, and its 1-16 row numbers are optimistic because the gathered working set stays L2-resident across benchmark iterations. Numerics against an fp32 reference stay at the bf16 output-rounding floor (max abs 0.000477 to 0.007577 across 1-64 rows); eager calls are bitwise reproducible and captured graphs replay with zero drift. The split-K path is clean under Compute Sanitizer memcheck, initcheck, racecheck and synccheck with guard bands, across capture and replay.
QSA MQA indexer scoring
Decode scores a 32k source sequence (8192 compressed keys); prefill is one causal packed sequence. CUDA events, 2 warmups.
TileLang keeps a 2-4 us edge at decode batch 1-16; Triton wins at batch 64 and both prefill points and removes both the third DSL and the silent torch fallback from the sm120 path. Max abs logit error against torch is 2.4e-6 and all selected top-k sets matched exactly, including rows below the 512-block budget.
NVFP4 small-row routed MoE
Layer 0 real checkpoint tensors, TP2 rank 0, 512 local experts, hidden 2560, rank-local intermediate 320, top-k 10. One MoE call per captured graph, 30 repeats, 256 MiB L2 flush per sample.
Both GEMMs stay W4A4 group 16; relative L2 error against fp32-dequantized weights matches FlashInfer to the third decimal (0.1375 vs 0.1377 at 16 tokens). Graph capture replays all three shapes with stable workspace addresses.
Hyperconnection mix and FP8 MoE configs
hc_mix: a captured graph of 97 mix calls with distinct weights runs 5.0/5.4/20.8% faster at 1/16/64 rows (13.93 us per call at one row); max abs error is unchanged and 10,000 replays show no drift. The tuned FP8 fused-MoE configs reduce the isolated TP4/EP4 chain from 37.05 to 24.04 us at one token and 0.5-3.3% at 16-2048 tokens; the same chain measures 22.94 us against 49.90 us on FlashInfer CUTLASS per-tensor FP8 and 57.39 us on the CuTe-DSL sm12x grouped MoE from flashinfer PR 4720. E=512/N=160 (TP4 without EP) is rejected by the FP8 quantization layer before any config selection: the per-partition gate-up output size 160 is not divisible by the weight quantization block size 128, so no config exists for it.
End to end serving
sglang.bench_serving, random dataset, ISL 1024 / OSL 512, CUDA graphs on, PLE offloaded to pinned host memory. Each row issues more prompts than its concurrency window, so median TTFT includes scheduler queueing for the requests beyond the window: NEXTN drains the window roughly twice as fast at concurrency 16, which is why its TTFT drops there, while at concurrency 64 the draft-extend prefill overhead dominates and TTFT rises.FP8, TP4/EP4:
NVFP4, TP2/EP1 (two GPUs matching the four-GPU FP8 numbers is expected here: decode is weight-bandwidth-bound, NVFP4 halves the streamed weight bytes, and tensor-parallel traffic over PCIe scales poorly, so fewer ranks lose little):
Reference point at the #36497 head
73a255206on the same host: FP8 TP4/EP4, eager, no MTP, concurrency 1, 17.4 output tok/s at 57.21 ms median TPOT; a baseline for "it serves at all", not a like-for-like graph comparison.The NUMA commit is what lets the NVFP4 NEXTN configuration start with the PLE table offloaded:
pin_memory=Trueput both TP2 ranks' 47.7 GiB on the 128.9 GB node local to GPUs 4-7, the node went into reclaim and the driver failed with Xid 31 MMU faults at a host address during the draft load. Interleaved, each rank spreads 23.8 GiB evenly across both nodes and startup completes; single-stream throughput is about 2 percent below a GPU-resident table, the expected cost of PCIe reads.Rebase notes (2026-09-16)
Rebased from the #36497 head onto
mainat9c8d4641f. Besides the GDN commit drop and the PLE allocation change described above, the QSA tests sit intest/registered/kernels/ops/qsa/following the test layout consolidation (#39966), and the tree is formatted with ruff-format as the pre-commit config now asks. CPU verification on the rebased tree: the touched CPU suites pass (61 tests, 51 subtests). GPU check of the rebased tree on a DGX Spark (GB10, sm_121) on 2026-09-17: file-backed PLE boots and serves with defaults, with the Triton QSA kernels forced on, and with NEXTN (table in the comments). The exact-sm120 numbers above are from before the rebase; @detain reports the pre-rebase stack running on 4x RTX PRO 6000 Workstation Edition together with #37275, #38144, #38209 and #36644 (see the #37275 thread). An sm120 re-run of the rebased tree follows when a card frees up.Not covered
--kv-cache-dtype fp8_e4m3still asserts in the QSA path (Qwen3.8-Flash-Next QSA crashes with FP8 KV cache (BF16 q vs FP8 k dtype assertion) #36545); neither checkpoint requests it. Separate PR.base-b-kernel-unitsuites, as the test taxonomy check asks, and those run on H100/B200/H200 runners, so the sm120-gated tests skip there; the architecture-independent parts do run. The1-gpu-smallrunner is a 5090 (SM120), but no kernel-unit suite is defined on it. If maintainers want the sm120 paths exercised in CI, abase-b-kernel-unit-test-1-gpu-smallsuite would do it and I can wire the registrations to it.Checklist
Review and Merge Process
CI States
Latest PR Test (Base): ❌ Run #35953552532
Latest PR Test (Extra): ❌ Run #35953552457
Latest PR Test (AMD ROCm 10): ❌ Run #35953552494