[Spec] Publish DFLASH verify read-done event for fine-grained WAR barrier (#29541)

This commit is contained in:
Liangsheng Yin
2026-06-28 18:51:38 -07:00
committed by GitHub
parent e1ca92a7fd
commit be17475a1b
@@ -995,14 +995,13 @@ 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():
# Publish a read-done event for the WAR barrier: a cuda-graph forward
# finishes its shared req_to_token / SWA reads at this pre-replay
# snapshot, so plain DECODE and DFLASH TARGET_VERIFY both qualify.
if forward_batch.forward_mode.is_decode() or (
forward_batch.forward_mode.is_target_verify()
and self.model_runner.spec_algorithm.is_dflash()
):
read_done = self.device_module.Event()
read_done.record()
self.model_runner.war_fastpath_read_done_event = read_done