A high-throughput and memory-efficient inference and serving engine for LLMs
[XPU] Fix Triton attn fp8/bf16 check failing (#45758)
Signed-off-by: zhenwei-intel <zhenwei.liu@intel.com>
liuzhenwei committed
Jun 16, 2026 at 12:31 UTC
b8bd773fe415473cb8f3c1b9694559729d8f29fd
2 files changed
+25
-22
vllm/v1/attention/backends/triton_attn.py
+23
-20
@@ -464,26 +464,29 @@ class TritonAttentionImpl(AttentionImpl):
464
else:
465
self.sliding_window = (sliding_window - 1, 0)
466
self.kv_cache_dtype = kv_cache_dtype
467
- cap = current_platform.get_device_capability()
468
- cap_str = cap.as_version_str() if cap is not None else "unknown"
469
- dev = current_platform.get_device_name()
470
- if self.kv_cache_dtype.startswith("fp8") and not (
471
- current_platform.has_device_capability(89)
472
- ):
473
- suggested = "float16" if (cap is None or cap.to_int() < 80) else "bfloat16"
474
- raise ValueError(
475
- f"FP8 KV cache is not supported by the Triton attention backend "
476
- f"on {dev} (compute capability {cap_str}); native FP8 (fp8e4nv) "
477
- f"requires SM89+. Re-run with --kv-cache-dtype {suggested}."
478
- )
479
- if self.kv_cache_dtype == "bfloat16" and not (
480
- current_platform.has_device_capability(80)
481
- ):
482
- raise ValueError(
483
- f"bfloat16 KV cache is not supported on {dev} (compute capability "
484
- f"{cap_str}); bfloat16 requires SM80+. Re-run with "
485
- f"--kv-cache-dtype float16."
486
- )
467
+ if current_platform.is_cuda():
468
+ cap = current_platform.get_device_capability()
469
+ cap_str = cap.as_version_str() if cap is not None else "unknown"
470
+ dev = current_platform.get_device_name()
471
+ if self.kv_cache_dtype.startswith("fp8") and not (
472
+ current_platform.has_device_capability(89)
473
+ ):
474
+ suggested = (
475
+ "float16" if (cap is None or cap.to_int() < 80) else "bfloat16"
476
+ )
477
+ raise ValueError(
478
+ f"FP8 KV cache is not supported by the Triton attention backend "
479
+ f"on {dev} (compute capability {cap_str}); native FP8 (fp8e4nv) "
480
+ f"requires SM89+. Re-run with --kv-cache-dtype {suggested}."
481
+ )
482
+ if self.kv_cache_dtype == "bfloat16" and not (
483
+ current_platform.has_device_capability(80)
484
+ ):
485
+ raise ValueError(
486
+ f"bfloat16 KV cache is not supported on {dev} (compute capability "
487
+ f"{cap_str}); bfloat16 requires SM80+. Re-run with "
488
+ f"--kv-cache-dtype float16."
489
+ )
490
if logits_soft_cap is None:
491
# In flash-attn, setting logits_soft_cap as 0 means no soft cap.
492
logits_soft_cap = 0
vllm/v1/attention/ops/triton_reshape_and_cache_flash.py
+2
-2
@@ -23,9 +23,9 @@ def _is_supported_kv_cache_dtype(kv_cache_dtype: str) -> bool:
23
):
24
return False
25
if kv_cache_dtype.startswith("fp8"):
26
- return current_platform.has_device_capability(89)
26
+ return current_platform.has_device_capability(89) or current_platform.is_xpu()
27
if kv_cache_dtype == "bfloat16":
28
- return current_platform.has_device_capability(80)
28
+ return current_platform.has_device_capability(80) or current_platform.is_xpu()
29
return True
30
31