Skip to content

feat(gpu): live usage/VRAM/temperature for AMD on Linux via amdgpu sysfs - #2

Merged
mantvmass merged 1 commit into
mantvmass:mainfrom
SVNKVN9:feat/amd-gpu-stats
May 29, 2026
Merged

feat(gpu): live usage/VRAM/temperature for AMD on Linux via amdgpu sysfs#2
mantvmass merged 1 commit into
mantvmass:mainfrom
SVNKVN9:feat/amd-gpu-stats

Conversation

@SVNKVN9

@SVNKVN9 SVNKVN9 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Mirror the NVML poller pattern for AMD cards: a 2 s background thread reads /sys/class/drm/card*/device/ — gpu_busy_percent, mem_info_vram_, and hwmon/temp_input (preferring the sensor labeled "edge" to match NVIDIA's GpuTemp). No new dependency; gated on cfg(target_os = "linux").

To support vendor-specific dispatch beyond is_nvidia, GpuRow now carries vendor_id + device_id (PCI 16-bit values from wgpu::AdapterInfo). AMD samples match wgpu slots by device_id, which is unambiguous unlike the substring name match used for NVML.

UI cleanup that came out of testing on RX 5x0 (8 GiB):

  • shrink label column 14→6 ("temperature" → "temp") so the bar isn't squeezed to nothing on narrow panels
  • compact "used / total " formatter — both numbers share the unit of total, so "1.6 / 8.0 GB" instead of "1.59 GB / 8.00 GB" (~10 chars saved)
  • recompute bar_w against the vram line's worst-case trailing width; the old constant assumed every line ended in just "100.0%"
  • per-vendor unsupported_reason text (NVIDIA / AMD / Intel / other)

README updated to reflect AMD-on-Linux now reports live stats.

Mirror the NVML poller pattern for AMD cards: a 2 s background thread
reads /sys/class/drm/card*/device/ — gpu_busy_percent, mem_info_vram_*,
and hwmon/temp*_input (preferring the sensor labeled "edge" to match
NVIDIA's GpuTemp). No new dependency; gated on cfg(target_os = "linux").

To support vendor-specific dispatch beyond is_nvidia, GpuRow now carries
vendor_id + device_id (PCI 16-bit values from wgpu::AdapterInfo). AMD
samples match wgpu slots by device_id, which is unambiguous unlike the
substring name match used for NVML.

UI cleanup that came out of testing on RX 5x0 (8 GiB):
- shrink label column 14→6 ("temperature" → "temp") so the bar isn't
  squeezed to nothing on narrow panels
- compact "used / total <unit>" formatter — both numbers share the unit
  of total, so "1.6 / 8.0 GB" instead of "1.59 GB / 8.00 GB" (~10 chars
  saved)
- recompute bar_w against the vram line's worst-case trailing width;
  the old constant assumed every line ended in just "100.0%"
- per-vendor unsupported_reason text (NVIDIA / AMD / Intel / other)

README updated to reflect AMD-on-Linux now reports live stats.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

@mantvmass mantvmass left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@mantvmass
mantvmass merged commit 7952d7b into mantvmass:main May 29, 2026
4 checks passed
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.

2 participants