Repository navigation
[Perf] [NPU] moe: Add DeepGEMM-Ascend MegaMoE for Prefill - #1548
Draft
AkiYangDev wants to merge 2 commits into
Draft
AkiYangDev wants to merge 2 commits into
AkiYangDev wants to merge 2 commits into
Conversation
1 of 2 tasks
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.
Motivation
On Ascend 950, DeepSeek-V4.1-Flash Prefill can send routed tokens through AllGather, grouped expert matmuls and ReduceScatter. DeepGEMM-Ascend fuses the dispatch, expert FFN and combine in one device path. An eight-card offline prototype raised new-input throughput from 13,035.87 to 15,872.72 tokens/s/NPU (+21.8%) on a 128K prompt with a 124K cached prefix.
Modifications
fused_op_provider: "deepgemm"to AscendOps. It requires a fixed Prefill worker on one Ascend 950 node with TP8, attention DP8, EP8, static expert placement and eager synchronous execution. The existing fused-op provider iscann.Install a DeepGEMM-Ascend build for the worker's CANN runtime. Add these options to the regular Prefill launch. The 32,768-token launch budget resolves to 4,096 tokens per rank with attention DP8.
--disaggregation-mode prefill \ --tp-size 8 --attn-dp-size 8 --ep-size 8 \ --chunked-prefill-size 32768 --random-seed 42 \ --disable-overlap-schedule --disable-prefill-cuda-graph \ --ep-dispatch-algorithm static \ --moe-a2a-backend ascend_ops \ --moe-ascend-ops-config '{"prefill":"fused_op","fused_op_provider":"deepgemm"}'Accuracy Tests
The prototype and baseline used identical token inputs but different engine seeds. In a separate diagnostic against AllToAllV, matching its MXFP8 scale convention (
scale_alg=1) gave bitwise-identical outputs on the first matched-input call at 40 layers across 8 ranks. That diagnostic used a different quantization route from the AllGather comparison above. The full-model results leave output differences to resolve on the final branch with a fixed engine seed, including an AllGather repeat.Six CPU tests cover opt-in, fixed-worker startup, packed expert requirements, weight packing, live rows and the ignored route on an idle rank.
Speed Tests and Profiling
Eight Ascend 950DT cards, CANN 9.3.0-beta.1, torch-npu 2.13.0, DeepSeek-V4.1-Flash, real model routing, 384 routed experts plus 32 static replicas. Each arm timed 10 steps and 327,680 new input tokens. Throughput is new input tokens divided by the common elapsed time across all eight ranks and by eight cards.
The offline prototype recorded 3,200 provider calls over 40 routed layers. It used a DeepGEMM-Ascend build with BF16 rounding at the SwiGLU boundary and router weights applied after the down projection. These are prototype measurements. The exact integration and a pinned vendor build still need a device run. DeepGEMM-Ascend base revision
Reproduce on one eight-card host
Run AllGather, the DeepGEMM provider and an AllGather repeat in separate Prefill processes. Keep the runtime, model, ranks, routing, cache settings and engine seed fixed across runs. For AllGather, use
{"prefill":"allgather"}as the AscendOps configuration.Prime a distinct 124K prefix on each attention-DP rank. Send eight simultaneous
/generaterequests withmax_new_tokens=1,routed_dp_rankand a fresh 4K suffix. Omitbootstrap_host. Check each response for 131,072 input tokens, 126,976 cached tokens and one output token. Use the same input sequence and warmup in each run. Measure client latency and common burst wall time separately from the offline engine metrics above. One-token Prefill endpointChecklist
CI States
Latest PR Test (Base): ❔ Run #47058759173
Latest PR Test (Extra): ❔ Run #47058763177
Latest PR Test (AMD ROCm 10): ⊘ Skipped -- the PR is a draft; marking it ready starts a new run (AMD: then
/rerun-failed-ci).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: