Add Windows-specific ROCm/HIP detection in detect_host()
The previous detect_host() ROCm check used rocminfo and amd-smi list which are Linux-only tools. On Windows, has_rocm would always be False, making the Windows HIP prebuilt path at line 1794 unreachable. Now detect_host() uses platform-specific detection: - Linux: rocminfo (check for gfx GPU names) or amd-smi list - Windows: hipinfo.exe, amd-smi, or amdhip64.dll on PATH This allows Windows AMD users to get the HIP prebuilt binary instead of silently falling through to the CPU prebuilt.
This commit is contained in:
parent
c22312b9a5
commit
726fab1f37
2 changed files with 18 additions and 1 deletions
|
|
@ -1433,7 +1433,7 @@ def detect_host() -> HostInfo:
|
|||
|
||||
# Detect AMD ROCm (HIP) -- require actual GPU, not just tools installed
|
||||
has_rocm = False
|
||||
if not is_macos:
|
||||
if is_linux:
|
||||
for _cmd, _marker in (
|
||||
(["rocminfo"], "gfx"),
|
||||
(["amd-smi", "list"], "gpu"),
|
||||
|
|
@ -1449,6 +1449,16 @@ def detect_host() -> HostInfo:
|
|||
if _marker in _result.stdout.lower():
|
||||
has_rocm = True
|
||||
break
|
||||
elif is_windows:
|
||||
# Windows: check for HIP runtime DLL or hipinfo tool
|
||||
if shutil.which("hipinfo") or shutil.which("amd-smi"):
|
||||
has_rocm = True
|
||||
elif any(
|
||||
Path(d).joinpath("amdhip64.dll").exists()
|
||||
for d in os.environ.get("PATH", "").split(os.pathsep)
|
||||
if d
|
||||
):
|
||||
has_rocm = True
|
||||
|
||||
return HostInfo(
|
||||
system = system,
|
||||
|
|
|
|||
|
|
@ -403,6 +403,13 @@ class TestHostInfoRocm:
|
|||
source = inspect.getsource(prebuilt_mod.detect_host)
|
||||
assert "ROCM_PATH" in source or "rocm" in source.lower()
|
||||
|
||||
def test_detect_host_windows_rocm_detection(self):
|
||||
"""detect_host() source should have Windows-specific HIP detection."""
|
||||
import inspect
|
||||
|
||||
source = inspect.getsource(prebuilt_mod.detect_host)
|
||||
assert "hipinfo" in source or "amdhip64" in source
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# TEST: install_python_stack.py -- _detect_rocm_version
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue