Skip to content

amdgpu: fix AMDGPU stats showing 0 due to invalid gpu_metrics data - #2047

Open
lullptr wants to merge 1 commit into
flightlessmango:masterfrom
lullptr:master
Open

amdgpu: fix AMDGPU stats showing 0 due to invalid gpu_metrics data#2047
lullptr wants to merge 1 commit into
flightlessmango:masterfrom
lullptr:master

Conversation

@lullptr

@lullptr lullptr commented May 9, 2026

Copy link
Copy Markdown

Issue: AMDGPU stats displaying 0
Fixes #2028
Fixes #2038

Problem

I understand that the current implementation uses a hybrid model where sysfs values act as the baseline and are overridden by gpu_metrics when available.

However, the override logic assumes that the presence of the gpu_metrics file implies valid and supported data. In practice, this is not always true, the file may exist and be readable even when the kernel/firmware reports unsupported or invalid metrics.

As a result, valid sysfs values are unconditionally overwritten by invalid gpu_metrics data, leading to GPU statistics incorrectly showing as 0.

Fix

Introduce a validity tracking flag for gpu_metrics sampling.

The flag is set only when at least one gpu_metrics sample successfully produces valid and usable metric data. This indicates gpu_metrics is functional on the system and only then is gpu_metrics allowed to override sysfs values.

Consideration

This fix preserves the existing hybrid model by allowing gpu_metrics to override sysfs values once at least one valid sample has been observed.

However, it may be worth reconsidering whether a single successful sample is sufficient, or if multiple consecutive valid samples should be required before enabling overrides.

Screenshots

Before patch
before-patch

After patch
after-patch

@lullptr lullptr changed the title gpu: fix AMDGPU stats showing 0 due to invalid gpu_metrics data amdgpu: fix AMDGPU stats showing 0 due to invalid gpu_metrics data May 10, 2026
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.

[Support] Integrated Graphic Cards (APU) don't show usage AMD Radeon Vega 8 IGPU no stats working

1 participant