From e714d0a291ad8d1ab96cf6e086b303bb34c9bf61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jordi=20Ib=C3=A1=C3=B1ez?= Date: Fri, 6 Feb 2026 12:00:58 +0100 Subject: [PATCH] Add GTT memory monitoring for AMD GPUs via DRM sysfs 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 --- sensors.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sensors.js b/sensors.js index f310161..2f9e974 100644 --- a/sensors.js +++ b/sensors.js @@ -665,6 +665,19 @@ export const Sensors = GObject.registerClass({ }).catch(err => { // nothing to do, keep old value displayed }); + // GTT (Graphics Translation Table) memory - system RAM accessible by the GPU. + // Particularly useful for AMD APUs (e.g. Strix Halo, Rembrandt, Phoenix) + // where GTT memory can be significantly larger than dedicated VRAM. + new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_gtt_used').read().then(value => { + this._returnGpuValue(callback, 'GTT Used', parseInt(value) / unit, typeName, 'memory'); + }).catch(err => { + // not all AMD GPUs expose GTT info, silently ignore + }); + new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_gtt_total').read().then(value => { + this._returnGpuValue(callback, 'GTT Total', parseInt(value) / unit, typeName, 'memory'); + }).catch(err => { + // not all AMD GPUs expose GTT info, silently ignore + }); } else { // for other vendors only show basic card info let vendorName = null;