Repository navigation
Conversation
Serving an NVFP4 MoE checkpoint on SM120 (RTX PRO 6000) fails before the first token: create_moe_runner() sends every device with compute capability >= 10.0 to FLASHINFER_TRTLLM, whose NVFP4 kernels are implemented for SM100 only, so apply() falls through to the NotImplementedError at the end of the same function. Select FLASHINFER_CUTLASS for these parts instead. That alone still raised, naming the case it told you to use, because enable_flashinfer_cutlass_moe answers from the raw --moe-runner-backend. That stays "auto" whether or not create_moe_runner() resolved to CUTLASS, so apply() skipped its CUTLASS branch. Passing --moe-runner-backend flashinfer_cutlass explicitly only worked because it happened to make the global agree. Read the resolved backend, the way the two other _moe_runner_backend reads in this file already do. This half is not SM120-specific: any device whose "auto" resolves to CUTLASS hits it. Verified on an RTX PRO 6000 Blackwell serving nvidia/Qwen3.6-35B-A3B-NVFP4 with no --moe-runner-backend flag. The added tests resolve the backend without launching kernels, so they run anywhere; the two SM120 cases fail without this change and the SM100 case passes either way, pinning the B200/B300 default in place. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
FMHAv2 has no FP8 (e4m3) prefill kernel on SM120/SM121, and ModelOpt NVFP4 checkpoints commonly declare "kv_cache_quant_algo": "FP8", so --kv-cache-dtype auto selects one and the run dies inside CUDA-graph capture with ValueError: FP8 (e4m3) is not yet supported for FMHAv2 on SM120 raised from flashinfer, naming neither the flag that caused it nor a way out. Check it in the constructor, mirroring the trtllm-gen page-size precondition just below, and name both remedies. get_default_attn_backend() already gates trtllm_mha on is_sm100, so this only triggers when the backend was asked for explicitly. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ly installs Two assumptions in the JIT toolchain no longer hold on distributions shipping glibc >= 2.41 (Ubuntu 26.04 being the common case), where every kernel build fails before any sglang code runs. glibc 2.41 declares C23 rsqrt/rsqrtf as noexcept. CUDA toolkits before 13.2 declare them with no exception specifier, so nvcc rejects every translation unit that reaches <cmath>: bits/mathcalls.h: error: exception specification is incompatible with that of previous function "rsqrt" (crt/math_functions.h) Detect that from the headers rather than a version tuple, and fall back to a pip-installed toolkit carrying the _NV_RSQRT_SPECIFIER guard. An explicit CUDA_HOME still wins, and an unreadable header is treated as usable, so an unfamiliar layout keeps today's behaviour. The pip CUDA wheels are also runtime-only: libraries live in lib/ rather than lib64/, and libcudart.so.13 ships without an unversioned dev symlink, so the link step searched a directory that does not exist and then could not find -lcudart. Resolve the real library directory and fall back to ld's -l: form rather than writing symlinks into site-packages. Those wheels are independently versioned, so nvcc and the runtime headers can disagree and CCCL aborts the build complaining about include paths; warn with the versions that actually differ. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Conflict in trtllm_mha_backend.py: main removed the blank line after the use_fmha_v2 assignment while this branch inserted the SM120 FP8-KV guard there. Kept the guard; main's side of the hunk was empty. main's new native NVFP4 KV path (uses_native_fp4) is unaffected -- it runs on FP4 scales, not an e4m3 KV cache, so the guard's data_type check does not fire for it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
weignerg
requested review from
Alisehen,
AniZpZ,
BBuf,
Edwardf0t1,
FlamingoPg,
Fridge003,
HaiShaw,
JustinTong0323,
OrangeRedeng,
Qiaolin-Yu,
b8zhong,
ch-wan,
hebiao064,
ispobock,
merrymercy and
mmangkad
as code owners
October 9, 2026 00:34
…empty_cache and allocation retry
…n speculator model without model_type
…or dflash speculators
…allocation without fill_cuda
weignerg
requested review from
Ying1123,
alphabetc1,
hanming-lu,
hnyls2002,
huangtingwei9988,
hzh0425,
xiezhq-hermann and
yizhang2077
as code owners
October 9, 2026 01:59
…SWAKVPool for NVFP4
…d FlashInfer stride geometry - Ensure Gemma4RotaryEmbedding casts inv_freq and zero-pad slices to device and fp32 before torch.cat, with device-aligned cos_sin_cache - Dynamically evaluate swa_head_dim alongside head_dim in SWAKVPool and DefaultPoolConfigurator / HybridSWAPoolConfigurator cell size calculation - Route memory pool _safe_zeros through torch.empty uint8 zeroed views to preserve 3D/4D tensor geometry and avoid mutating outer dimensional strides for FlashInfer decode
…r FlashInfer NVFP4 prefill
…l size calculation
…equant workspace decode
This was referenced Oct 10, 2026
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 10, 2026
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 10, 2026
…VFP4 KV cache + Gemma4 text config Skip reversed per user direction: NVFP4 KV (RDXA + NVDA NVFP4 variants of Qwen3.8-Flash-Next) is an ACTIVE FUTURE config. Squash of pr43247 net diff (22 files, base 5b5d721) with toolchain.py excluded (entry 65 already applied; modelopt_quant.py entry-63 hunks auto-merged idempotently via -3). Carries the branch's merged-in PR sgl-project#42419 (drop fp8 scales under nvfp4 KV, still OPEN upstream) as part of the net diff. Conflicts resolved (4): - flashinfer_backend.py x4: UNION our KVLocPlan `plan=` plumbing with the PR's per-wrapper head_dim/num_kv_heads/num_qo_heads kwargs (heterogeneous SWA dims) at all 4 call_begin_forward sites + signature keyword-only marker preserved; PR's custom_kv_indices wiring into update_sliding_window replaces entry 175's single-wrapper RuntimeError guard (PR intent). - memory_pool.py: MHATokenToKVPool.set_kv_buffer_prefix_valid keeps our removed conversion preamble (fp8 fused-scale paths) + takes the PR's is_quantized_kv_cache early-return at its anchor; _safe_zeros Float4 allocation hunks auto-merged. - pool_configurator.py: took the PR's has_heterogeneous restructure (self.kv_cache_dtype_str == kvc.kv_cache_dtype_str, __init__:220) over our equivalent kvc. spelling; _compute_qsa_cell_size tail preserved. - utils/common.py: make_layers empty_cache-per-layer generator body (from d9e1d68) inside our layer_stack/neighbour wrapper. Test adaptation: test_flashinfer_nvfp4_speculative.py __new__ stub gains prefill_wrappers_ragged/prefill_wrapper_ragged (PR adds the attribute read in init_forward_metadata; real __init__ sets both) -- back to 6P. Battery (CVD=9): shipped fp4_kv_cache_quant_method+nvfp4_moe_backend+ spec 31P; pool_configurator 13 subfail = entry-175 env class (is_cuda False, no GPU); server_args/qsa_kv_pool/yarn/ple_staging/kv_loc_plan/ modelopt-nvfp4 set 408P+5skip; 8 imports incl. scheduler OK; ruff repo-ruleset clean; ruff-format drift from the PR fixed in 9 files (verified cosmetic). PRE-EXISTING red re-confirmed on stack tip: test_kernels_namespace reclassified-entry-point inventory (batch C qwen4_short_conv entry not inventoried -- owed, unrelated to this PR).
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 11, 2026
… 178 boot crash) sgl-project#43247's has_heterogeneous branch in DefaultPoolConfigurator._compute_cell_size read kvc.layer_info.{swa,full}_attention_layer_ids via getattr(..., []), but ModelLayerInfo (sgl-project#40983) always defines those fields and defaults them to None for models without a hybrid-SWA split. The [] fallback never fired, so non-SWA models (Qwen3.8-Flash-Next, Mamba hybrid) crashed at memory-pool init on every TP rank: TypeError: 'NoneType' object is not iterable. Read the fields directly and coalesce None to []; swa_count == 0 then falls through to the uniform cell-size path as before sgl-project#43247. test_pool_configurator.py: 60P + 26 subtests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 15, 2026
… during dequant workspace decode (req_pool_indices_cpu + capture-guarded _to_cpu_int_list; pool_configurator coalesce skipped as dup of b05a7c1) [batch-apply-e 2026-10-14] (cherry picked from commit dbb764c15e1fdecfcb8d8c7680d387c137c9f0ac)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This pull request provides complete, production-grade Blackwell (SM120 / RTX 5090) integration for NVFP4 KV cache and Gemma 4 model execution with FlashInfer:
FlashInfer NVFP4 Decode Attention Access:
--kv-cache-dtype nvfp4and--decode-attention-backend flashinfer,fp4_kv_cache_quant_method.pypreviously omittedflashinferfrom decode access registration, raisingValueError: KV cache method 'nvfp4' does not support decode with flashinfer attention backend.memory_pool.py(get_flashinfer_decode_dequant_workspace_kv_buffer).flashinferinto_NVFP4_DQ_KV_DECODE_BACKENDSandKV4_ATTENTION_MHA_BACKEND_CHOICES.Gemma 4 Configuration & Heterogeneous Architecture Fixes:
_apply_gemma4_attention_overrides,text_config.is_heterogeneouswas accessed directly, raising anAttributeErroron standard HuggingFaceGemma4TextConfigobjects whereis_heterogeneousis absent. Guarding this withgetattr(text_config, 'is_heterogeneous', False)enables seamless config parsing.Gemma4RotaryEmbedding(castinginv_freqto fp32 and target device before concatenation).--language-model-onlyexecution with heterogeneous head dimensions.Memory Pool & Stride Geometry Protection:
Technical Validation & Benchmarks
test/registered/unit/layers/quantization/test_fp4_kv_cache_quant_method.py— 23/23 tests passing.RedHatAI/gemma-4-26B-A4B-it-NVFP4(64k context, zero CPU offload, pure GPU speed): verified end-to-end token generation.RedHatAI/gemma-4-31B-it-NVFP4(32k–256k context with host RAM offload): verified parsing and KV allocation.nvidia/Gemma-4-31B-IT-NVFP4: verified config parsing and speculative draft layers.CI States
Latest PR Test (Base): ❌ Missing
run-cilabel -- add it to run CI tests.Latest PR Test (Extra): ❌ Blocked --
run-ciis required first.Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.