Skip to content

[KV offload] Scale uniform-type attention groups by DCP in build_offloading_config - #53889

Open
LucasWilkinson wants to merge 1 commit into
vllm-project:mainfrom
LucasWilkinson:fix/offload-dcp-uniform-group
Open

LucasWilkinson wants to merge 1 commit into
vllm-project:mainfrom
LucasWilkinson:fix/offload-dcp-uniform-group

Conversation

@LucasWilkinson

@LucasWilkinson LucasWilkinson commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Purpose

build_offloading_config scales a KV-cache group's tokens_per_block by decode_context_parallel_size only when the group spec is a bare AttentionSpec. Models whose attention layers are merged into one UniformTypeKVCacheSpecs group (GLM-5.2 / DeepSeek-V3.2: MLA layers plus the sparse-indexer K cache) are block-sharded across DCP ranks exactly like a plain attention group but skipped the multiplier. Under DCP the hash block size from resolve_kv_cache_block_sizes is block_size * dcp, so the OffloadingConnector failed at startup:

AssertionError: tokens_per_block=64 not divisible by tokens_per_hash=512. Hybrid models (e.g. Mamba+Attention) need --enable-prefix-caching to align block sizes.

(GLM-5.2-FP8 prefill, --decode-context-parallel-size 8, MultiConnector = NixlConnector + OffloadingConnector/TieringOffloadingSpec.)

Fix: treat a group as DCP-sharded when every layer spec it covers is an AttentionSpec (via iter_layer_specs). Mamba groups keep their full per-rank block as before, and the result matches how the scheduler block size is resolved.

Test Plan

  • New unit test test_dcp_scales_uniform_type_attention_group_blocks (uniform group of two MLA specs, DCP=2 → tokens_per_block == tokens_per_hash == 32).
  • pytest tests/v1/kv_connector/unit/offloading_connector/test_config.py -k "dcp or prefill_context" → 4 passed.
  • E2E: GLM-5.2-FP8 PCP8×DCP8 prefill with NIXL + CPU offloading now starts (previously asserted at connector init).

Test Result

Unit tests pass; E2E deployment starts with offloading enabled under DCP8.

🤖 Generated with Claude Code, reviewed by submitter

…oading_config

`build_offloading_config` scales a group's `tokens_per_block` by
`decode_context_parallel_size` only when the group spec is a bare
`AttentionSpec`. Models whose attention layers are merged into a single
`UniformTypeKVCacheSpecs` group (GLM-5.2 / DeepSeek-V3.2: MLA layers plus
the sparse-indexer K cache) are block-sharded across DCP ranks exactly like
a plain attention group, but skipped the multiplier. Under DCP the hash
block size from `resolve_kv_cache_block_sizes` is `block_size * dcp`, so the
OffloadingConnector failed at startup with

    AssertionError: tokens_per_block=64 not divisible by tokens_per_hash=512.

Treat a group as DCP-sharded when every layer spec it covers is an
`AttentionSpec` (via `iter_layer_specs`), which keeps the Mamba behaviour
unchanged and matches how the scheduler block size is resolved.

Signed-off-by: Lucas Wilkinson <lwilkinson@neuralmagic.com>
@mergify mergify Bot added the kv-connector label Aug 26, 2026
@LucasWilkinson
LucasWilkinson marked this pull request as ready for review August 26, 2026 12:26

@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.

@LucasWilkinson

Copy link
Copy Markdown
Collaborator Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #85648 for commit 05753fcc646c.

@mergify

mergify Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @LucasWilkinson.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

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