How can you know the memory used as vram by an iGPU (aka integrated GPU, integrated graphics)?
1 Answer
*This answer is a wiki, and has much room for improvemnet. In particular please someone supply the case of Intel.* (Rationale of the post: there does not seem to exist such introductory, and easily available information.)
Two preliminaries. First, available information depends on each device. (For example the OP tried an Intel Skylake, a 2015 CPU with an iGPU, which did not provided much information.)
Second, the terminology: For an iGPU, in addition to VRAM (video ram) there's also GTT. GTT is the video memory too, but dynamically allocated from and freed back to the main memory. See also the Wikipedia page about GART. (Perhaps strictly speaking "VRAM" should mean the GDDR memory of a (discrete) video card, but it is customary to use it for iGPU, too.) †1
(Question: does this mean the word VRAM is used to what's preallocated, and exclusively spared for iGPU?)
In this answer we list some tools, and also the Linux sysfs is explained. Available tools include "radeontop" (for AMD), "igt-gpu-tools" (for Intel; formerly known as "intel-gpu-tools" before v1.23, 2018), and "glxinfo".
In radeontop lines like these are shown:
405M / 426M VRAM 95.23% │
189M / 7628M GTT 2.48% │
The OP has heard that the command intel-gpu-top of the package "igt-gpu-tools" is similar, but does not have an access to it. (It seems to support some AMD gpus, but the OP fails to show the details.)
glxinfo provides more detailed information, but not for laypersons:
$ glxinfo
....
Extended renderer info (GLX_MESA_query_renderer):
....
Video memory: 512MB
Unified memory: no
....
Memory info (GL_ATI_meminfo):
VBO free memory - total: 84 MB, largest block: 84 MB
VBO free aux. memory - total: 7451 MB, largest block: 7451 MB
Texture free memory - total: 84 MB, largest block: 84 MB
Texture free aux. memory - total: 7451 MB, largest block: 7451 MB
Renderbuffer free memory - total: 84 MB, largest block: 84 MB
Renderbuffer free aux. memory - total: 7451 MB, largest block: 7451 MB
Memory info (GL_NVX_gpu_memory_info):
Dedicated video memory: 512 MB
Total available memory: 8153 MB
Currently available dedicated video memory: 84 MB
It has the line "Unified memory: no", but so? The OP thought "unified memory" (or UMA) is almost a synonym of iGPU.
We go on to the use of Linux sysfs for AMD iGPUs. (The OP learned this from this answer 664864 by K-atilla.)
You can know these values by running this script:
#!/bin/bash
cd '/sys/module/amdgpu/drivers/pci:amdgpu/'
cd 0000* # Path depends on the device, but this must suffice.
for i in mem_info*; do
a=$( cat "$i" )
echo "${i}: $((a / 1048576))"
done
The result looks like this (Shown in MiB):
mem_info_gtt_total: 7644
mem_info_vis_vram_total: 512
mem_info_vram_total: 512
mem_info_gtt_used: 633
mem_info_preempt_used: 0
mem_info_vis_vram_used: 92
mem_info_vram_used: 92
There's a claim that lspcican be used, but I'm not sure if it's really informative. Its output looks like this:
03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix3 (rev c0) (prog-if 00 [VGA controller])
...
Region 0: Memory at 7d00000000 (64-bit, prefetchable) [size=256M]
Region 2: Memory at 60000000 (64-bit, prefetchable) [size=2M]
Region 4: I/O ports at 1000 [size=256]
Region 5: Memory at 60600000 (32-bit, non-prefetchable) [size=512K]
Finally we point out that you can lower the gtt size by the boot/module parameter amdgpu.gttsize=10 or so. (But it is reported that =0 does not work for some people.) This is also shown in the above cited answer.
'
†1: VRAM and GTT are different, so userspace programs, typically libraries like Mesa, have to take care of them. For example this mesa commit refers to moving buffer between VRAM and GTT.
-
+
nvtopUnder Windows the iGPU can use system RAM for VRAM, not sure if it works in Linux. It must. And in this case the GPU driver must report this info, but I've no idea how to retrieve it.Artem S. Tashkinov– Artem S. Tashkinov2024-07-29 21:11:22 +00:00Commented Jul 29, 2024 at 21:11