Skip to content

Support Waterfill with MegaMoE backend - #27350

Merged
ch-wan merged 74 commits into
sgl-project:mainfrom
xutizhou:fix/megamoe-waterfill
Jul 13, 2026
Merged

ch-wan merged 74 commits into
sgl-project:mainfrom
xutizhou:fix/megamoe-waterfill

Conversation

@xutizhou

@xutizhou xutizhou commented Jun 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • allow Waterfill to preserve an explicit MegaMoE backend instead of forcing DeepEP
  • allow the MegaMoE env path to be selected before Waterfill fallback logic runs
  • use a rank-local shared expert slot semantic helper for TopK, FusedMoE, and DeepSeek shared expert fusion call sites
  • add server-args tests for explicit MegaMoE and MegaMoE env selection under Waterfill

Dependency

Depends on #27349, which adds the MegaMoE/shared expert fusion loading compatibility needed by the current DeepSeek-V4-Flash FP4 test path. This branch is stacked on top of xutizhou:fix/megamoe-shared-fusion-quant; after #27349 lands, this PR should be rebased on main so its diff only shows the Waterfill+MegaMoE changes.

Testing

  • python3 -m compileall -q python/sglang/srt/layers/moe/fused_moe_triton/layer.py python/sglang/srt/models/deepseek_v2.py python/sglang/srt/layers/moe/topk.py python/sglang/srt/layers/moe/utils.py python/sglang/srt/server_args.py
  • B200 MMLU subset: pure MegaMoE accuracy 0.8509861213; Waterfill+MegaMoE accuracy 0.8531775018

CI States

Latest PR Test (Base): ❌ Run #29149824508
Latest PR Test (Extra): ❌ Run #29149824332

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

xutizhou added 4 commits June 19, 2026 11:29
# Conflicts:
#	python/sglang/srt/layers/moe/fused_moe_triton/layer.py
#	python/sglang/srt/layers/moe/hash_topk.py
#	python/sglang/srt/layers/moe/mega_moe.py
#	python/sglang/srt/layers/moe/topk.py
#	python/sglang/srt/layers/moe/utils.py
#	python/sglang/srt/layers/quantization/fp8.py
#	python/sglang/srt/model_executor/model_runner.py
#	python/sglang/srt/models/deepseek_v2.py
#	python/sglang/srt/models/deepseek_v4.py
#	test/registered/moe/test_hash_topk.py
#	test/registered/unit/eplb/test_deepep_waterfill_eplb.py
#	test/registered/unit/models/test_deepseek_v4_shared_expert_fusion.py
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 4, 2026
@github-actions github-actions Bot added the npu label Jul 5, 2026
# Conflicts:
#	python/sglang/srt/layers/moe/hash_topk.py
#	python/sglang/srt/layers/moe/topk.py
#	python/sglang/srt/server_args.py
@ch-wan
ch-wan merged commit eb31b53 into sgl-project:main Jul 13, 2026
153 of 173 checks passed
BBuf added a commit to BBuf/sglang that referenced this pull request Jul 13, 2026
… kernel extraction (moe)

main renamed deepep_waterfill.py -> waterfill.py and DeepEPWaterfillBalancer
-> WaterfillBalancer (cosmetic, no kernel-logic change); sgl-project#30786 extracted the
triton kernels to kernels/ops/moe/deepep_waterfill_kernels.py. Resolution keeps
the extraction and adopts main's naming, so waterfill.py imports the kernels
and exposes WaterfillBalancer (as model_runner now expects).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fzyzcjy added a commit that referenced this pull request Jul 13, 2026
…): black-collapse two now-shorter Waterfill statements

After renaming the DeepEP-waterfill strings to the shorter upstream #27350
names, two statements in prepare_moe_topk (raise ValueError / log_info_on_rank0)
fit on one line, so black collapses them. CI Lint (black-jupyter) flagged it;
apply the reformat.
fzyzcjy added a commit that referenced this pull request Jul 14, 2026
…vable): black-collapse two now-shorter Waterfill statements

After the upstream #27350 Waterfill rename shortened two strings in
prepare_moe_topk (the ValueError message and the log_info_on_rank0 call), they
fit on one line, so black collapses them. Applied as a postpare after the
cut+paste move so the move itself stays byte-faithful.
fzyzcjy added a commit that referenced this pull request Jul 14, 2026
…vable): black-collapse two now-shorter Waterfill statements

After the upstream #27350 Waterfill rename shortened two strings in
prepare_moe_topk (the ValueError message and the log_info_on_rank0 call), they
fit on one line, so black collapses them. Applied as a postpare after the
cut+paste move so the move itself stays byte-faithful.
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bypass-fastfail deepseek documentation Improvements or additions to documentation jit-kernel npu run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants