-
Notifications
You must be signed in to change notification settings - Fork 292
fix(sidecar): rename P2P kv_transfer_params sub-dict keys to match vLLM #2140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9a6ee75
fix(sidecar): rename P2P kv_transfer_params sub-dict keys to match vLLM
nilig 8b389d4
docs: wrap the renamed disaggregation paragraphs at 80 columns
nilig 9cac78f
fix(sidecar): sweep stale p2p key references from comments and specs
nilig 43aea48
refactor(sidecar): name request-field constants after their wire keys
nilig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ func (s *Server) handleP2P(w http.ResponseWriter, r *http.Request, prefillPodHos | |
| prefillData[k] = v | ||
| } | ||
| prefillKVParams := map[string]any{ | ||
| requestFieldP2PDecodeParams: map[string]any{ | ||
| requestFieldRemoteDecoder: map[string]any{ | ||
| requestFieldKVRequestID: kvRequestID, | ||
| }, | ||
| } | ||
|
|
@@ -95,7 +95,7 @@ func (s *Server) handleP2P(w http.ResponseWriter, r *http.Request, prefillPodHos | |
| decodeData[k] = v | ||
| } | ||
| decodeData[requestFieldKVTransferParams] = map[string]any{ | ||
| requestFieldP2PPrefillParams: map[string]any{ | ||
| requestFieldRemotePrefiller: map[string]any{ | ||
| requestFieldKVRequestID: kvRequestID, | ||
| requestFieldRemoteHost: extractHost(prefillPodHostPort), | ||
| requestFieldRemotePort: s.config.P2PConnectorPort, | ||
|
|
@@ -213,27 +213,28 @@ func (s *Server) handleP2PConcurrentRequests(w http.ResponseWriter, r *http.Requ | |
| // KVConnector is offloading, or is composed alongside NIXL via MultiConnector | ||
| // (declared with --enable-p2p-pull) when the PD connector is NIXLv2. On any | ||
| // other connector --enable-p2p-pull has no effect, since no MultiConnector | ||
| // routes the p2p params to an OffloadingConnector. | ||
| // routes the remote_kv_source params to an OffloadingConnector. | ||
| func (s *Server) p2pPullAvailable() bool { | ||
| return s.config.KVConnector == KVConnectorOffloading || | ||
| (s.config.EnableP2PPull && s.config.KVConnector == KVConnectorNIXLV2) | ||
| } | ||
|
|
||
| // addP2PPullToPrefill adds the OffloadingConnector p2p pull block to a prefill | ||
| // addP2PPullToPrefill adds the OffloadingConnector P2P pull block to a prefill | ||
| // leg's kv_transfer_params so the prefiller pulls cached prefix from | ||
| // kvCacheSource while keeping its own computed blocks available for the | ||
| // decoder. It is a no-op when no source is set or the source resolves to the | ||
| // prefiller itself, since there is nothing to pull from oneself. The p2p key | ||
| // composes with NIXL params: vLLM's MultiConnector routes it to the | ||
| // OffloadingConnector and the NIXL fields to the NixlConnector. | ||
| // prefiller itself, since there is nothing to pull from oneself. The | ||
| // remote_kv_source key composes with NIXL params: vLLM's MultiConnector | ||
| // routes it to the OffloadingConnector and the NIXL fields to the | ||
| // NixlConnector. | ||
| func (s *Server) addP2PPullToPrefill(prefillKVParams map[string]any, kvCacheSource, prefillPodHostPort string) { | ||
| if kvCacheSource != "" && extractHost(kvCacheSource) != extractHost(prefillPodHostPort) { | ||
| prefillKVParams[requestFieldP2PParams] = s.p2pSourceParams(kvCacheSource) | ||
| prefillKVParams[requestFieldRemoteKVSource] = s.p2pSourceParams(kvCacheSource) | ||
| } | ||
| } | ||
|
|
||
| // p2pSourceParams builds the kv_transfer_params.p2p block for a pull from | ||
| // sourceHostPort's OffloadingConnector P2P tier. The kv_request_id is its | ||
| // p2pSourceParams builds the kv_transfer_params.remote_kv_source block for a | ||
| // pull from sourceHostPort's OffloadingConnector P2P tier. The kv_request_id is its | ||
| // own fresh UUID: in P2P mode it is consumer-side only. | ||
|
Comment on lines
+236
to
238
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| func (s *Server) p2pSourceParams(sourceHostPort string) map[string]any { | ||
| return map[string]any{ | ||
|
|
@@ -244,7 +245,7 @@ func (s *Server) p2pSourceParams(sourceHostPort string) map[string]any { | |
| } | ||
|
|
||
| // decodeWithP2PSource serves a decoder-only request through the local vLLM | ||
| // with kv_transfer_params.p2p injected, so the engine looks up and pulls | ||
| // with kv_transfer_params.remote_kv_source injected, so the engine looks up and pulls | ||
| // cached prefix blocks from the peer at sourceHostPort instead of recomputing | ||
| // them. It replaces any client-supplied kv_transfer_params (the sidecar owns | ||
| // that field) and routes through dispatchDecode so chunked decode still | ||
|
|
@@ -266,7 +267,7 @@ func (s *Server) decodeWithP2PSource(w http.ResponseWriter, r *http.Request, sou | |
| p2pParams := s.p2pSourceParams(sourceHostPort) | ||
| // Rebuild kv_transfer_params from scratch: the sidecar owns this field, so | ||
| // client-supplied keys are dropped rather than forwarded to vLLM. | ||
| requestData[requestFieldKVTransferParams] = map[string]any{requestFieldP2PParams: p2pParams} | ||
| requestData[requestFieldKVTransferParams] = map[string]any{requestFieldRemoteKVSource: p2pParams} | ||
|
|
||
| s.logger.Info("running P2P source protocol", | ||
| "source_host", extractHost(sourceHostPort), | ||
|
|
||
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some inconsistency in the names and comments
P2Pvsremote_kv_source, as in the comment https://github.com/llm-d/llm-d-router/pull/2140/changes#r3639185910There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed the constants after their wire keys in 43aea48:
requestFieldRemoteDecoder,requestFieldRemotePrefiller,requestFieldRemoteKVSource, matching the sibling request-field constants, and swept the test comments that still saiddecode/prefill/p2p.P2Pnow only names the mechanism: the OffloadingConnector tier (type"p2p", unchanged in vLLM) and its protocol functions.