Repository navigation
[ROCm][Perf][DSv4.1] Support dynamic EPLB with AITER MegaMoE - #70258
Draft
shen-shanshan wants to merge 1 commit into
Draft
shen-shanshan wants to merge 1 commit into
shen-shanshan wants to merge 1 commit into
Conversation
Let DeepSeek-V4.1 on ROCm run --enable-eplb with --moe-backend aiter_mega_moe, following DeepGemmMegaMoEExperts: - DeepseekV4AiterMegaMoEExperts counts physical slots (redundant ones included), loads each checkpoint expert into every local replica slot, and exposes set_eplb_state / get_expert_weights / update_expert_map. - A Triton kernel maps logical routes to EPLB replicas, records load and, with a fused shared expert, appends the shared route in one launch; the old path runs unchanged until EPLB registers the layer. - V4 keeps refusing EPLB on MegaMoE; V4.1's non-MegaMoE ROCm path raises a clear error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: shen-shanshan <467638484@qq.com>
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.
Overview
Enable
--enable-eplb(with or without redundant experts) for DeepSeek-V4.1 on ROCm with--moe-backend aiter_mega_moe, which previously refused EPLB. Target deployment: DEP8 on MI355X (SemiAnalysisAI/InferenceX#5056).Claims
--enable-eplband anynum_redundant_experts; load is recorded and live rearrangements keep outputs correct.Validation
Unit tests (MI355X):
pytest tests/models/test_deepseek_v4_aiter_mega_moe.py -q— 25 passed. New cases cover redundant-slot weight loading,get_expert_weightsviews (3-D weights and 2-D shuffled scales), and the placement kernel vs a torch reference (replica choice, load recording, fused-shared dispatch).E2E (8×MI355X, DeepSeek-V4.1-Flash, DEP8). Server =
override_dep8_c256of InferenceX#5056 (TP1 × DP8 + EP,--all2all-backend mori --moe-backend aiter_mega_moe, DSpark 5 tokens, fp8 KV), EPLB config{"window_size":100,"step_interval":200,"use_async":false,"communicator":"torch_nccl"}. GSM8K: lm-evalgsm8k8-shot, 1319 questions, 64 concurrent (settings ofDeepSeek-V4-Flash-MXFP4.yaml); the first live rearrangement lands ~40% into the eval.num_redundant_experts=0num_redundant_experts=8num_redundant_experts=16GSM8K stderr is ±0.007; all runs are within noise. Each live rearrangement takes ~1 s.
Overhead of idle EPLB (
step_interval=1e9, nothing ever moves),vllm bench serverandom 2048/1024, 2048 prompts at concurrency 512, runs 2–3 after warmup:Throughput/TPOT differences are within run-to-run spread; median ITL is ~0.4 ms (+1.2%) higher, about 10 µs per MoE layer for the extra map-and-record launch. KV cache capacity drops 8% per rank (38.6M → 35.5M tokens) for the EPLB buffers.
AgentX DEP8 throughput, EPLB off vs on:
<TODO: add AgentX benchmark>Commands
Details
In DEP8 every MegaMoE launch waits at combine for the most-loaded EP rank; EPLB evens this out by moving/replicating hot experts.
DeepseekV4AiterMegaMoEExperts(vllm/models/deepseek_v4/amd/mega_moe.py) now plugs into the shared EPLB framework the same wayDeepGemmMegaMoEExpertsdoes on NVIDIA:num_expertscounts physical slots;weight_loaderfills every local slot from EPLB's initial linear placement (physicalpholds logicalp % num_logical).set_eplb_state,get_expert_weights,update_expert_map,layer_id.get_expert_weightsreturns expert-major views (AITER's a16w4 shuffle keeps each expert contiguous); migration copies in place, so the sharedMegaMoEV2weight pointers and captured graphs stay valid._eplb_place_experts_kernel(reusingeplb_map_and_record) maps logical routes to physical replicas, records load, and handles the fused-shared-expert dispatch in one launch. It is used only once EPLB registers the layer; otherwise the old_append_shared_expert_kernelpath runs.deepseek_v4/amd/model.py: computes logical/physical/redundant counts fromeplb_config; EPLB requiresexpert_placement_strategy="linear"; V4 still refuses EPLB (noMixtureOfExperts).deepseek_v41/amd/model.py: setssupports_eplb = True, drops the hard-coded zero redundant experts, and errors clearly if EPLB is requested on the non-MegaMoE path.Limitations:
torch_gloo(CPU staging); validation usedtorch_nccl. A ROCm default is left to follow-up.Not a duplicate: #68385 tunes MegaMoE kernels without EPLB; #64835 / #68355 are NVIDIA-only.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.