Skip to content

feat(vllm): enable deterministic DP and KV routing - #12735

Merged
connorcarpenter15 merged 7 commits into
fix/vllm-decode-cancellationfrom
feat/vllm-dp-kv-routing
Aug 12, 2026
Merged

feat(vllm): enable deterministic DP and KV routing#12735
connorcarpenter15 merged 7 commits into
fix/vllm-decode-cancellationfrom
feat/vllm-dp-kv-routing

Conversation

@connorcarpenter15

@connorcarpenter15 connorcarpenter15 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Overview

Part 3 of a 4-PR stack. This layer enables deterministic vLLM data-parallel rank selection and KV-event routing without extending the vLLM protocol.

Details

  • Forward Dynamo's selected data-parallel rank as per-request x-data-parallel-rank gRPC metadata; omit the metadata when no rank is selected so vLLM retains normal load balancing.
  • Require vLLM to honor the x-data-parallel-rank gRPC metadata for deterministic DP routing. No protocol capability field is used.
  • Support one vLLM frontend hosting the complete DP group starting at rank 0; reject nonzero starting ranks because Control does not report local rank count.
  • Require one unique, in-range ZMQ KV-event source per DP rank when KV routing is enabled, and warn before skipping unsupported transports.
  • Accept vLLM's valid empty KV-event topic, which means subscribe to all topics.
  • Consume the preprocessor's redundant nvext.token_in=true marker while preserving strict rejection of unsupported nvext semantics.
  • Preserve cache-salt propagation for consistent Dynamo/vLLM block hashes.
  • Keep the vLLM mocker aligned with the production transport by parsing and validating the same request metadata.

Multimodal request conversion remains in the top PR.

Stack

  1. #12734 — split gRPC services and Control discovery
  2. #12736 — preserve decode handoff on cancellation
  3. #12735 — deterministic DP and KV routing
  4. #12214 — multimodal sidecar requests

Base: #12736

Validation

  • cargo fmt --all -- --check
  • cargo test -p dynamo-vllm-sidecar — 18 unit tests and 1 executable integration test passed
  • cargo test -p dynamo-vllm-mocker — 12 unit tests and 3 sidecar integration tests passed
  • cargo clippy -p dynamo-vllm-sidecar --all-targets -- -D warnings
  • cargo clippy -p dynamo-vllm-mocker --all-targets -- -D warnings
  • cargo test -p dynamo-runtime utils::pool::tests::test_sync_pool_blocking_acquire -- --exact — passed; verifies the prior CI failure was transient
  • Changed-file pre-commit hooks

Where should the reviewer start?

  • lib/sidecar/vllm/src/client.rs for request-scoped gRPC metadata.
  • lib/sidecar/vllm/src/model.rs for the supported full-group DP registration contract.
  • lib/sidecar/vllm/src/engine.rs for rank selection and KV-event source validation.
  • lib/mocker/servers/vllm/src/server.rs for mock transport parity.

Related Issues

This PR is NOT linked to an issue:

  • Confirmed — no related issue

@datadog-official

This comment has been minimized.

@connorcarpenter15
connorcarpenter15 marked this pull request as ready for review August 6, 2026 15:32
@connorcarpenter15
connorcarpenter15 requested review from a team as code owners August 6, 2026 15:32

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 4 potential issues.

Open in Devin Review

Comment thread lib/sidecar/vllm/src/model.rs Outdated
Comment thread lib/sidecar/vllm/src/convert.rs Outdated
Comment thread lib/sidecar/vllm/src/engine.rs Outdated
Comment thread lib/sidecar/vllm/src/engine.rs
@connorcarpenter15
connorcarpenter15 force-pushed the feat/vllm-dp-kv-routing branch from 3463378 to 522511d Compare August 6, 2026 18:11
@connorcarpenter15
connorcarpenter15 force-pushed the feat/vllm-dp-kv-routing branch 3 times, most recently from 4e5e10b to 4e06d75 Compare August 6, 2026 20:09
@connorcarpenter15
connorcarpenter15 requested review from a team as code owners August 7, 2026 20:43
@connorcarpenter15
connorcarpenter15 force-pushed the feat/vllm-dp-kv-routing branch from 4e06d75 to dfbf023 Compare August 7, 2026 20:43
@connorcarpenter15
connorcarpenter15 force-pushed the feat/vllm-dp-kv-routing branch from dfbf023 to 30e68eb Compare August 7, 2026 20:54

@tanmayv25 tanmayv25 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated multi-agent code-review pass over this PR's diff (framing + expert lenses, each finding adversarially verified). Findings below are all minor / non-blocking.

Comment thread lib/sidecar/vllm/src/engine.rs Outdated
Comment thread lib/sidecar/vllm/src/engine.rs
@connorcarpenter15
connorcarpenter15 force-pushed the feat/vllm-dp-kv-routing branch from 30e68eb to 7b775cc Compare August 8, 2026 00:52
@copy-pr-bot

copy-pr-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
@connorcarpenter15

Copy link
Copy Markdown
Member Author

/ok to test 8a37d26

@karen-sy karen-sy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Findings

  • P1 lib/sidecar/vllm/src/engine.rs:133,371
    KV routing is enabled unconditionally, but an empty GetKvEventSources response is treated as a protocol error. At the vendored vLLM commit, Control intentionally returns no source when kv_events_config is absent, disabled, or uses a non-ZMQ publisher. That makes an otherwise valid non-KV-event vLLM sidecar fail worker startup. Return an empty source list in the genuinely no-source case so the worker’s existing KV-routing opt-out path applies; retain the strict all-ranks check when sources are advertised. Add a no-KV-events startup test.
    Upstream behavior: [vLLM Control source](https://github.com/vllm-project/vllm/blob/3d1f5cee1552b8208f3009c75f8bc856f27e0eff/rust/src/server/src/grpc/control.rs#L117-L121).

  • P2 lib/sidecar/vllm/src/engine.rs:181,333
    start() returns the freshly observed DP topology, but kv_event_sources() still validates against the bootstrap-time self.model. ensure_same_identity() does not compare parallelism. If the endpoint lands on a same-model frontend with a different DP size between bootstrap and startup, Dynamo registers the new range but source validation uses the old size. Reject topology changes during startup, or retain the observed topology in the engine.


Noting some flags above from AI review, but generally looks good!

Comment thread lib/sidecar/vllm/README.md Outdated
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
@connorcarpenter15

Copy link
Copy Markdown
Member Author

/ok to test d9d1ae4

@connorcarpenter15
connorcarpenter15 merged commit 45e465a into main Aug 12, 2026
120 checks passed
@connorcarpenter15
connorcarpenter15 deleted the feat/vllm-dp-kv-routing branch August 12, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feat size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants