[PD] Handle NIXL abort notifications (#30352)

This commit is contained in:
Yichao Cheng
2026-07-13 05:05:25 -07:00
committed by GitHub
parent eb31b5310c
commit a74bee2261
2 changed files with 222 additions and 0 deletions
@@ -631,6 +631,12 @@ class NixlKVManager(CommonKVManager):
def check_status(self, bootstrap_room: int):
return self.request_status.get(bootstrap_room, KVPoll.WaitingForInput)
def update_status(self, bootstrap_room: int, status: KVPoll):
# Keep Failed sticky until the sender clears the room.
if self.request_status.get(bootstrap_room) == KVPoll.Failed:
return
super().update_status(bootstrap_room, status)
def _prep_equal_tp_dlist(
self,
peer_name: str,
@@ -2316,6 +2322,40 @@ class NixlKVManager(CommonKVManager):
return False
return self.transfer_statuses[room].is_done()
def _handle_abort_notification(self, msg: List[bytes]) -> bool:
if not msg or msg[0] != b"ABORT":
return False
try:
room_to_be_aborted = int(msg[1].decode("ascii"))
except Exception as e:
logger.debug(f"Ignoring malformed abort notification: {e}")
return True
if (
room_to_be_aborted in self.request_status
and self.check_status(room_to_be_aborted) != KVPoll.Success
):
self.record_failure(
room_to_be_aborted,
"Aborted by decode-side abort notification.",
)
self.update_status(room_to_be_aborted, KVPoll.Failed)
logger.debug(
f"Received abort notification for room {room_to_be_aborted}, "
f"marked as Failed"
)
else:
logger.debug(
f"Received abort notification for room {room_to_be_aborted}, "
f"ignoring (already completed or unknown)"
)
# TODO: Define real ACK/deferred-release semantics if decode-side buffer
# release needs to wait for prefill-side NIXL transfer quiescence.
return True
def _start_bootstrap_thread(self):
def bootstrap_thread():
"""This thread recvs transfer info from the decode engine"""
@@ -2345,6 +2385,9 @@ class NixlKVManager(CommonKVManager):
handle_staging_rsp(waiting_req_bytes, self.transfer_infos)
continue
if self._handle_abort_notification(waiting_req_bytes):
continue
assert (
waiting_req_bytes[0] == GUARD
), f"First message should be {GUARD}. Foreign traffic?"