Repository navigation
[Perf] [NPU] moe: Add DeepGEMM-Ascend MegaMoE for Prefill - #41
Merged
AkiYangDev merged 12 commits intoDec 3, 2026
Merged
AkiYangDev merged 12 commits into
AkiYangDev merged 12 commits into
Conversation
- aclnnGemmSyrkGetWorkspaceSize grew an int8_t cubeMathType argument between 9.3.0-beta.1 and the 9.3.0 release; apply the call-site adaptation to the DeepGEMM worktree as cann93-release-syrk.patch. - Record the patched-file digests in their Linux line-ending view and cover csrc/apis/aclnn.hpp as well; the previous digests were taken from a CRLF checkout and never matched a Linux prepare. - Prebuild the cann_ops_transformer ops and the triton Ascend npu_utils host extension during prepare with the default toolchain headers: their g++-13 -std=c++20 builds fail at runtime against the GCC 11 include path kept for the device JIT.
Validated on 141.61.45.121, CANN 9.3.0 release, 8 x Ascend950DT: offline 4096 finished=80, new_tokens=327680, measured_steps=10. - Drop CPLUS_INCLUDE_PATH from the run-time vendor environment: the device JIT has not needed the GCC 11 headers on the 9.3.0 release, while they break the cann_ops_transformer ops and the triton Ascend npu_utils host builds (g++-13 -std=c++20). Opt back in with DEVICE_JIT_GCC11=1. - Prepend the pip site-packages in vendor_env so the pinned pip cannbot-dsl 0.8.0 (tensor.reinterpret) shadows the cannbotdsl bundled with the host CANN release. - Extend the adapter's mHC runtime gate to the 9.3.0 release after extraction; the beta.1 pilot kernel runs on it. - Add run_all.sh: one-click offline tiers and the native vs DeepGEMM serve comparison with readiness polling and short smoke mode.
- runtime_libraries preloads the system libstdc++: the hcc toolchain dir first in LD_LIBRARY_PATH shadows it with a build missing the GLIBCXX_3.4.29 futex symbols, and mooncake (the default PD transfer backend) fails to import in the serve arm. - run_all.sh wait_ready exits as soon as the server process dies instead of polling for the full 40 minutes.
Drop the defensive layers: model-path candidate scanning, precondition re-checks, and duplicate idle checking (repro.sh already fails loudly on all of those). Keep the one-line defaults, the readiness poll that dies with the server, the SHORT smoke flag, and the per-tier summary print.
AkiYangDev
marked this pull request as ready for review
December 3, 2026 12:33
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.
Port of the routed-expert Prefill provider from Ascend/sglang #1548 to
dsv41-perf-1202.What changes
On a dedicated Ascend 950 Prefill worker,
fused_op_provider="deepgemm"lets DeepGEMM-Ascend dispatch tokens to their routed experts, run the expert FFN and combine the outputs in one device path. Shared experts keep their existing SGLang path. The default fused-op provider iscann.The dispatcher reuses the existing TP device communicator after checking that TP and EP have the same ranks in the same order. All eight ranks enter MegaMoE, including a rank with zero local rows. The group shares one symmetric workspace across layers, sized from the resolved Prefill budget. This version supports single-node TP8, attention DP8, EP8, static placement and synchronous eager Prefill with speculative decoding disabled.
The loader packs MXFP4 expert weights and E8M0 scales once. The worker keeps one layout and must restart for a weight replacement. Argument resolution rejects FP8 experts and FP4-to-FP8 dequantization.
Eight-card offline prototype
The prototype measured +21.8% new-input throughput at one point on the Prefill curve. The PR head still needs a fixed-seed eight-card comparison. The table reports the prototype on DeepSeek-V4.1-Flash, eight Ascend 950DT cards, CANN 9.3.0-beta.1 and torch-npu 2.13.0.
Each request had 131,072 input tokens, with 126,976 cached and 4,096 newly computed. Each arm timed 10 steps across eight ranks, for 327,680 new input tokens. Per-NPU throughput divides that count by the common elapsed time and by eight. Both arms used real routing, 384 routed experts and 32 static replicas with
trivialplacement. The prototype recorded 3,200 provider calls across 40 routed layers.The prototype used DeepGEMM-Ascend
fd5d22dplus a patch that rounds at the SwiGLU boundary in BF16 and applies routing weights after the down projection. The reproduction kit identifies that patch aslate-weight-dense.patch, SHA-25682b428684f3c5370f576f6fbfb83cbb6645a33923886088d79a61591954d53ea. Record the vendor build along with the SGLang revision when comparing results. DeepGEMM-Ascend base revisionAccuracy evidence
The AllGather and DeepGEMM prototype arms had identical token inputs but different engine seeds (
184205489and993405340, respectively). The repeat also shows baseline variation. These runs leave the contribution of the provider to the observed differences unresolved.A separate operator diagnostic matched AllToAllV's
scale_alg=1and found bitwise agreement on the first matched-input call at each of 40 layers across eight ranks. The provider in this PR passesscale_alg=None. The fixed-seed AllGather comparison in the benchmark PR #43 exercises that path.Reproduction
The benchmark PR #43 contains the CANN 9.3.0 setup, vendor patches, offline sweep and fixed-seed AllGather / DeepGEMM / AllGather commands.
Validation status