Skip to content

[Core][Bugfix] Drop bounded_replay when promoting SlidingWindowMLASpec - #63411

Open
basemam wants to merge 1 commit into
vllm-project:mainfrom
basemam:pr/swa-mla-bounded-replay
Open

basemam wants to merge 1 commit into
vllm-project:mainfrom
basemam:pr/swa-mla-bounded-replay

Conversation

@basemam

@basemam basemam commented Oct 23, 2026 •

Copy link
Copy Markdown

Overview

With --disable-hybrid-kv-cache-manager, KV cache planning crashes on any model with SlidingWindowMLASpec layers (DeepSeek-V4), because promotion to MLAAttentionSpec forwards the SWA-only bounded_replay field. Introduced by the interaction of #56227 (adds bounded_replay) and #61183 (moves the promotion into kv_cache_planning.py).

Claims

  • Fixes TypeError: MLAAttentionSpec.__init__() got an unexpected keyword argument 'bounded_replay' at startup for sliding-window MLA models with the hybrid KV cache manager disabled.
  • Adds a regression test for unify_hybrid_kv_cache_specs with a SlidingWindowMLASpec layer, which no existing test covered.

Validation

Unit test, run on MI300X (gfx942) in a ROCm 7.2 image built from this branch's tree; the fix was reverse-applied to the installed package for the "without" column:

-k swa_mla full tests/v1/core/test_kv_cache_planning.py
without fix 1 failed (the TypeError above) 62 passed, 1 failed (the new test)
with fix 1 passed 63 passed
pytest tests/v1/core/test_kv_cache_planning.py -k swa_mla

End to end, DeepSeek-V4-Flash and DeepSeek-V4-Pro, disaggregated prefill/decode (MoRIIO connector, 2P/2D and 4P/4D, -tp 1 + DP + EP), MI300X, --disable-hybrid-kv-cache-manager:

  • without the fix, every worker dies in _promote_local_kv_cache_specs during get_kv_cache_configs;
  • with the fix, all prefill and decode workers start, size their KV cache, and serve requests (concurrency sweeps 1–32 at 1024/1024 complete on both models).
vllm serve deepseek-ai/DeepSeek-V4-Flash --disable-hybrid-kv-cache-manager ...

Details

When the hybrid KV cache manager is off and full-attention layers are present, _promote_local_kv_cache_specs rebuilds each sliding-window spec as its full-attention counterpart through replace_as, which forwards every field of the source spec. SlidingWindowMLASpec has two fields MLAAttentionSpec lacks: extra_retained_tokens, which was already dropped, and bounded_replay, which was not. The field is always present, so the crash happens even at its default False.

Dropping it is semantically right for the same reason as extra_retained_tokens: a promoted spec allocates blocks for every token and never frees below the window, so window-bounded prefix replay has nothing to bound. The promoted spec reports the ordinary full-attention prefix_cacheable, which is correct because it retains the full prefix.


Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (Mandatory for agents, optional for humans).

  • AI assistance was used during the creation of this PR.

  • Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.

  • Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.

  • Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.

  • Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.

With the hybrid KV cache manager disabled, _promote_local_kv_cache_specs
rebuilds each SlidingWindowMLASpec as an MLAAttentionSpec via replace_as,
which forwards every field of the source spec. bounded_replay (added in
vllm-project#56227) exists only on SlidingWindowMLASpec, so the rebuild raises

  TypeError: MLAAttentionSpec.__init__() got an unexpected keyword
  argument 'bounded_replay'

and any sliding-window MLA model (DeepSeek-V4) fails at KV cache planning
under --disable-hybrid-kv-cache-manager. A promoted spec keeps every
block, so the window-bounded replay is moot, as extra_retained_tokens
already is.

Signed-off-by: Basem Barakat <basem.barakay@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added bug Something isn't working kv-cache-manager labels Oct 23, 2026
@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment /ci run for upstream CI or /amd-ci run for AMD CI only whenever CI signals are needed.

Once the PR is approved or has the ready label, the PR author can also use the corresponding /ci run, /ci retry, and /ci cancel commands, or their /amd-ci variants. New commits do not start upstream CI automatically.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

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

Labels

bug Something isn't working kv-cache-manager

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant