Skip to content

Commit b96b154

Browse files
authored
Avoid exception when detecting XPU on Torch <= 2.6 (#165)
torch.version has no xpu field in torch<=2.6 Signed-off-by: Wang, Yi A <[email protected]>
1 parent b24ef9f commit b96b154

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/kernels/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def build_variant() -> str:
5454
compute_framework = f"rocm{rocm_version.major}{rocm_version.minor}"
5555
elif torch.backends.mps.is_available():
5656
compute_framework = "metal"
57-
elif torch.version.xpu is not None:
57+
elif hasattr(torch.version, "xpu") and torch.version.xpu is not None:
5858
version = torch.version.xpu
5959
compute_framework = f"xpu{version[0:4]}{version[5:6]}"
6060
elif _get_privateuse_backend_name() == "npu":

0 commit comments

Comments
 (0)