[KV offload] Scale uniform-type attention groups by DCP in build_offloading_config - #53889
Open
LucasWilkinson wants to merge 1 commit into
Open
LucasWilkinson wants to merge 1 commit into
LucasWilkinson wants to merge 1 commit into
Conversation
…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>
LucasWilkinson
marked this pull request as ready for review
August 26, 2026 12:26
LucasWilkinson
requested review from
ApostaC,
NickLucche,
ivanium,
orozery and
xuechendi
as code owners
August 26, 2026 12:26
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #85648 for commit |
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
build_offloading_configscales a KV-cache group'stokens_per_blockbydecode_context_parallel_sizeonly when the group spec is a bareAttentionSpec. Models whose attention layers are merged into oneUniformTypeKVCacheSpecsgroup (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 fromresolve_kv_cache_block_sizesisblock_size * dcp, so theOffloadingConnectorfailed at startup:(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(viaiter_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
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.Test Result
Unit tests pass; E2E deployment starts with offloading enabled under DCP8.
🤖 Generated with Claude Code, reviewed by submitter