[KVEvents] add dp rank to KV events - #2379
Open
sagearc wants to merge 1 commit into
Open
Conversation
Signed-off-by: Sage Ahrac <sagiahrak@gmail.com>
sagearc
requested review from
a team,
hyeongyun0916,
liu-cong,
vMaroon and
yankay
as code owners
August 13, 2026 16:35
Contributor
There was a problem hiding this comment.
Pull request overview
This PR preserves the data-parallel (DP) rank from incoming KV event batches by threading it through the engine adapters into kvevents.EventBatch, enabling downstream components to correctly attribute KV events when multiple ranks share a single HTTP endpoint.
Changes:
- Add optional
DataParallelRanktokvevents.EventBatch. - Propagate DP rank during msgpack batch decoding in both vLLM and SGLang engine adapters.
- Consolidate the shared msgpack batch struct into
engineadapter/common.goand extend adapter tests to assert DP rank parsing.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/kvevents/events.go | Adds DataParallelRank to the public EventBatch type. |
| pkg/kvevents/engineadapter/common.go | Introduces shared msgpackEventBatch with optional DP rank field. |
| pkg/kvevents/engineadapter/vllm_adapter.go | Decodes DP rank from batch and sets it on kvevents.EventBatch. |
| pkg/kvevents/engineadapter/vllm_adapter_test.go | Updates test payload and asserts DP rank is preserved. |
| pkg/kvevents/engineadapter/sglang_adapter.go | Decodes DP rank from batch and sets it on kvevents.EventBatch. |
| pkg/kvevents/engineadapter/sglang_adapter_test.go | Updates test payload and asserts DP rank is preserved. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
atm llm-d-router reads dp rank from emitted kv event batches but drops it during adapter conversion.
kv events are instead attributed to the source
ip:portattached to each subscriber. this is only sufficient for external load balancing where each dp rank exposes standalone frontend with a distinct port.with internal load balancing, multiple dp ranks can share one http endpoint, so the endpoint alone cannot identify which rank owns the cached blocks.
refs: