Skip to content

Commit 1e1c0e6

Browse files
committed
[ROCm-moriio] Propagate prefill DP rank to decode leg (serial WRITE)
In serial WRITE dispatch the prefill leg runs first and returns the DP rank it actually ran on (remote_dp_rank in kv_transfer_params). Pin the decode leg to that returned rank instead of independently re-hashing the request id, so both legs agree without each side hashing. This is the router-applies-the-connector-returned-rank model from the vLLM PR #45043 review: the connector returns the rank, the router sets the x-data-parallel-rank header on decode. Falls back to the blake2s hash only when the prefill response omits remote_dp_rank (older vLLM without the returnable rank).
1 parent 9e65dad commit 1e1c0e6

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

pkg/sidecar/proxy/connector_nixlv2.go

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,23 @@ retryLoop:
303303

304304
dreq.Header.Add(requestHeaderRequestID, uuidStr)
305305

306-
// Stamp the same DP-rank pin on the decode leg.
306+
// Decode's DP rank is PROPAGATED from the prefill leg's returned
307+
// kv_transfer_params (remote_dp_rank = the rank prefill actually ran on),
308+
// not independently re-derived here. This is the router-applies-the-
309+
// connector-returned-rank model (PR #45043 review, njhill): the prefill
310+
// connector returns the rank, the router pins the decode leg to it, so both
311+
// legs agree without each hashing the request id. Fall back to the hash only
312+
// if the prefill response omitted it (older vLLM without the returnable rank).
313+
decodeDPRank := pickDPRank(uuidStr, s.config.MoRIIODPSize)
314+
if pkv, ok := pKVTransferParams.(map[string]any); ok {
315+
if rv, present := pkv[requestFieldRemoteDPRank]; present {
316+
if ri, ok := toInt(rv); ok {
317+
decodeDPRank = ri
318+
}
319+
}
320+
}
307321
if s.config.MoRIIODPSize > 1 {
308-
dreq.Header.Set(
309-
requestHeaderDataParallelRank,
310-
strconv.Itoa(pickDPRank(uuidStr, s.config.MoRIIODPSize)),
311-
)
322+
dreq.Header.Set(requestHeaderDataParallelRank, strconv.Itoa(decodeDPRank))
312323
}
313324

314325
delete(completionRequest, requestFieldStream)

0 commit comments

Comments
 (0)