Add GTT memory monitoring for AMD GPUs#515
Open
jibanez-staticduo wants to merge 1 commit intocorecoding:mainfrom
Open
Add GTT memory monitoring for AMD GPUs#515jibanez-staticduo wants to merge 1 commit intocorecoding:mainfrom
jibanez-staticduo wants to merge 1 commit intocorecoding:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mem_info_gtt_usedandmem_info_gtt_totalfrom/sys/class/drm/cardN/device/and exposes them as two new GPU sensor fields: GTT Used and GTT TotalMotivation
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_topalready 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):
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 newFileModule.Filereads inside the existing AMD DRM block in_readGpuDrm(), readingmem_info_gtt_usedandmem_info_gtt_total. Both are wrapped in.catch()blocks to gracefully handle systems where these files don't exist.Testing
Made with Cursor