Skip to content

diagnose: fix-9-igpu-dgpu hardcodes HIP_VISIBLE_DEVICES=1, which is the iGPU on a desktop where the dGPU enumerates first #395

Open

Description

@sbmthakur

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions