Fix overlap prebuilt row reuse race (#35748)

This commit is contained in:
jasonjk-park
2026-08-21 02:00:13 -07:00
committed by GitHub
parent 896acc8860
commit 0db2c53dec
3 changed files with 53 additions and 17 deletions
@@ -2632,6 +2632,10 @@ class SchedulerDisaggregationDecodeMixin:
# construct fake completed prefill
new_batch.prepare_for_prebuilt()
if self.enable_overlap:
# A finished request can still have one redundant forward in flight.
# Drain it before a prebuilt request seeds a potentially reused row.
self.schedule_stream.wait_stream(self.forward_stream)
new_batch.process_prebuilt(self.future_map)
return new_batch
+1 -7
View File
@@ -523,14 +523,8 @@ class FutureMap:
self.confidence_relay.scatter(indices, confidence)
# Only spec_v2 needs the event; it gates the seq_lens D2H on the private stream.
if self.spec_algo.is_some():
device_module = torch.get_device_module(self.device)
if self.publish_ready is None:
self.publish_ready = device_module.Event()
else:
# Chain the records: event fire implies every prior publish is
# visible, so an off-forward-stream publish (PD-decode prebuilt
# seeding) cannot drop the in-flight forward's fence.
device_module.current_stream().wait_event(self.publish_ready)
self.publish_ready = torch.get_device_module(self.device).Event()
self.publish_ready.record()
self._publish_fresh = True
if publish_confidence: