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 7, 22:45 UTC
[XPU] allow TORCH_SDPA/TRITON_ATTN as XPU vit Backend (#35010)
Signed-off-by: Yan Ma <yan.ma@intel.com>
Yan Ma committed
Feb 23, 2026 at 21:06 UTC
b1b5e045dfdcb4ca31931e05fafa8ea15823d740
2 files changed
+12
-4
vllm/model_executor/layers/attention/mm_encoder_attention.py
+11
-4
@@ -249,7 +249,14 @@ class MMEncoderAttention(CustomOp):
249
cu_seqlens: torch.Tensor | None = None,
250
max_seqlen: torch.Tensor | None = None, # Only used for Flash Attention
251
) -> torch.Tensor:
252
- assert self.is_flash_attn_backend, (
253
- "XPU only supports FLASH_ATTN for vision attention."
254
- )
255
- return self._forward_fa(query, key, value, cu_seqlens, max_seqlen)
252
+ if self.attn_backend == AttentionBackendEnum.FLASH_ATTN:
253
+ return self._forward_fa(query, key, value, cu_seqlens, max_seqlen)
254
+ elif self.attn_backend == AttentionBackendEnum.TRITON_ATTN:
255
+ return self._forward_triton(query, key, value, cu_seqlens, max_seqlen)
256
+ elif self.attn_backend == AttentionBackendEnum.TORCH_SDPA:
257
+ return self._forward_sdpa(query, key, value, cu_seqlens)
258
+ else:
259
+ raise ValueError(
260
+ f"Unsupported multi-modal encoder attention backend for XPU: "
261
+ f"{self.attn_backend}."
262
+ )
vllm/platforms/xpu.py
+1
@@ -89,6 +89,7 @@ class XPUPlatform(Platform):
89
def get_supported_vit_attn_backends(cls) -> list["AttentionBackendEnum"]:
90
return [
91
AttentionBackendEnum.FLASH_ATTN,
92
+ AttentionBackendEnum.TRITON_ATTN,
93
AttentionBackendEnum.TORCH_SDPA,
94
]
95