#16130

Include AMD GPU state and memory pools in debug reports

Openzihaomuwants to merge intofrom

Summary

Add an AMD GPU section to omarchy debug, reporting cached PCI identity, bound driver, runtime state, GPU activity, and separate VRAM/GTT allocation and capacity counters.

  • Detect display controllers by cached PCI vendor 1002 and class 03, including Display-class 038000 APUs and multiple GPUs. No fixed DRM card index or loaded-module predicate.
  • Read live counters only for amdgpu devices with runtime state active or unsupported. Skip suspended, transitional, or unavailable states.
  • Show unavailable fields explicitly and continue the report when metadata or counters cannot be read.
  • Collect the AMD section before inxi, so it records runtime state before that broader scan.
  • Use existing sysfs interfaces and shell/coreutils; no ROCm dependency, package installation, or GPU setting change.

Memory counts are printed in bytes. VRAM and GTT remain separate driver pools, with a note about their relationship to system RAM accounting. This is a diagnostic enhancement.

Native execution

Ran the complete bin/omarchy-debug --no-sudo --print command on an HP ZBook Ultra G1a with Ryzen AI Max+ PRO 395 / Radeon 8060S. It exited 0 in approximately 1.2 seconds with no stderr output.

PCI address: 0000:c3:00.0
  PCI ID: 1002:1586
  PCI class: 038000
  Driver: amdgpu
  Runtime state: active
  GPU busy: 4%
  Driver VRAM total: 536870912 bytes
  Driver VRAM used: 460894208 bytes
  GTT total: 67140354048 bytes
  GTT used: 868536320 bytes

The pool values matched a subsequent native sysfs read; GPU activity changed from 4% to 5% between samples, as expected for a live counter. The capacities are 512 MiB VRAM and about 62.53 GiB GTT. The DRM node on this machine is card1.

Checks and limits

  • bash -n bin/omarchy-debug: passed.
  • git diff --check: passed.
  • bin/omarchy debug --help: resolves to the existing command and flags.
  • bash test/shell.d/debug-amd-gpu-test.sh: 24/24 fixture checks passed.
  • FIFO counter files make an attempted read from a skipped device block and fail a bounded timeout. A positive control exercises the real reader against a sentinel.
  • Two deliberate regressions in temporary copies (reading in a skipped-runtime branch and in a skipped-driver branch) were both rejected by the suite with the expected blocked-read failures.
  • The native run covers one active APU. Other runtime states, drivers, multiple controllers, and fallback cases are exercised with fixtures; actual suspended discrete GPUs and other hardware combinations have not been exercised.
  • The runtime guard applies to the new collector. The complete command still runs its existing hardware tools; it is not guaranteed to leave every suspended GPU asleep.

No full system report or journal output is attached; the excerpt contains the AMD section only.

Fixture coverage follow-up

Test-only commit e73b47dd adds test/shell.d/debug-amd-gpu-test.sh, picked up by the existing shell test runner. The production collector is unchanged.

The suite loads the real collector functions and uses temporary OMARCHY_PCI_DEVICES_PATH fixtures without running unrelated whole-system probes or writing the full debug log. Coverage includes:

  • Display class 038000, VGA, and 3D controllers; active and unsupported runtime PM.
  • Suspended, suspending, resuming, unexpected, missing, and empty runtime states, with no counter reads.
  • A different driver and an unbound device, with no counter reads.
  • Multiple active controllers and a suspended controller before an active one.
  • Non-GPU AMD functions, other vendors, empty/missing PCI roots, and incomplete PCI metadata.
  • Missing, malformed, empty, zero, directory, and dangling-link counter values.

Focused run: 24 checks passed, 0 failed, approximately 1.3 seconds. Bash syntax and whitespace checks also pass. The complete CLI/shell aggregate suites were not run for this test-only follow-up.

Activity

5
greptile-apps[bot]16h ago

Confidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous testing gap is addressed.

Summary

Adds AMD GPU details to omarchy debug before inxi runs.

  • The debug report adds AMD GPU details before its system scan.

All 24 focused checks passed. Bash syntax checks and git diff --check also passed. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "Cover AMD debug collector guards with PC..." · Reviewed by Greptile

greptile-apps[bot]reviewed16h ago
zihaomureviewed15h ago