From 726fab1f378652e39518633f8dabec47e6f00888 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 31 Mar 2026 10:27:24 +0000 Subject: [PATCH] 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. --- studio/install_llama_prebuilt.py | 12 +++++++++++- tests/studio/install/test_rocm_support.py | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/studio/install_llama_prebuilt.py b/studio/install_llama_prebuilt.py index fc3c65bc4b..abe31ebfff 100755 --- a/studio/install_llama_prebuilt.py +++ b/studio/install_llama_prebuilt.py @@ -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, diff --git a/tests/studio/install/test_rocm_support.py b/tests/studio/install/test_rocm_support.py index 5955d79aec..fe76d920a5 100644 --- a/tests/studio/install/test_rocm_support.py +++ b/tests/studio/install/test_rocm_support.py @@ -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