Repository navigation
[Chore] flashinfer: Use flashinfer moe-ep API instead of deprecated NVLinkOneSidedAllToAll API - #46885
[Chore] flashinfer: Use flashinfer moe-ep API instead of deprecated NVLinkOneSidedAllToAll API#46885trevor-m wants to merge 3 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
nvpohanh
left a comment
There was a problem hiding this comment.
[by Claude Code] This review is done by agents. Please feel free to disagree if they do not make sense.
[by Claude Code] Severity: nit | Confidence: High
Issue
The Accuracy Tests section gives a before/after GSM8K result (94.92% vs 95.30%) for nvidia/DeepSeek-R1-0528-FP4-V2, but it does not name the GPU.
Fix
Add the GPU or system used, for example B200 or GB200. This path depends on the NVLink setup, so naming it shows reviewers what was tested.
| expert_id_payload_index=expert_id_payload_index, | ||
| topk_weights, | ||
| hidden_states_scale=x_sf, | ||
| max_tokens_per_rank=runtime_max_tokens_per_rank, |
There was a problem hiding this comment.
[by Claude Code] Severity: style | Confidence: High
Issue
This works with FlashInfer 0.7.2, which SGLang pins today. Heads-up for the next upgrade: FlashInfer main renamed this keyword to runtime_max_tokens_per_rank in flashinfer-ai/flashinfer#7099 and removed the old name. That change is not released yet. It will ship in the same release as flashinfer-ai/flashinfer#6047 and flashinfer-ai/flashinfer#6621, which remove MoeAlltoAll. On that release, max_tokens_per_rank= here raises TypeError, because NVLinkOneSidedAlltoAll.dispatch() has no **kwargs.
Fix
No change is needed for 0.7.2. When SGLang upgrades FlashInfer past 0.7.2, rename this keyword to runtime_max_tokens_per_rank= in that upgrade PR. The CPU test fakes take **_kwargs, so they will not catch this.
There was a problem hiding this comment.
@leejnau Is this a FlashInfer API breakage in their main branch?
There was a problem hiding this comment.
Yes, please on-hold until release v0.7.3 to directly adapt to the new keyword runtime_max_tokens_per_rank .
|
Suggestion on naming: now that this dispatcher goes through Could we name it |
|
Hi @bobboli, renaming the server arg turns out to be quite an invasive changes, making this PR go from a file 1 change + unit tests to touching over 40 files. I'd prefer to keep the server arg as is, we can also rename it later if a new flahsinfer a2a comes out. |
|
Validating latest code against flashinfer 0.7.3, GSM8k is 96%, all of test_flashinfer_a2a_wide_ep.py, test_flashinfer_dispatcher.py and test_muse_spark_runner_dispatch.py tested passed on 4xGB200. |
|
Closing this PR since it's included in #48468 |
Motivation
Flashinfer has deprecated and removed the API we currently use for
--moe-a2a-backend=flashinfer: flashinfer-ai/flashinfer#6621 flashinfer-ai/flashinfer#6047If we don't update it, it will become unusable the next time we update flashinfer.
Modifications
Update the code to use the new
moe-epapi instead. All changes outside of unit tests are contained topython/sglang/srt/layers/moe/token_dispatcher/flashinfer.pyso there should be no side affects on other code paths.Accuracy Tests
GSM8K
Result without this PR: 94.92%
Result with this PR: 95.30%
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #41927706980
Latest PR Test (Extra): ❌ Run #41927706597
Latest PR Test (AMD ROCm 10): ❌ Run #41927707112
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: