Repository navigation
[Revert] Revert "[BugFix][MoE] Share DSpark MegaMoE contexts across CANN buffer APIs" (#21727) - #22964
Conversation
…r APIs (vllm-project#21727)" This reverts commit 96ce11d.
There was a problem hiding this comment.
Code Review
This pull request simplifies the MegaMoE communication context management by completely removing the target/draft model sharing logic, including the mega_moe_context.py module and its associated unit tests. The HCCL runtime state refresh and teardown procedures in moe_comm_method.py have been streamlined to directly initialize and update the symmetric buffer without tracking draft models or handling complex buffer recreation. As there are no review comments provided, I have no additional feedback to offer.
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. 🤖 How to trigger CI
Note Until the CI gate has run on a commit, the required Tip 💡 Consider Linking a Related Issue or RFCYour PR title contains the [BugFix] tag, indicating a bug fix or new feature. Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:
🙏 Thanks for helping us keep the project well-organized! |
Coverage
More info see: Summary |
|
Last updated: 2026-11-24 00:28 UTC+8 for commit
|
|
/run |
|
/rerun |
|
/rebase |
|
/run |
|
/run |
…#23017) ### What this PR does / why we need it? DeepSeek V4.1 Flash with DSpark can have 384 routed experts and top-k 6 in the target, and 128 experts and top-k 3 in the draft. The different expert counts create distinct FUSED_MC2 communication objects. On Atlas A5, creating two CANN MegaMoE buffers on the same communicator and op tag can leave the second context with invalid peer addresses during startup profiling. This PR follows up on #21727 and its revert #22964. After the MRv2 DeepSeek V4.1 DSpark loader returns, it attempts sharing only when the draft executes MoE, the hardware supports the A5 CANN MXFP channel, MegaMoE is enabled and FUSED_MC2 is selected. A target and draft with different expert counts can share if they execute serially, use the same supported routed quantization and hidden width, have compatible communication parameters, and the draft fits the target buffer. The participating ranks must agree. On CANN r148 the target and draft can use different expert counts on the same communicator and op tag when they run serially, their communication attributes match, and the draft fits the target allocation. The target owns the allocation. The draft view retains that context and supplies its own expert count and top-k. After the layout checks, all ranks compare the draft's requirements with the actual target allocation using the installed CANN size query. If the target owns a buffer on this group and any rank rejects sharing, model loading fails before the draft can allocate a second buffer on the same tag. Across sleep/wake, the shared buffer preserves the captured context address. If the CANN factory raises on any rank, all ranks require a fresh MC2 group before retrying because CANN may already have registered the tag. Failures after a successful allocation can retry over that allocation. ### Does this PR introduce _any_ user-facing change? Eligible target/draft pairs on A5 reuse one MegaMoE buffer. Equal expert counts and layouts rejected by the initial eligibility checks follow their existing initialization paths. A final compatibility check that fails after the current group has been claimed reports a startup error. A3 skips the sharing check at the hardware gate. Relative to the PR base, the quantization modules, the unquantized MoE weight path, and the platform communication selector are unchanged. ### How was this patch tested? #### CPU regression tests The following runs cover earlier revisions of this PR. | Source and test coverage | Result | | --- | --- | | #23017 focused suite with the repository's vLLM pin (`c410543d9`) | 732 passed | | #23017 focused suite with the image's vLLM (`4ba787ec9`) | 725 passed, 7 skipped | | #23017 and #21830 together with the repository's vLLM pin | 1069 passed | | #23017 and #21830 together with the image's vLLM, rerun after the test-file rename in 112's `lhf_r148` | 1062 passed, 7 skipped | The core cases are in `tests/ut/ops/test_dspark_mega_moe_buffer.py`. They cover a compatible 384/128 pair, equal expert counts, A3 and A5 hardware profiles, W4A8 target with an unquantized draft, existing draft buffers, capacity checks, rank disagreement, and sleep/wake. The incompatible-quantization cases verify that the existing buffers and transport registry entries retain their identities. The wider suite covers MoE, quantization, model loading, graph configuration, and other model paths. A two-process CPU Gloo test exercised rank-local release failure and collective retry with a simulated allocator. On the review revision, three new regression cases failed against the previous implementation and passed with the fix. They cover a local capacity veto, a peer capacity veto, and a factory failure after tag registration. The 12-file suite passed all 596 tests against the repository's paired vLLM (`c410543d9`). A two-rank Gloo test injected factory errors on one rank and on both ranks, verified that no rank reallocated on the failed group, and recovered on a fresh group. CANN allocation failures were simulated in this test. #### A5 hardware validation The two earlier runs used DeepSeek V4.1 Flash W4A8MXFP with five-token DSpark, the CANN 9.3.0 r148 image (`9722b0304456`), and #23017 together with #21830. MegaMoE was explicitly enabled with `enable_fused_mc2=2`. - **1P1D on 107 and 108.** All eight Prefill ranks shared the target's MegaMoE context with the draft and submitted the CANN MegaMoE kernel for both models. Short, long, and decode requests returned HTTP 200, with the same text and token IDs as the `dispatch_ffn_combine` baseline. A separate fresh 2493-token prompt exercised Mooncake KV transfer and produced 32 output tokens. The MegaMoE run recorded 33 draft proposals and 80 accepted tokens. - **Colocated Prefill and Decode on 112 in `lhf_r148`.** DP8/TP1/EP8 started with `FULL_DECODE_ONLY`. All eight ranks confirmed that the 384-expert/top-6 target and 128-expert/top-3 draft had the same context, device address, and buffer owner. All 22 requests returned HTTP 200, including 11 long prompts of 2492 tokens. After the initial pair, four serial calls and two eight-way concurrent rounds exercised all eight DP ranks. The repeated rounds added 136 draft proposals and 218 accepted tokens. All responses contained the expected answer. In 15 of 20 repeated calls, generated token IDs matched the corresponding initial response. Five concurrent long responses differed in tokens after the correct answer. The health check still returned HTTP 200 after the last round. **Review revision on A5 with EPLB enabled.** The Prefill and Decode roles ran separately on the same eight A5 devices with the openEuler CANN 9.3.0 r148 image (`9bd8129dbc44`), the reviewed MegaMoE changes and #21830 on the image's vLLM-Ascend base. Both used DP8/TP1/EP8, W4A8MXFP, five-token DSpark, `enable_fused_mc2=3`, and EPLB with 16 redundant target experts. On all eight ranks in both roles, the 400-expert/top-6 target and 128-expert/top-3 draft shared the same context object, device address and buffer owner. - **Prefill, eager.** Six requests sent directly to the producer returned HTTP 200 and generated 1, 1, 1, 8, 16 and 32 tokens. Speculative decoding counters recorded 130 proposed tokens and 29 accepted tokens. - **Decode, `FULL_DECODE_ONLY`.** All eight API ranks became ready. Graph capture completed for all 41 target and 37 draft sizes. Native HCCL sleep/wake, formal accuracy evaluation, and throughput benchmarking remain open. ### Checklist #### Testing - [x] Boundary and edge cases for expert counts, quantization, topology and buffer capacity - [x] Regression cases for sharing and for preserving native behavior when sharing is skipped - [x] Failure-path coverage for rank disagreement and buffer recovery - [x] Tests assert buffer identity, registered method identity and captured addresses - [ ] A5 performance benchmarks - vLLM main: vllm-project/vllm@c410543 --------- Signed-off-by: rikakuhi <942697235@qq.com>
Revert of PR #21727 (merged onto
main).Original PR: #21727
Original author: @rikakuhi
Merge commit:
96ce11dc669b167d04402e94fc0fada32499a6b4What this PR does / why we need it?
DeepSeek V4.1 with DSpark and CANN MegaMoE creates separate target and draft buffers on the same MC2 group. On A5, the second native context can contain zero peer-buffer addresses, causing MegaMoE to fail during startup profiling.
Keep one target-owned allocation on the MC2 group coordinator and give the draft an independent metadata view over the same context and context manager. Validate communication settings and capacity before sharing. Identify MRv2 eager drafts by logical expert counts, including redundant experts.
Bind CANN capacity queries by parameter name to support both the legacy interface and the current interface with
intermediate_hidden,combine_comm_mode, and topology-dependentserver_num. This updates the approach in #20234 for current main and CANN 9.2.1 while preserving main's buffer-sizing policy. Target and draft calls remain serialized.During wake-up, the first stale model view rebinds the group-owned CANN context and runs a barrier. Target and draft both refresh their own runtime metadata from that context. The packaged MLA stream-lifetime change is tracked in #22592.
Does this PR introduce any user-facing change?
Fixes conflicting MegaMoE communication contexts for DeepSeek V4.1 DSpark on A5. No additional configuration is required. Includes a release note fragment.
How was this patch tested?
Focused CPU regression and lifecycle tests: 17 passed with Python 3.12, torch 2.10.0, and vLLM
24420b7a341af37a9bc3186e6fc6062512e0aa58:The deployment backport passed 26 CPU tests, including
test_moe_comm_method.py.A smoke check against the installed CANN 9.2.1 native capacity-query API passed for target 384 experts/top-k 6 and draft 128 experts/top-k 3 with P and D capacity settings. Each pair used one mocked allocation and shared context identity.
Ruff lint/format, codespell, typos, Python package initialization, forbidden-import, and boolean-context checks passed.
Review follow-up: 30 CPU unit tests passed on Linux AArch64 with Python 3.12.13, PyTorch
2.10.0+cpu, pytest 8.4.2 and vLLM24420b7a341af37a9bc3186e6fc6062512e0aa58. Ranpython3 -m pytest -q -raontest_mega_moe_context.py,test_moe_comm_method.pyandtest_fused_mc2_sleep_state.pywith the repository CPU mocks. The new sleep/wake-up case covers both target-first and draft-first recovery. A5 hardware coverage remains pending.Checklist
Boundary / edge-case coverage
Regression test
Error / failure path coverage
Meaningful & reliable tests
vLLM main: vllm-project/vllm@c410543