A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 13, 12:00 UTC
[BugFix] Fix Siglip2Attention on XPU (#28448)
Signed-off-by: Lin, Fanli <fanli.lin@intel.com>
Fanli Lin committed
Nov 12, 2025 at 02:18 UTC
d5edcb86781ea56f1eb0c9c5d7482a7cae00ec17
1 file changed
+9
-2
vllm/model_executor/models/siglip2navit.py
+9
-2
@@ -25,6 +25,7 @@ from vllm.model_executor.layers.linear import (
25
)
26
from vllm.model_executor.layers.quantization import QuantizationConfig
27
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
28
+from vllm.platforms import current_platform
29
30
from .vision import get_vit_attn_backend
31
@@ -188,7 +189,7 @@ def apply_rotary_pos_emb(
189
) -> tuple[torch.Tensor, torch.Tensor]:
190
cos = cos.chunk(2, dim=-1)[0].contiguous()
191
sin = sin.chunk(2, dim=-1)[0].contiguous()
191
- if is_flash_attn_backend:
192
+ if is_flash_attn_backend and not current_platform.is_xpu():
193
from flash_attn.layers.rotary import apply_rotary_emb
194
195
apply_rotary_emb_func = apply_rotary_emb
@@ -306,7 +307,13 @@ class Siglip2Attention(nn.Module):
307
max_seqlen = (cu_seqlens[1:] - cu_seqlens[:-1]).max().item()
308
if self.is_flash_attn_backend:
309
attn_output = self.flash_attn_varlen_func(
309
- queries, keys, values, cu_seqlens, cu_seqlens, max_seqlen, max_seqlen
310
+ queries,
311
+ keys,
312
+ values,
313
+ cu_seqlens_q=cu_seqlens,
314
+ cu_seqlens_k=cu_seqlens,
315
+ max_seqlen_q=max_seqlen,
316
+ max_seqlen_k=max_seqlen,
317
).reshape(seq_length, -1)
318
elif self.attn_backend == AttentionBackendEnum.TORCH_SDPA:
319
# Execute attention entry by entry for speed & less VRAM.