Clean up rocm_paths list construction in detect_host()

Filter None from the ROCM_PATH env var lookup at list construction time
instead of relying on the inline `if p` guard in the any() call.
This commit is contained in:
Daniel Han 2026-03-31 09:09:02 +00:00
commit 56098e5d02

View file

@ -1439,8 +1439,8 @@ def detect_host() -> HostInfo:
shutil.which("amd-smi"),
shutil.which("rocm-smi"),
]
rocm_paths = ["/opt/rocm", os.environ.get("ROCM_PATH", "")]
if any(rocm_hints) or any(os.path.isdir(p) for p in rocm_paths if p):
rocm_paths = [p for p in ("/opt/rocm", os.environ.get("ROCM_PATH")) if p]
if any(rocm_hints) or any(os.path.isdir(p) for p in rocm_paths):
has_rocm = True
return HostInfo(