diagnose: fix-9-igpu-dgpu hardcodes HIP_VISIBLE_DEVICES=1, which is the iGPU on a desktop where the dGPU enumerates first
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40
- Forks
- 9
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 59
Description
Omarchy 4.0.2 (Arch), kernel 7.1.9; RX 7900 XT (gfx1100) + Raphael iGPU (gfx1036). Built from main at a6fa76d plus #394 (on plain main the note below reads Detected gfx targets: [], see #393; the plan is the same).
Current behavior
$ rocm diagnose
#1 (fix-9-igpu-dgpu) [LIKELY score=65/100] iGPU enumerated alongside dGPU and destabilising the runtime
plan: Pin the runtime to the discrete GPU with HIP_VISIBLE_DEVICES so the iGPU is hidden.
$ # Then pin HIP to the dGPU (typically index 1 when an APU is index 0):
$ export HIP_VISIBLE_DEVICES=1
note: Detected gfx targets: ["gfx1100", "gfx1036"]. Discrete GPU(s): ["gfx1100"]; integrated APU(s): ["gfx1036"]. ... do not assume the higher-numbered gfx target is the dGPU ...
verify after fix: HIP_VISIBLE_DEVICES=1 python -c "import torch; print(torch.cuda.device_count())"
The note names the discrete GPU; the plan and the verify line still assume it is index 1. Here it is index 0:
$ HIP_VISIBLE_DEVICES=1 llama-server --list-devices
ROCm0: AMD Ryzen 5 7500X3D 6-Core Processor (20254 MiB ...) <- the iGPU
$ HIP_VISIBLE_DEVICES=0 llama-server --list-devices
ROCm0: AMD Radeon RX 7900 XT (20464 MiB ...)
Following the plan pins HIP, and everything on it, to the iGPU. This is the common desktop layout (Ryzen 7000 iGPU + Radeon card). rocm fix fix-9-igpu-dgpu without --device-index is print-only (#303), so the harm is the advice itself.
Expected behavior
The plan and verify line use the ordinal of the GPU the note identified as discrete (=0 here), or fall back to the <dGPU-index> placeholder fix.rs:252 already uses — never a literal 1.
Root cause
check_9_igpu_dgpu_collision (crates/rocm-core/src/diagnose.rs:915-990) has discrete_targets in hand for the note but renders the command and verify strings as literals with 1; the Windows branch hardcodes setx HIP_VISIBLE_DEVICES 1 likewise.
Possible solution
Map the discrete target to its position among the GPU agents and render that into both lines; placeholder when it cannot be identified. Unit test: a fixture with gfx1100 before gfx1036 must produce =0. Related: #149 and #382 touch fix-9's flag and wording but keep the literal; #267 adds visibility-mask helpers in serve that could be reused. Happy to take this after #394.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in crates/rocm-core/src/diagnose.rs, especially check_9_igpu_dgpu around lines 915-990, and inspect the existing placeholder usage in fix.rs:252. Trace how discrete_targets relates to GPU-agent ordering, then find or add the unit-test fixture described in the issue. Done when both plan and verification output use the identified discrete GPU index, with a placeholder when it cannot be identified, and the gfx1100-before-gfx1036 case produces =0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100