Skip to content

[KV Offload] Warn when secondary-tier KV is tied to the parallel config - #62566

Merged
orozery merged 10 commits into
vllm-project:mainfrom
cipheraxat:kv-offload/warn-secondary-tier-canonical
Nov 11, 2026
Merged

orozery merged 10 commits into
vllm-project:mainfrom
cipheraxat:kv-offload/warn-secondary-tier-canonical

Conversation

@cipheraxat

@cipheraxat cipheraxat commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Log a startup warning when TieringOffloadingSpec's secondary-tier KV is tied to the engine's parallel configuration, so engines with a different TP size will never hit it. This is the first follow-up listed in #62283.

On current main this is a diagnostic only. #63373 removed Model Runner V1 and with it the path that read head-sharded KV written at another TP size (#62283). Topology-bound blocks now keep TP in their FileMapper namespace, and cross-TP lookups miss. #55191 adds a two-GPU regression test for that isolation. What's still missing is anything at startup that tells the user their shared tier is per-topology.

Related: #62283, #63373 (MRV1 removal), #55191 (cross-TP isolation regression test), #61822 (canonical_layout docs).

Claims

  • One warning per engine at startup when there's at least one secondary tier and the blocks are topology-bound, meaning both:
    • the layout isn't replicated MLA (replicated_layout is off), and
    • canonical_layout is off, or it's on but the layers can't all be certified as parallelism-agnostic (for example Mamba/GDN hybrids), or PP, DCP or PCP is > 1.
  • No warning for replicated MLA. FileMapper already lets it share direct-layout blocks across TP sizes.
  • No warning when canonical KV is portable, and none without secondary tiers.
  • No behavior change: it doesn't raise, and lookups and namespaces are unchanged.

Validation

  • pre-commit run --files vllm/v1/kv_offload/tiering/spec.py tests/v1/kv_offload/test_factory.py: all hooks pass.

  • pytest tests/v1/kv_offload/test_factory.py tests/v1/kv_connector/unit/offloading_connector/test_config.py tests/v1/kv_offload/tiering/test_tiering_offloading.py: 216 passed, 1 skipped (macOS, CPU).

  • test_tiering_spec_warns_when_secondary_tiers_are_topology_bound drives the real get_manager() with the example tier. It fakes only the /dev/shm region and the primary tier, as the create_worker tests in that file do. It has 6 cases and asserts that exactly one warning is logged, or none:

    Case canonical_layout is_parallelism_agnostic replicated_layout Warns
    direct layout flagged agnostic off True off yes
    direct layout off False off yes
    canonical, uncertified on False off yes
    canonical, portable on True off no
    replicated MLA (TP=2) off False on no
    no secondary tiers off False off no

    Mutation checks against it:

    • The previous revision's condition (no replicated_layout term): the replicated MLA case fails.
    • spec.py from main: 3 cases fail.
    • Gating only on is_parallelism_agnostic: the "direct layout flagged agnostic" case fails.
    • Gating only on canonical_layout: the "canonical, uncertified" case fails.
    • Logging the warning twice: 3 cases fail.

    CI runs it in the "V1 KV Offload" step (pytest -v -s v1/kv_offload).

  • End-to-end on one L4 (Colab, base 04631c4915, an earlier revision that logged one message per case; the trigger conditions for these rows are unchanged). I ran vllm serve <model> --max-model-len 2048 with OffloadingConnector, spec_name: TieringOffloadingSpec, cpu_bytes_to_use: 2 GiB and secondary_tiers: [{"type": "fs", "root_dir": "/tmp/kvfs"}]. For each case I waited for /health, sent one completion, and counted warning lines. I didn't run the replicated MLA case end-to-end, because it needs TP ≥ 2 on an MLA model. The unit test covers it.

Model canonical_layout Healthy, completion OK Topology warning
Qwen/Qwen3-0.6B off yes 1
Qwen/Qwen3-0.6B true (all_layers_portable=True) yes 0
Qwen/Qwen3.5-0.8B (GDN hybrid) true (all_layers_portable=False) yes 1

The current message:

Secondary-tier KV is only valid for engines with the same parallel configuration; sharing it across TP sizes needs canonical_layout=true in kv_connector_extra_config, parallelism-agnostic KV cache layers, and no PP, DCP or PCP.

Details

  • Why: a user who points several engines with different TP sizes at one fs/obj/p2p tier gets no cross-TP hits, and nothing at startup says why. With canonical_layout on, a model whose layers can't be certified (for example Mamba/GDN layers, which fall back to the opaque mapping) also keeps TP in its namespace, and only an all_layers_portable=False info line hints at it.
  • Where: TieringOffloadingSpec.get_manager(), next to the existing "Created TieringOffloadingManager" log. It runs once per engine on the scheduler side, whereas __init__ also runs in the workers.
  • Condition: secondary_tiers and not (replicated_layout or (canonical_layout and is_parallelism_agnostic)). It mirrors the namespace rule in FileMapper.from_spec, which drops TP when the layout is replicated or parallelism-agnostic. On current main, is_parallelism_agnostic is already False whenever canonical_layout is off. The explicit canonical_layout term costs nothing and keeps the warning right if that gate changes. With canonical_layout on, is_parallelism_agnostic is also False for DCP > 1 or world_size != tp_size (PP or PCP > 1), so the message names "no PP, DCP or PCP" alongside the layer requirement.
  • Known false positives: the example tier (in-process memory) and the kvcr tier don't share KV across engines through the FileMapper namespace, but still get the warning. The advice is harmless there, and excluding them would mean hardcoding tier names in the spec.
  • Level: warning, as the issue asks. Happy to switch to info if it's too noisy for single-topology deployments.
  • Docs: no changes here. [Docs][KV Offload] Document canonical_layout in the KV offloading usage guide #61822 documents canonical_layout in the KV offloading usage guide.
  • Not a duplicate: no open PR adds this check. [Test][KV Offload] Check cross-TP isolation for direct filesystem blocks #55191 only adds a distributed regression test and doesn't touch tiering/spec.py.

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.

Secondary-tier KV is only portable across TP sizes when canonical_layout
is on and every layer is certified parallelism-agnostic. Log a startup
warning from TieringOffloadingSpec.get_manager() when canonical_layout is
off, and when it is on but certification fails (e.g. hybrid models), so
users sharing a tier across TP sizes see that it is not portable.

Follow-up to vllm-project#62283.

Signed-off-by: cipheraxat <[email protected]>

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

cipheraxat and others added 4 commits October 20, 2026 03:59
Say secondary-tier KV is "only valid for" engines with the same parallel
configuration: until vllm-project#55191 lands, a cross-TP read on the V1 runner loads
wrong KV rather than missing. Name the parallel configuration in the
canonical warning too, since the static check also fails for DCP/PCP > 1
or world_size != tp_size. Add a unit test covering the warning
conditions.

Signed-off-by: cipheraxat <[email protected]>
Secondary-tier KV is shareable across TP sizes only when canonical_layout
is on and the layout is certified parallelism-agnostic, so a single check
covers both the direct-layout and the uncertified-canonical cases. Assert
that exactly one warning is logged.

Signed-off-by: cipheraxat <[email protected]>
With canonical_layout on, the static portability check also fails for
PP, DCP or PCP > 1, so say so instead of blaming only the KV cache layers.

Signed-off-by: cipheraxat <[email protected]>
@mergify

mergify Bot commented Oct 26, 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, @cipheraxat.

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

@mergify mergify Bot added the needs-rebase label Oct 26, 2026
…dary-tier-canonical

Signed-off-by: cipheraxat <[email protected]>

# Conflicts:
#	tests/v1/kv_offload/test_factory.py
@mergify mergify Bot removed the needs-rebase label Oct 26, 2026
@mergify mergify Bot added the nixl NIXL KV connector / multi-tiered KV offloading (KVCR) label Oct 29, 2026

@Etelis Etelis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please refresh the description for current main: #63373 removed the MRV1 corruption path, and #55191 now adds regression coverage. This remains useful as a startup diagnostic for topology-bound caches.

Comment on lines +466 to +469
if secondary_tiers and not (
self.config.canonical_layout
and self.config.parallel.is_parallelism_agnostic
):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we skip this warning when self.config.replicated_layout is true? FileMapper already allows fully replicated MLA to share direct-layout blocks across TP sizes, so saying that sharing requires canonical_layout=true is incorrect here. Please add that case to the existing test matrix.

FileMapper already lets fully replicated MLA share direct-layout blocks
across TP sizes, so the advice to set canonical_layout is wrong there.
Add the replicated case to the warning test matrix.

Signed-off-by: cipheraxat <[email protected]>
@cipheraxat

Copy link
Copy Markdown
Contributor Author

@Etelis thanks for the review. Both points are addressed in 817b461. Replicated MLA no longer warns, and that case is in the test matrix. The description is refreshed for current main (#63373, #55191). Could you take another look?

@Etelis Etelis added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 10, 2026
@Etelis

Etelis commented Nov 10, 2026

Copy link
Copy Markdown
Member

/ci-run

@github-actions

Copy link
Copy Markdown

✅ @cipheraxat, CI is now available for this PR.

  • /ci run starts upstream CI; /amd-ci run starts AMD CI only.
  • Run commands test your branch with every commit currently on its upstream target branch. If it is behind, the bot merges the target branch into it first (pull before pushing again). Append --allow-stale to a run command to test an outdated branch as is, at your own risk.
  • /ci retry retries failed jobs in the CI build for the current PR head. If the current head has no CI build, it starts a new CI build for the current head containing only jobs that failed in the latest earlier CI build for this PR.
  • /amd-ci retry retries failed jobs in AMD CI for the current PR head. Use /amd-ci run when the current head has no AMD CI build.
  • /ci cancel cancels scheduled or running CI builds for this PR branch; /amd-ci cancel does the same for AMD CI only.

@cipheraxat

Copy link
Copy Markdown
Contributor Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #101473 for commit a1c480fed520.

@Etelis Etelis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Runs on my end as expected so it LGTM.

@cipheraxat

Copy link
Copy Markdown
Contributor Author

/ci retry

@github-actions

Copy link
Copy Markdown

✅ Queued 1 failed job(s) for retry in Buildkite CI #101473.

@orozery
orozery merged commit ba0ef82 into vllm-project:main Nov 11, 2026
99 checks passed
javieratomic added a commit to javieratomic/vllm that referenced this pull request Nov 11, 2026
…e-mirror

main now asks each connector class how it reaches the device KV cache
(KVConnectorBase_V1.kv_cache_access, vllm-project#66605), instead of matching connector
names in KVTransferConfig. The mirror's decision moves there:
OffloadingConnector.kv_cache_access returns the new
KVCacheAccess.REGISTERS_ACROSS_NODES when its spec registers the KV cache in
an engine whose workers span nodes, and KVTransferConfig.kv_cache_access,
given the engine's parallel_config, turns that flag into REGISTERS or drops
it. MultiConnector combines its children through the factory, so the mirror
is also found inside nested MultiConnectors.

main's test of the topology warning (vllm-project#62566) replaces SharedOffloadRegion
with a MagicMock, whose created_file attribute is truthy, so the mirror's
check that the scheduler joined rank 0's region raised for its two-worker
case. The mock now reports a joined region.

Signed-off-by: Javier López <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>

# Conflicts:
#	vllm/config/kv_transfer.py
#	vllm/config/vllm.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nixl NIXL KV connector / multi-tiered KV offloading (KVCR) ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants