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(