From 8fc1b2d046f4a991b5c24bb5470bf45efcfe9d01 Mon Sep 17 00:00:00 2001 From: Matthew Bonanni Date: Mon, 29 Jun 2026 17:23:34 -0400 Subject: [PATCH] Fix FA4 dynamic_causal for full attention layers (#46659) Signed-off-by: Matthew Bonanni --- vllm/v1/attention/backends/flash_attn.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vllm/v1/attention/backends/flash_attn.py b/vllm/v1/attention/backends/flash_attn.py index df20979435..2eed819056 100755 --- a/vllm/v1/attention/backends/flash_attn.py +++ b/vllm/v1/attention/backends/flash_attn.py @@ -906,7 +906,10 @@ class FlashAttentionImpl(AttentionImpl): f"FA{self.vllm_flash_attn_version}" ) dynamic_causal = causal - causal = False + has_window = ( + sliding_window_size is not None and sliding_window_size[1] >= 0 + ) + causal = not has_window flash_attn_varlen_func( q=query[:num_actual_tokens],