Fix MUSA detection under torch.compile fullgraph (#41065)

Co-authored-by: Xiaoyu Zhang <1182563586@qq.com>
This commit is contained in:
Rumit Desai
2026-09-29 17:26:27 +08:00
committed by GitHub
co-authored by Xiaoyu Zhang
parent 0e586fd12d
commit f731e82f09
+3 -1
View File
@@ -222,11 +222,13 @@ def is_cpu() -> bool:
@lru_cache(maxsize=1)
def is_musa() -> bool:
if not hasattr(torch.version, "musa") or torch.version.musa is None:
return False
try:
import torchada # noqa: F401
except ImportError:
return False
return hasattr(torch.version, "musa") and torch.version.musa is not None
return True
@lru_cache(maxsize=1)