Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix: checking for HIP #2485

Merged
merged 1 commit into from
Dec 14, 2024
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
2 changes: 1 addition & 1 deletion python/sglang/srt/layers/fused_moe_triton/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)
from sglang.srt.utils import set_weight_attrs

if torch.cuda.is_available() or torch.hip.is_available():
if torch.cuda.is_available():
Copy link
Contributor

Choose a reason for hiding this comment

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

How can hip run after this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

from sglang.srt.layers.fused_moe_triton.fused_moe import fused_experts
else:
fused_experts = None # type: ignore
Expand Down
8 changes: 1 addition & 7 deletions python/sglang/srt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def is_flashinfer_available():
"""
if not get_bool_env_var("SGLANG_IS_FLASHINFER_AVAILABLE", default="true"):
return False
return torch.cuda.is_available() and not is_hip()
return torch.cuda.is_available() and torch.version.cuda


def is_ipv6(address):
Expand Down Expand Up @@ -1071,9 +1071,6 @@ def get_device_name(device_id: int = 0) -> str:
if hasattr(torch, "cuda") and torch.cuda.is_available():
return torch.cuda.get_device_name(device_id)

if hasattr(torch, "hip") and torch.hip.is_available():
return torch.hip.get_device_name(device_id)

if hasattr(torch, "xpu") and torch.xpu.is_available():
return torch.xpu.get_device_name(device_id)

Expand All @@ -1086,9 +1083,6 @@ def get_device_capability(device_id: int = 0) -> Tuple[int, int]:
if hasattr(torch, "cuda") and torch.cuda.is_available():
major, minor = torch.cuda.get_device_capability(device_id)

if hasattr(torch, "hip") and torch.hip.is_available():
major, minor = torch.cuda.get_device_capability(device_id)

if hasattr(torch, "xpu") and torch.xpu.is_available():
major, minor, *_ = torch.xpu.get_device_capability(device_id)["version"].split(
"."
Expand Down
Loading