fix: match P/D requests by transfer_id in FlagCX connector - #315
Open
leoda1 wants to merge 2 commits into
Open
Conversation
ceci3
approved these changes
Jul 27, 2026
physics31415926
approved these changes
Jul 31, 2026
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.
PR Category
Core
PR Type
Bug Fixes
Description
In disaggregated (P/D) serving, the Prefill and Decode engines assign different
request_ids to the same logical request. The FlagCX connector previously usedrequest_idas the key for its send/receive bookkeeping, so the Decode side'sreq_idcould never be found in the Prefill side'sreqs_need_sendmap, causing KV transfers to silently fail to match (Request %s not found in reqs_need_send).This PR introduces a stable, cross-engine
transfer_idthat both sides agree on, rekeys all connector bookkeeping by it, and hardens the transfer path with proper timeouts.Related Issues
Changes
flagcx_connector.py: added aTransferIdtype and threadedtransfer_idthroughRecvReqMeta,SendBlockMeta,SendReqMeta, and the connector metadata.reqs_to_send/req_blocksnow carry(transfer_id, block_ids); the worker looks up send metadata bytransfer_idwhile still reporting completion/timeout under the Prefillrequest_id(p_req_id) that vLLM expects.flagcx_connector.py: guarded against a missingtransfer_id— the scheduler logs a warning and skips the request instead of mis-matching.flagcx_connector.py: replaced unbounded / hardcoded 60s waits with bounded waits driven by_abort_request_timeout—send_meta.ready.wait()uses a deadline and raises a clearRuntimeErroron timeout, and the receive socketRCVTIMEOnow scales with_abort_request_timeout.examples/disaggregated_serving_xpyd/router.py: injecttransfer_id = f"fgx-{request_id}"intokv_transfer_paramsfor both the prefill and decode legs so both engines share the same transfer key.vllm_fl/distributed/device_communicators/flagcx.py: fixed ctypes usage forflagcxGetUniqueId()/flagcxCommInitRank()— pass the unique id object directly instead of.contents/ctypes.byref(...).vllm_fl/ops/fused_moe/fused_moe_utils.py: provide a default MoE backend priority (TRITON,BATCHED_TRITON) for out-of-tree platforms.Testing
Checklist