Skip to content

amdgpu: fall back to hwmon when gpu_metrics v1 is too old - #2131

Open
DvDlVs wants to merge 1 commit into
flightlessmango:masterfrom
DvDlVs:fix/amdgpu-hwmon-fallback
Open

DvDlVs wants to merge 1 commit into
flightlessmango:masterfrom
DvDlVs:fix/amdgpu-hwmon-fallback

Conversation

@DvDlVs

@DvDlVs DvDlVs commented Sep 1, 2026

Copy link
Copy Markdown

Problem

On some AMD GPUs - notably older Vega 20 / datacenter (Instinct) cards such as the Radeon Instinct MI50 / Radeon Pro VII (device id 0x66a1) - MangoHud shows GPU load at 0% and power at 0W permanently.

Root cause

These cards expose a gpu_metrics sysfs file in the old v1 format that is smaller than gpu_metrics_v1_3 (the smallest version MangoHud knows how to parse). On this hardware:

  • The constructor only checked that the gpu_metrics file existed and was readable to set gpu_metrics_is_valid = true.
  • In get_instant_metrics (src/amdgpu.cpp), reading a v1 file that is too small returns early without populating the fields, leaving gpu_load_percent and average_gfx_power_w at 0.
  • Because gpu_metrics_is_valid was still true, metrics_polling_thread then overwrote the correct hwmon values (gpu_busy_percent and power1_input) with those zeros.

Fix

In the AMDGPU constructor, read the metrics header and validate structure_size against the largest version we can actually parse. If the version is not supported (e.g. old v1 smaller than v1_3), mark gpu_metrics_is_valid = false so MangoHud falls back to the working hwmon sysfs nodes (gpu_busy_percent for load and power1_input for power).

Verified on an Instinct MI50: GPU load and power now report real values instead of 0.

Notes

  • Only reads the first 4 bytes of the header (no behavior change for GPUs with a supported gpu_metrics version).
  • Falls back gracefully - existing supported GPUs are unaffected.

Some GPUs (e.g. older Vega 20 / Instinct datacenter cards) expose an
old gpu_metrics_v1 structure that is smaller than gpu_metrics_v1_3,
which is the smallest version MangoHud can parse. Previously the AMDGPU
monitor marked gpu_metrics as valid purely based on whether the sysfs
file existed and was readable, then overwrote the good hwmon values
(gpu_busy_percent and power1_input) with zeros because the metrics read
returned early without populating the fields.

Validate the metrics header (structure_size against the version we can
read) in the constructor and mark gpu_metrics as invalid when it is not
supported, so MangoHud correctly falls back to the hwmon sysfs nodes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant