Repository navigation
Conversation
1 of 11 tasks
ziang-and
force-pushed
the
feat/flashinfer-megamoe-nvfp4-w4a16
branch
from
September 20, 2026 23:27
0abbb91 to
e21e193
Compare
This was referenced Sep 21, 2026
ziang-and
force-pushed
the
feat/flashinfer-megamoe-nvfp4-w4a16
branch
from
September 29, 2026 03:46
16c1b86 to
05627ff
Compare
zianglih
marked this pull request as ready for review
September 29, 2026 04:56
zianglih
requested review from
Alisehen,
AniZpZ,
BBuf,
Edwardf0t1,
FlamingoPg,
Fridge003,
HaiShaw,
OrangeRedeng,
Ying1123,
b8zhong,
ch-wan,
hnyls2002,
ispobock,
merrymercy,
mmangkad,
wisclmy0611 and
zijiexia
as code owners
September 29, 2026 04:56
为单节点 NVFP4 W4A16 设置 P2P-only NVSHMEM 默认值,绕过 proxy 未初始化退出状态;保留显式配置并排除使用其他 A2A 后端的 draft。按要求不增加 behavioral regression tests。
ziang-and
force-pushed
the
feat/flashinfer-megamoe-nvfp4-w4a16
branch
from
October 12, 2026 06:48
3811493 to
9f22780
Compare
Contributor
Author
|
/tag-and-rerun-ci |
Contributor
Author
|
/rerun-failed-ci |
This was referenced Oct 12, 2026
Contributor
Author
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
@HumansAnd
Add NVFP4 W4A16 to the existing FlashInfer MegaMoE backend for serialized ModelOpt
checkpoints and
nvfp4_online. ReuseSGLANG_FLASHINFER_CUTEDSL_NVFP4_W4A16=1from #35120; the default NVFP4
MegaMoE path remains W4A4.
Dependency: uses upstream's released FlashInfer
0.7.1 pin from
#43494, including
FlashInfer #5019.
This PR does not change Dockerfiles or dependency pins.
Modifications
and use FlashInfer's native config, preprocessing and pooled workspace APIs.
W4A16 uses packed NVFP4 weights/block scales, per-expert FP32 weight scales,
BF16 expert activations/EP transport/combine and post-FC2 routing. Checkpoint
activation scales are neutralized; online quantization retains its source
precision and excluded-layer semantics. No new opt-in or quantization interface.
synchronized DP token counts and graph buckets while expert inputs remain local.
Resolve the EP process group through the active runtime context.
Kimi K3 NVFP4 W4A4/W4A16 uses standard TopK and local EP/shared-expert handling;
SiTU maps GEMM1 alpha/clamp fields to beta/linear-beta, separately from SwiGLU
clamps. MXFP8/DeepGEMM reject unwired SiTU; Nemotron ReLU-squared is unsupported.
SGLANG_FLASHINFER_MEGAMOE_IN_KERNEL_FC2_REDUCE=0uses external FP32 accumulation. Setting it to
1permits nondeterministicBF16 atomic candidates; tuning may still select external reduction. Use native
supports_output_viewto distinguish W4A4's borrowed output from W4A16's owned output.prepared weights into existing buffers. Retain the live layer, workspace owner
and captured addresses; stage runtime scales on every forward. Initialize dummy
weight_scale_2to one while preserving ordinary random-weight initialization.Serialized W4A16 reload is covered; W4A4 reload and online RL reload are outside scope.
Startup tuning and cache ownership
workspaces: powers-of-two decode profiles cover captured, eager and adaptive-MTP
bounds, plus the per-rank prefill ceiling from the shared runtime helper.
All ranks choose the smallest capacity covering synchronized DP counts,
including empty ranks; reject overflow.
Native first-forward AUTO alone would tune the first live input while caching
under workspace capacity. FlashInfer owns namespaced persistence; stage each
profile once across layers and preserve session winners for pooled workspaces.
GPUs do not overwrite each other's records. Same-GPU engines need separate
SGLANG_CACHE_DIRroots. Cache-disabled runs use unique output filenames.Cache naming adds no forward-path work.
SGLANG_FLASHINFER_AUTOTUNE_EXTENDimplicitly. Skipped/disabled tuning retainsthe default native path. Native tuning requires EP=WORLD; draft MegaMoE profiles
and new deterministic-mode behavior are outside scope.
Single-node NVSHMEM defaults
For supported single-node FlashInfer MegaMoE formats with no speculative decoding
or draft A2A
none, set these defaults before NVSHMEM initialization, preservingexplicit environment overrides:
These select the direct-P2P path and avoid the uninitialized proxy global-exit
state corrected by NVIDIA/nvshmem commit
af9e2391a849.NVIDIA/nvshmem#110 is closed; its
description and discussion provide additional background.
All EP GPUs must support peer memory access. Proxy-based global exit/timeout
polling and remote IB/UCX transport are disabled; NCCL/UID bootstrap networking
is unaffected. Multi-node jobs and drafts using other A2A backends receive no
automatic defaults. No dedicated environment-variable behavior tests are added.
Example on four Blackwell GPUs with FlashInfer 0.7.1:
Accuracy Tests
Validation target: SGLang
8d25027c9f2f5d714fee8b85f4c721ec68a54430, rebased ontoupstream
166b4ae7fcd78f7547e9e8fcc866f587b35b793dwith FlashInfer 0.7.1.GPU validation is deferred; previous-head GPU results are not claimed for this
revision.
git diff --checkpasses.with one CUDA-only skip and all runnable tests passing. Serving/native imports
are stubbed; these do not establish CUDA kernel or full-model correctness.
unsupported-format checks pass.
unchanged test class. Full local module collection is blocked by missing
orjson; this is not a pass of the full runtime-context suite.online NVFP4 W4A16 GSM8K, serialized W4A16 reload, and W4A16/W4A4 dummy generation.
No full K3 E2E, W4A4 reload, online RL reload, or serving-performance claim.
Raw local summaries:
Static checks from the repository root:
git diff --check 166b4ae7fcd78f7547e9e8fcc866f587b35b793d...HEAD git diff --name-only 166b4ae7fcd78f7547e9e8fcc866f587b35b793d...HEAD | xargs pre-commit run --filesSpeed Tests and Profiling
End-to-end serving performance has not been measured on the current head.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #38216266799
Latest PR Test (Extra): ❌ Run #38216266298
Latest PR Test (AMD ROCm 10): ❌ Run #38216266886