From b4092176b9bc76839f76b0e91972a52e8b14ea2b Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Wed, 17 Jun 2026 20:54:39 -0400 Subject: [PATCH] [Bugfix] Complete one-shot fused all-reduce PDL at end to avoid NaN (#45448) --- .../passes/fusion/allreduce_rms_fusion.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vllm/compilation/passes/fusion/allreduce_rms_fusion.py b/vllm/compilation/passes/fusion/allreduce_rms_fusion.py index 9f6d4e5a75..d147002921 100644 --- a/vllm/compilation/passes/fusion/allreduce_rms_fusion.py +++ b/vllm/compilation/passes/fusion/allreduce_rms_fusion.py @@ -238,7 +238,17 @@ if flashinfer_comm is not None: use_oneshot=use_oneshot, fp32_acc=fp32_acc, weight_bias=weight_bias, - trigger_completion_at_end=num_tokens > PDL_ADVANCE_LAUNCH_TOKENS, + # The one-shot Lamport all-reduce signals PDL completion before its + # output buffer is committed when trigger_completion_at_end is + # False, so the next PDL-launched kernel can read the uninitialized + # Lamport buffer and produce NaN. This only fires for + # num_tokens <= PDL_ADVANCE_LAUNCH_TOKENS (the batch=1 / spec-decode + # shapes, where the one-shot path is always selected). Complete at + # the end for the one-shot path; the two-shot path is synchronized + # and keeps the early completion. Related one-shot instability in + # the same kernel: flashinfer-ai/flashinfer#1223. + trigger_completion_at_end=use_oneshot + or num_tokens > PDL_ADVANCE_LAUNCH_TOKENS, ) def call_trtllm_fused_allreduce_norm_fake(