Repository navigation
Conversation
…he environment
DeepseekV4AiterMegaMoEExperts builds MegaMoEV2 with quant="a8w4" and AITER's
"auto" combine. Two variables choose them:
VLLM_ROCM_AITER_MEGA_MOE_QUANT a8w4 (default) | a4w4
VLLM_ROCM_AITER_MEGA_MOE_P2P_QUANT auto (default) | none | fp8_blockwise_1x32
| fp4_blockwise_1x32
The weights are MXFP4 and prepared the same way for both quants. The
fixed-slot bundle plan now gets the activation dtype and the combine format,
and both are in the shared runtime's cache key. fp4_blockwise_1x32 needs an
AITER with the MegaMoE MXFP4 combine.
Signed-off-by: Hemanth Acharya <heachary@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Mehmet Aslan <Mehmet.Aslan+amdeng@amd.com>
Fangzhou-Ai
left a comment
There was a problem hiding this comment.
require ROCm/aiter#8186
| "VLLM_ROCM_AITER_MEGA_MOE_P2P_QUANT": env_with_choices( | ||
| "VLLM_ROCM_AITER_MEGA_MOE_P2P_QUANT", | ||
| "auto", | ||
| ["auto", "none", "fp8_blockwise_1x32", "fp4_blockwise_1x32"], |
There was a problem hiding this comment.
"none" is documented as BF16, but AITER rejects it whenever a runtime's plan contains the 8192 bucket, because that bucket's aligned-pair Stage2 only emits FP8 rows (aiter v0.1.29 mega_moe_config.py:382 and :1033). That bucket is present for any max_num_batched_tokens above 4096, and MI355X defaults to 16384 (arg_utils.py:3020). So VLLM_ROCM_AITER_MEGA_MOE_QUANT=a4w4 with P2P_QUANT=none fails at load on V4.1-Flash with "p2p_quant='none' conflicts with aligned-pair Stage2". a8w4 hits the same error with the fused shared expert (49 experts per rank) or on V4-Pro shapes.
There was a problem hiding this comment.
Good catch, thanks. The aligned-pair Stage2 that AITER uses for the 8192 bucket only writes FP8 rows. With none, any runtime whose plan includes that bucket fails unless the network's tuner turns aligned-pair off first. That covers V4.1-Flash A4W4, the 49-expert fused shared-expert case, and V4-Pro A8W4.
I've fixed it in AITER rather than vLLM. A non-FP8 combine now falls back to the plain Stage2, which already writes BF16, instead of raising. #8186 already did this for FP4: ROCm/aiter@11b1cc53a8 (#8186). I compared the bundle plans before and after, and only the combinations that used to raise changed.
| experts=self.num_experts, | ||
| topk=self.top_k, | ||
| quant="a8w4", | ||
| quant=self.quant, |
There was a problem hiding this comment.
#63040 (draft) makes the same change on these lines (a_dtype in the fixed-slot probe, quant in the cache key, quant=self.quant) but reads a different env, VLLM_ROCM_EP_MEGA_MOE_QUANT. #63229 moves this class to fused_moe/experts/aiter_mega_moe.py, and its copy hard-codes quant="a8w4" (:297). Whichever lands second has to port both knobs, or the envs stay in envs.py with nothing reading them. Could you agree on one env name? cc @LiuYinfeng01 @micah-wil
|
@Fangzhou-Ai I have run agentx with this PR and updated the results in the table. Im seeing good uplifts there compared to the baseline. |
Motivation
AITER MegaMoE for DeepSeek-V4.1-Flash has scope for improvement:
The companion AITER PR addresses all three, but only for A4W4 activations with the MXFP4 combine, and vLLM cannot select either today:
DeepseekV4AiterMegaMoEExpertshard-codesquant="a8w4"and leaves the combine format on AITER'sauto(BF16, or FP8 from 1024 tokens per rank). This PR makes both selectable. It adds no kernels: A4W4 MegaMoE is already in AITER v0.1.29, and the MXFP4 combine and the optimizations are in the AITER PR.This is work done in collaboration with @maslan-coop26
Summary of changes
vllm/envs.py: addVLLM_ROCM_AITER_MEGA_MOE_QUANT(a8w4default |a4w4) andVLLM_ROCM_AITER_MEGA_MOE_P2P_QUANT(autodefault |none|fp8_blockwise_1x32|fp4_blockwise_1x32), validated withenv_with_choices.vllm/models/deepseek_v4/amd/mega_moe.py: pass the quant and combine format toMegaMoEV2, and tobuild_mega_moe_bundle_planwhen probing for fixed-slot dispatch. Both are added to the shared runtime's cache key. The MXFP4 weights are prepared the same way for both quants.a8w4,auto).fp4_blockwise_1x32needs an AITER that includes the companion PR.Companion AITER PR: ROCm/aiter#8186
How to enable
Everything is opt-in. To run the full set:
--moe-backend aiter_mega_moe --enable-expert-parallel --data-parallel-size 8 --all2all-backend mori_high_throughputwithVLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_MOE=1.VLLM_ROCM_AITER_MEGA_MOE_QUANT=a4w4 VLLM_ROCM_AITER_MEGA_MOE_P2P_QUANT=fp4_blockwise_1x32.AITER_MEGA_FIXED_SLOT_MAX_MTPR=1023, read by AITER directly: it gives decode its 512-token fixed-slot runtime (the default limit of 255 gives a 128-token one).With steps 3 and 4 on DeepSeek-V4.1-Flash EP8 (48 routed experts per rank), AITER applies the tuned configs and the MegaMoE improvements (early GEMM1 tiles, light release, GEMM2 fused into Stage1, resident grid, tuned GEMM1/GEMM2) on its own; they are part of its config selection and need no further switches.
Timing
Before
After
Figures above show a breakdown at 224 tokens / rank. Theres a good improvement from 261us -> 204us.
Results
DeepSeek-V4.1-Flash MoE layer (
DeepseekV4AiterMegaMoEExperts, EP8,VLLM_ROCM_AITER_MEGA_MOE_QUANT=a4w4,VLLM_ROCM_AITER_MEGA_MOE_P2P_QUANT=fp4_blockwise_1x32) on 8x MI355X, vLLM nightly7c3a9302with this PR and the AITER PR, CUDA-graph replay, slowest rank. Outputs are bitwise identical to the baseline at every size.End to End results
Fixed length Perf results
DeepSeek-V4.1-Flash, 8x MI355X, DEP8, 1k in / 8k out, concurrency 256, DSpark k=6,
max_num_batched_tokens=4096. Both arms: A4W4 MegaMoE with MXFP4 combine. Test arm: MegaMoE improvements enabled.Reproduction
Image:
vllm/vllm-openai-rocm:nightly-rocm100-7c3a9302f5ac2441ad199134129e973d22a46797, with this PR, the AITER PR (aiter/ops/flydslfromheachary/dsv41flash/megamoe-improvements) and FlyDSL 0.5.0 applied.Server:
Benchmark (after a 256-prompt warmup of the same shape):
Accuracy
Agent-x Perf results for c-256
Baseline here refers to this PR which enables DEP8 for DSv4.1 : SemiAnalysisAI/InferenceX#5056. The baseline and test branch were run on the same machine. The baseline reproduces the numbers for c-256, DEP8 from the inf-x PR.
Same server command (
agentic.yaml:override_dep8_c256, DSpark K5, synthetic acceptance length 3.51) on vLLM ROCm nightly7c3a9302.