Harden AMD GPU detection against false positives

- install.sh: replace weak amd-smi list check (awk 'NR>1 && NF') with
  strict pattern matching GPU data rows (/^GPU[[:space:]]*[:\[]/)
- All files: reject rocminfo gfx000 (CPU HSA agent) by requiring
  gfx[1-9] instead of gfx[0-9] in the rocminfo GPU probe
- Fixes false positives on hosts with ROCm tools but no AMD GPU
This commit is contained in:
Daniel Han 2026-04-03 19:50:58 +00:00
commit 3caaf30a90
3 changed files with 8 additions and 6 deletions

View file

@ -110,7 +110,8 @@ def _has_rocm_gpu() -> bool:
for cmd, check_fn in (
# rocminfo: look for "Name: gfxNNNN" indicating an actual GPU agent
(["rocminfo"], lambda out: "gfx" in out.lower()),
# rocminfo: look for "Name: gfxNNNN" with nonzero first digit (gfx000 is the CPU agent)
(["rocminfo"], lambda out: bool(re.search(r"gfx[1-9]", out.lower()))),
# amd-smi list: require "GPU: <number>" data rows, not just a header
(
["amd-smi", "list"],