You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: match P/D requests by transfer_id in FlagCX connector (#315)
### PR Category
Core
### PR Type
Bug Fixes
### Description
1. In disaggregated (P/D) serving, the Prefill and Decode engines assign
**different** `request_id`s to the same logical request. The FlagCX
connector previously used `request_id` as the key for its send/receive
bookkeeping, so the Decode side's `req_id` could never be found in the
Prefill side's `reqs_need_send` map, causing KV transfers to silently
fail to match (`Request %s not found in reqs_need_send`).
2. This PR introduces a stable, cross-engine `transfer_id` that both
sides agree on, rekeys all connector bookkeeping by it, and hardens the
transfer path with proper timeouts.
3. This PR will use the FlagCX v0.13.0 interface, while also being
compatible with FlagCX v0.9.0 within CICD.
### Related Issues
<!-- Link any related issues: Fixes #issue, Closes #issue, or Related to
#issue -->
### Changes
- **`flagcx_connector.py`**: added a `TransferId` type and threaded
`transfer_id` through `RecvReqMeta`, `SendBlockMeta`, `SendReqMeta`, and
the connector metadata. `reqs_to_send` / `req_blocks` now carry
`(transfer_id, block_ids)`; the worker looks up send metadata by
`transfer_id` while still reporting completion/timeout under the Prefill
`request_id` (`p_req_id`) that vLLM expects.
- **`flagcx_connector.py`**: guarded against a missing `transfer_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 clear
`RuntimeError` on timeout, and the receive socket `RCVTIMEO` now scales
with `_abort_request_timeout`.
- **`examples/disaggregated_serving_xpyd/router.py`**: inject
`transfer_id = f"fgx-{request_id}"` into `kv_transfer_params` for both
the prefill and decode legs so both engines share the same transfer key.
- **`vllm_fl/distributed/device_communicators/flagcx.py`**: fixed ctypes
usage for `flagcxGetUniqueId()` / `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
<!-- How has this change been tested? Include test commands, hardware
used, etc. -->
-
### Checklist
- [x] I have run the existing tests and they pass
- [x] I have added tests for my changes (if applicable)
- [x] I have updated the documentation (if applicable)
---------
Co-authored-by: ceci3 <ceci3@users.noreply.github.com>
0 commit comments