ROCm / ROCm/rocm-cli

examine: gfx_target is empty for every GPU even though rocminfo lists them → ISA `Name:` lines overwrite the agent name

Open Beginner friendly
#393 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
40
Forks
9
Avg merge
4d 20h
Merged PRs (30d)
59

Description

Reported from Omarchy 4.0.2 (Arch), kernel 7.1.9, outside the documented Ubuntu 24.04+ matrix. The defect is in a pure text parser and does not depend on the distro; reproduced with a binary built from main at a6fa76dbca5d767c1190ee47b765d16bad0e4a53.

Current behavior

rocm examine --json reports an empty gfx_target for every GPU even though rocminfo is present, runs cleanly (rocminfo_status: "ok"), and lists both GPUs with their gfx names:

$ rocm examine --json --framework llama-cpp | jq -c '.rocminfo_status, .summary.detected_gfx_target, (.gpus[] | {name: .name[:40], gfx_target, is_apu})'
"ok"
"gfx1100"
{"name":"Advanced Micro Devices, Inc. [AMD/ATI] Navi 3","gfx_target":"","is_apu":false}
{"name":"Advanced Micro Devices, Inc. [AMD/ATI] Raphael","gfx_target":"","is_apu":true}

summary.detected_gfx_target is right only because it comes from the separate sysfs path (detect_linux_sysfs_gfx_target); the per-GPU records never get a target from rocminfo.

Expected behavior

gpus[0].gfx_target == "gfx1100" (RX 7900 XT) and gpus[1].gfx_target == "gfx1036" (Raphael iGPU), matching what rocminfo prints, with is_apu derived from the target rather than guessed from the PCI name.

Steps to reproduce

Any Linux host with a working rocminfo (ROCm 6.x or 7.x):

rocm examine --json | jq '.rocminfo_status, [.gpus[].gfx_target]'
# "ok"
# ["", ""]

Root cause

probe_gpus_rocminfo (crates/rocm-core/src/examine.rs:1094-1116) walks rocminfo's output keeping a running cur_name, and every line that starts with Name: overwrites it. rocminfo prints the ISA sub-entries of a GPU agent after Device Type: GPU, and those lines also start with Name::

Agent 2
  Name:                    gfx1100
  Marketing Name:          AMD Radeon RX 7900 XT
  Device Type:             GPU
      Name:                    amdgcn-amd-amdhsa--gfx1100
      Name:                    amdgcn-amd-amdhsa--gfx11-generic
Agent 3
  Name:                    gfx1036
  ...

So when the next Agent header arrives, cur_name is amdgcn-amd-amdhsa--gfx11-generic, cur_name.starts_with("gfx") is false, and the agent is dropped. The same happens to the last agent at end of input. gfx_targets ends up empty, the function returns early, and no GPU record is touched. Re-implementing the loop verbatim over this host's rocminfo output confirms gfx_targets == []; accepting only the first Name: after an Agent header yields [("gfx1100", "AMD Radeon RX 7900 XT"), ("gfx1036", "AMD Ryzen 5 7500X3D 6-Core Processor")].

Every rocminfo since ROCm 5 prints ISA entries this way, so this affects every host where rocminfo is the source of the target.

Impact

  • rocm diagnose filters on per-GPU gfx_target (crates/rocm-core/src/diagnose.rs:354, 943-950) to tell the discrete GPU from the APU. With every target empty, the fix-9-igpu-dgpu cause prints Detected gfx targets: [] and falls back to its generic advice instead of naming the discrete GPU (observed on this APU+dGPU host).
  • Any consumer of examine --json that reads gpus[].gfx_target or gpus[].is_apu gets empty or PCI-name-guessed values.

Possible solution

Only accept a Name: line as the agent name when none has been recorded since the last Agent header (or ignore names that start with amdgcn-); commit the agent on the next header and at end of input as today. A unit test feeding the verbatim rocminfo excerpt above should assert two GPU targets. I can take this if nobody is on it.

Your environment

  • rocm-cli: built from main at a6fa76d (rocm 0.1.0); also reproduced with the release-channel binary
  • Platform: Linux, Omarchy 4.0.2 (Arch), kernel 7.1.9-arch1-2
  • GPU/APU: AMD Radeon RX 7900 XT (gfx1100) + Ryzen 5 7500X3D iGPU (Raphael, gfx1036)
  • rocminfo: ROCm 7.2.4 at /opt/rocm/bin/rocminfo (distro packages, left unmanaged by rocm-cli); managed runtime release-wheel-multi-arch-7-14-1 also installed, same result

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crates/rocm-core/src/examine.rs:1094-1116 at probe_gpus_rocminfo and trace how Agent and Name: lines are parsed. Add a unit test using the verbatim rocminfo excerpt from the issue, then verify it produces gfx1100 and gfx1036 GPU records with the expected APU classification.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.