Skip to content

[BugFix][GDN] Skip recurrent state updates for idle DP dummy runs - #15510

Open
qijiajin wants to merge 4 commits into
vllm-project:mainfrom
qijiajin:codex/resubmit-15253-main
Open

[BugFix][GDN] Skip recurrent state updates for idle DP dummy runs#15510
qijiajin wants to merge 4 commits into
vllm-project:mainfrom
qijiajin:codex/resubmit-15253-main

Conversation

@qijiajin

@qijiajin qijiajin commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Rebased resubmission of #15253 onto current main (f69831343). The original review fixes are included in this branch.

What this PR does / why we need it

Data-parallel ranks with no scheduled requests still execute a one-token dummy batch to participate in graph replay and collectives. For GDN/Mamba layers, treating that synchronization-only token as a real decode token can advance causal-conv and KDA recurrent state through block-table entries left by an earlier request.

This PR keeps the model/collective dummy shape unchanged, but builds zero-length GDN metadata for idle DP dummies. Both captured recurrent branches become no-ops while other layers and distributed communication continue to execute normally.

The change restores the behavior previously validated on the v0.26 Kimi K3 path. It adds no device-wide synchronization and does not change GDN kernels.

Does this PR introduce any user-facing change?

No API change. Multi-node GDN/Mamba inference no longer depends on whether another DP rank was idle between requests.

How was this patch tested?

  • python -m compileall for the changed runtime files

  • git diff --check

  • Existing unit expectations updated for both idle-dummy entry points; the existing GDN builder regression covers zero-length recurrent metadata

  • Real-weight A/B on two A3 nodes, TP16 x DP2 / EP32, Kimi K3 GQA DSpark, async scheduling, prefix cache, FULL_DECODE_ONLY graph, 131072-input + 1024-output:

    • before: a cache-hit repeat diverged from token 0 and collapsed into a repeated 1.1.1... output while speculative acceptance remained 80.55%
    • after: no corrupted output in five cold/warm repeats; the last four cold/warm pairs were token-for-token identical, with per-token acceptance between 95.81% and 97.49%
  • Real-weight four-node smoke on TP16 x DP4 / EP64 with full QuaRot weights and the same 128K-to-1K case:

    • repetition 1: aggregate acceptance 85.40%, mean accepted length 6.98, per-DP acceptance 88.11% / 89.03% / 85.91% / 79.16%
    • repetition 2: aggregate acceptance 87.00%, mean accepted length 7.09, per-DP acceptance 87.40% / 84.08% / 87.09% / 89.56%
    • both repetitions reported a 94.63% prefix-cache hit rate and completed without the cross-DP rotating collapse seen before the fix
    • repetition 3 was not counted: the DP2 EngineCore exited concurrently with an external Docker exec ending with status 137. The host reported no OOM or device fault, but the initiating command was not captured, so this is recorded as an interrupted run rather than attributed to the patch. The shared nodes were reclaimed and no restart was performed.
  • vLLM main: vllm-project/vllm@ba07e4a

maoxx241 and others added 4 commits September 1, 2026 21:57
Keep GDN recurrent metadata at zero length when a data-parallel rank executes a synchronization-only dummy batch. This preserves graph and collective participation without advancing conv or KDA state through stale cache indices.

Signed-off-by: maoxx241 <maomaoyu870@gmail.com>
Gemini review flagged common_attn_metadata.replace(...) as an
AttributeError on older vLLM pins whose CommonAttentionMetadata
dataclass has no instance replace() method. Use the already-imported
dataclasses.replace() helper, which works on any dataclass and matches
current vLLM's replace() implementation.

Signed-off-by: maoxx241 <maomaoyu870@gmail.com>
Replace the dummy-run assert on num_reqs_padded with a fallback to
num_reqs so a missing pad count cannot crash the execute path.
Document that num_actual_tokens=0 is the GDN kernel no-op while
query_start_loc stays a zero-filled graph-sized prefix.

Signed-off-by: maoxx241 <maomaoyu870@gmail.com>
Use the uniform decode query length and descriptor for idle data-parallel dummy runs. This prevents an idle rank from downgrading FULL_DECODE_ONLY across the DP group while preserving the GDN state-update guard from PR vllm-project#15253.

Signed-off-by: q00852295 <qijiajin1@huawei.com>
(cherry picked from commit 83dd6f2)
@github-actions

github-actions Bot commented Sep 1, 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.


Tip

💡 Consider Linking a Related Issue or RFC

Your 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:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>
  • Refs #<rfc_or_issue_number> (for RFCs)

🙏 Thanks for helping us keep the project well-organized!

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug where idle Data Parallel (DP) ranks would trigger recurrent state updates during dummy runs, potentially causing synchronization issues or performance degradation in graph mode. By introducing a mechanism to skip these updates for idle ranks, the changes ensure that dummy runs maintain consistency across the DP group without unnecessary overhead.

Highlights

  • GDN State Update Logic: Introduced a 'skip_gdn_state_update' flag to prevent unnecessary recurrent state updates during idle Data Parallel (DP) dummy runs.
  • Dummy Run Optimization: Updated '_dummy_run' methods across model runners to accept the new skip flag, ensuring idle ranks do not inadvertently downgrade graph mode across the DP group.
  • Metadata Handling: Modified '_build_attn_group_metadata' to handle no-op GDN state updates, allowing for proper graph replay and collective synchronization without triggering full state updates.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a skip_gdn_state_update flag to _dummy_run and attention metadata building in the model runner. This allows idle Data Parallel (DP) ranks to perform dummy runs without updating the GDN recurrent state, preventing out-of-sync issues while maintaining correct coordinate batch behavior. The reviewer provided a suggested PR Title and PR Summary formatted according to the repository's style guide.

Comment on lines +1087 to +1091
self.model_runner._dummy_run(
num_tokens,
uniform_decode=True,
skip_gdn_state_update=True,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Suggested PR Title:

[Attention][BugFix] Skip recurrent state updates for idle DP dummy runs

Suggested PR Summary:

### What this PR does / why we need it?

This PR skips recurrent state updates (specifically GDN state updates) for idle Data Parallel (DP) dummy runs. During dummy runs on idle DP ranks, updating the GDN state can lead to out-of-sync issues or incorrect state propagation across the DP group. By introducing the `skip_gdn_state_update` flag, we ensure that idle ranks do not perform unnecessary state updates while still maintaining the correct coordinate batch behavior to avoid out-of-sync issues.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

- Unit tests in `tests/ut/worker/test_model_runner_v1.py` and `tests/ut/worker/test_worker_v1.py` were updated and verified.
- Validation with `git diff --check` and `python -m compileall` on the changed runtime files.
References
  1. Generate PR Title and PR Summary in the specified markdown format as required by the Repository Style Guide. (link)

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.

2 participants