Skip to content

[Performance] Fuse Kimi MoE expert add into A3 AttnResFwd - #24535

Draft
ALIA333 wants to merge 2 commits into
vllm-project:mainfrom
ALIA333:codex/kimi-attnres-moe-add-a3
Draft

ALIA333 wants to merge 2 commits into
vllm-project:mainfrom
ALIA333:codex/kimi-attnres-moe-add-a3

Conversation

@ALIA333

@ALIA333 ALIA333 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it?

Kimi latent MoE normally launches a separate elementwise add for the shared and routed expert outputs. The next layer's AttnResFwd then reads that temporary result and folds it into its residual prefix.

For eligible sequence-parallel layers on Ascend A3, pass both expert outputs to the next AttnResFwd after their existing communication and routed output projection. The existing arch22 kernel can then form BF16(prefix + BF16(shared + routed)) before it reads or writes the residual bank. This removes the standalone MoE tail add from that path.

The expert handoff and intermediate BF16 rounding follow the approach in #24470. This change integrates them with the existing A3 kernel. The regular MoE output path still serves auxiliary captures, pipeline boundaries, the final layer, and superkernel mode.

Does this PR introduce any user-facing change?

Yes. The A3 optimization is selected automatically for compatible Kimi latent MoE layers. No configuration change is needed.

How was this patch tested?

Static checks passed with git diff --check and Python syntax parsing of the changed files. Added an A3 operator comparison against the existing explicit expert add, including a BF16 halfway value, residual bank writeback, and mixed and unmixed outputs. The regression test, NPU build, model accuracy, and profiling comparison are pending.


Checklist

Testing

  • Boundary / edge-case coverage

  • Regression test

  • Error / failure path coverage

  • Meaningful & reliable tests

  • Performance impact

  • vLLM main: vllm-project/vllm@65ada0c

Pass the two completed expert outputs to the next AttnResFwd for eligible sequence-parallel layers. Preserve the BF16 rounding of the original expert add before folding the result into the residual prefix.

Signed-off-by: liao (R) <l00940005@china.huawei.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

Signed-off-by: liao (R) <l00940005@china.huawei.com>
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

🤖 How to trigger CI

CI runs automatically when the PR is opened or reopened. Pushing a new commit no longer re-runs the E2E CI (to save NPU runner resources), so use the comment commands below when needed. They are available to the PR author and users with triage permission or above:

  • /run — run the full PR CI gate on the latest commit.
  • /rerun — re-run the failed CI jobs (e.g. after a flaky failure).
  • /e2e — run selected E2E tests instead of the full gate.
  • /nightly / /presmoke / /weekly — run the corresponding large-scale tests (triage permission or above; blocked during the nightly maintenance window).
  • /cancel — cancel a running CI on this PR.

Note

Until the CI gate has run on a commit, the required ci-gate check stays pending and the PR cannot merge — remember to comment /run after pushing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant