Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions vllm/v1/attention/backends/triton_attn.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,26 +464,29 @@ def __init__(
else:
self.sliding_window = (sliding_window - 1, 0)
self.kv_cache_dtype = kv_cache_dtype
cap = current_platform.get_device_capability()
cap_str = cap.as_version_str() if cap is not None else "unknown"
dev = current_platform.get_device_name()
if self.kv_cache_dtype.startswith("fp8") and not (
current_platform.has_device_capability(89)
):
suggested = "float16" if (cap is None or cap.to_int() < 80) else "bfloat16"
raise ValueError(
f"FP8 KV cache is not supported by the Triton attention backend "
f"on {dev} (compute capability {cap_str}); native FP8 (fp8e4nv) "
f"requires SM89+. Re-run with --kv-cache-dtype {suggested}."
)
if self.kv_cache_dtype == "bfloat16" and not (
current_platform.has_device_capability(80)
):
raise ValueError(
f"bfloat16 KV cache is not supported on {dev} (compute capability "
f"{cap_str}); bfloat16 requires SM80+. Re-run with "
f"--kv-cache-dtype float16."
)
if current_platform.is_cuda():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not certain whether ROCm will be affected here, though I remember that ROCm doesn't follow cuda's device capability.
cc @AndreasKaratzas

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jikunshang Thank you for covering this and sry for the delayed response. You are correct, platform.is_cuda is only for NVIDIA GPUs

cap = current_platform.get_device_capability()
cap_str = cap.as_version_str() if cap is not None else "unknown"
dev = current_platform.get_device_name()
if self.kv_cache_dtype.startswith("fp8") and not (
current_platform.has_device_capability(89)
):
suggested = (
"float16" if (cap is None or cap.to_int() < 80) else "bfloat16"
)
raise ValueError(
f"FP8 KV cache is not supported by the Triton attention backend "
f"on {dev} (compute capability {cap_str}); native FP8 (fp8e4nv) "
f"requires SM89+. Re-run with --kv-cache-dtype {suggested}."
)
if self.kv_cache_dtype == "bfloat16" and not (
current_platform.has_device_capability(80)
):
raise ValueError(
f"bfloat16 KV cache is not supported on {dev} (compute capability "
f"{cap_str}); bfloat16 requires SM80+. Re-run with "
f"--kv-cache-dtype float16."
)
if logits_soft_cap is None:
# In flash-attn, setting logits_soft_cap as 0 means no soft cap.
logits_soft_cap = 0
Expand Down
4 changes: 2 additions & 2 deletions vllm/v1/attention/ops/triton_reshape_and_cache_flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def _is_supported_kv_cache_dtype(kv_cache_dtype: str) -> bool:
):
return False
if kv_cache_dtype.startswith("fp8"):
return current_platform.has_device_capability(89)
return current_platform.has_device_capability(89) or current_platform.is_xpu()
if kv_cache_dtype == "bfloat16":
return current_platform.has_device_capability(80)
return current_platform.has_device_capability(80) or current_platform.is_xpu()
return True


Expand Down
Loading