Fix GPU detection false positives and add missing health groups

- Fix _has_rocm_gpu() false positive: require "GPU: <number>" data rows
  from amd-smi list, not just header containing "gpu"
- Apply same fix in detect_host() in install_llama_prebuilt.py
- Add runtime_payload_health_groups for linux-rocm and windows-hip so
  partial/corrupt ROCm/HIP prebuilt installs are properly detected
- Add bitsandbytes install to Radeon fallback paths (was only in the
  success path, skipped when repo.radeon.com was unreachable)
- Keep DEVICE/CHAT_ONLY as direct imports in __init__.py (matching main)
  and only use __getattr__ for IS_ROCM
This commit is contained in:
Daniel Han 2026-04-03 12:23:37 +00:00
commit ec12f9b1e6
4 changed files with 43 additions and 16 deletions

View file

@ -106,9 +106,13 @@ def _detect_rocm_version() -> tuple[int, int] | None:
def _has_rocm_gpu() -> bool:
"""Return True only if an actual AMD GPU is visible (not just ROCm tools installed)."""
for cmd, marker in (
(["rocminfo"], "gfx"),
(["amd-smi", "list"], "gpu"),
import re
for cmd, check_fn in (
# rocminfo: look for "Name: gfxNNNN" indicating an actual GPU agent
(["rocminfo"], lambda out: "gfx" in out.lower()),
# amd-smi list: require "GPU: <number>" data rows, not just a header
(["amd-smi", "list"], lambda out: bool(re.search(r"(?im)^gpu\s*:\s*\d", out))),
):
exe = shutil.which(cmd[0])
if not exe:
@ -124,7 +128,7 @@ def _has_rocm_gpu() -> bool:
except Exception:
continue
if result.returncode == 0 and result.stdout.strip():
if marker in result.stdout.lower():
if check_fn(result.stdout):
return True
return False