[core] Gate the overlap WAR barrier on forward reads to recover decode throughput (#28363)

Co-authored-by: thanhhao98 <31717833+thanhhao98@users.noreply.github.com>
This commit is contained in:
Liangsheng Yin
2026-06-22 00:40:56 -07:00
committed by GitHub
co-authored by thanhhao98
parent 441ae9a5ae
commit 106d2930a6
9 changed files with 64 additions and 9 deletions
@@ -542,6 +542,11 @@ class ModelRunner(ModelRunnerKVCacheMixin):
# Init forward stream for overlap schedule
self.forward_stream = torch.get_device_module(self.device).Stream()
# WAR fast-path: a decode-graph forward publishes a fresh event here after
# load_batch; the scheduler's WAR barrier waits on it (then clears it)
# instead of the whole-forward wait_stream. None -> whole-forward fallback.
self.war_fastpath_read_done_event: Optional[torch.cuda.Event] = None
# CPU offload
set_offloader(create_offloader_from_server_args(server_args, dp_rank=dp_rank))
@@ -979,6 +979,17 @@ class DecodeCudaGraphRunner(BaseCudaGraphRunner):
)
with timer_ctx, self.backend.replay_session():
self.load_batch(forward_batch, pp_proxy_tensors)
# Snapshot built -- publish a read-done event for the WAR barrier.
# Only plain DECODE: the captured decode graph reads only its static
# snapshot, so the forward is done reading the shared pool here. Spec
# verify (target_verify/dllm_extend) replays on this runner too, but
# those are NOT the step's last shared-buffer-reading phase (eagle
# publishes from draft_extend; ngram/dflash must not publish here),
# and some verify graphs may read beyond the snapshot in replay.
if forward_batch.forward_mode.is_decode():
read_done = self.device_module.Event()
read_done.record()
self.model_runner.war_fastpath_read_done_event = read_done
output = self.backend.replay(self._replay_graph_key, forward_batch)
if isinstance(output, LogitsProcessorOutput):