Skip to content

[KV Connector] Add per-layer canonical KV page mappings for parallelism-agnostic offload#48408

Open
Etelis wants to merge 4 commits into
vllm-project:mainfrom
Etelis:kv-offload-region-schema
Open

[KV Connector] Add per-layer canonical KV page mappings for parallelism-agnostic offload#48408
Etelis wants to merge 4 commits into
vllm-project:mainfrom
Etelis:kv-offload-region-schema

Conversation

@Etelis

@Etelis Etelis commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Records on CanonicalKVCacheRef, per layer, how the worker's KV page maps into a
canonical (parallelism-free) page: the full offloaded block, all KV heads, all
block_size * dcp * pcp tokens. A cache offloaded under one parallel config can
later be rearranged or consumed under another.

All parallelism reasoning lives in vllm/v1/kv_offload/sharding.py; the connector
and everything downstream consume byte mappings (MappedRun / CanonicalPageMapping)
only.

Certified layouts:

Case Mapping
TP head sharding (packed and split KV, NHD/HND) head fragments interleave across ranks
GQA replicated heads, MLA latent stored once (single-writer election)
DCP / PCP tokens interleave by total_cp_rank, chunked by cp_kv_cache_interleave_size
anything unverified rank-private page, parallel_invariant=False (fail closed)

Store runs are verified at startup to tile each canonical page exactly once across
the worker group. Mappings are inert metadata in this PR; the CPU layout consumer
lands in the follow-up.

Test plan

pytest tests/v1/kv_offload/test_kv_sharding.py (26 tests, no GPU): hand-computed
placement offsets for all four layouts, DCP/PCP tiling, writer election, cross-TP
and CP byte round-trips, fail-closed gates.

Signed-off-by: Itay Etelis <itay.etelis@ibm.com>
@Etelis
Etelis marked this pull request as ready for review July 14, 2026 09:33

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

All parallelism reasoning moves to vllm/v1/kv_offload/sharding.py, covering
TP/DCP/PCP, packed and split KV layouts, with single-writer election.

Signed-off-by: Itay Etelis <itay.etelis@ibm.com>
@Etelis Etelis changed the title [KV Connector] Add per-layer KV head region schema for TP-agnostic offload [KV Connector] Add per-layer canonical KV page mappings for parallelism-agnostic offload Jul 18, 2026
@Etelis
Etelis marked this pull request as ready for review July 18, 2026 19:42

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

Signed-off-by: Itay Etelis <itay.etelis@ibm.com>
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