Skip to content

Add GTT memory monitoring for AMD GPUs#515

Open
jibanez-staticduo wants to merge 1 commit intocorecoding:mainfrom
jibanez-staticduo:add-amd-gtt-memory-support
Open

Add GTT memory monitoring for AMD GPUs#515
jibanez-staticduo wants to merge 1 commit intocorecoding:mainfrom
jibanez-staticduo:add-amd-gtt-memory-support

Conversation

@jibanez-staticduo
Copy link

Summary

  • Adds GTT (Graphics Translation Table) memory monitoring for AMD GPUs detected via DRM sysfs
  • Reads mem_info_gtt_used and mem_info_gtt_total from /sys/class/drm/cardN/device/ and exposes them as two new GPU sensor fields: GTT Used and GTT Total
  • Errors are silently caught so discrete AMD GPUs or older drivers that don't expose these files are unaffected

Motivation

GTT memory represents system RAM accessible by the GPU. On AMD APUs — such as Strix Halo (Ryzen AI MAX), Rembrandt, and Phoenix — the dedicated VRAM is typically very small (e.g. 512 MiB), while GTT can be tens to hundreds of GiBs of system memory allocated to the GPU.

For workloads like LLM inference (via ROCm/llama.cpp), the GPU primarily uses GTT memory rather than VRAM. Tools like amdgpu_top already report GTT usage, but Vitals currently only shows VRAM — which gives an incomplete picture on these APUs.

Example on an AMD Ryzen AI MAX+ 395 (Strix Halo):

Memory Type Total Typical Usage
VRAM (dedicated) 512 MiB ~455 MiB
GTT (system RAM) 124 GiB ~63 GiB (running LLMs)

Without GTT monitoring, Vitals only shows the 512 MiB VRAM, missing the 63 GiB actually being used by the GPU.

Changes

  • sensors.js: Added two new FileModule.File reads inside the existing AMD DRM block in _readGpuDrm(), reading mem_info_gtt_used and mem_info_gtt_total. Both are wrapped in .catch() blocks to gracefully handle systems where these files don't exist.

Testing

  • Tested on Fedora 43 with AMD Ryzen AI MAX+ 395 (Strix Halo) / Radeon 8060S
  • GTT values correctly displayed alongside existing VRAM values
  • Verified that the extension loads without errors on systems where GTT sysfs files are present
  • No regressions observed for existing GPU, temperature, or other sensor readings

Made with Cursor

AMD GPUs expose GTT (Graphics Translation Table) memory usage through
sysfs at /sys/class/drm/cardN/device/mem_info_gtt_{used,total}. GTT
represents system RAM that is accessible by the GPU, which is
particularly important on AMD APUs (e.g. Strix Halo, Rembrandt,
Phoenix) where GTT memory can be significantly larger than dedicated
VRAM and is the primary memory pool for GPU workloads such as LLM
inference or graphics rendering.

This patch adds two new GPU sensor fields for AMD cards when detected
via DRM:
  - GTT Used: current GTT memory consumption
  - GTT Total: total GTT memory available

The reads are wrapped in catch blocks so that AMD discrete GPUs or
older drivers that do not expose these sysfs files will silently
ignore the missing data without affecting existing functionality.

Co-authored-by: Cursor <cursoragent@cursor.com>
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