I got two HP EliteBook notebooks with a Ryzen CPU, featuring an integrated GPU (AMD term „APU“). The BIOS offers a setting to configure the VRAM between 256 MB and 2048 MB on the one, 512 MB on the other notebook. So I wondered what happens when the GPU required more than the dedicated VRAM. There is some information about what happens on Windows in the WWW. But I like my Linux system, so I spend some time finding out what’s happening there.
On Linux you can see the dedicated video memory easily using:
glxinfo | grep -A30 'Extended renderer info'
(Debian package mesa-utils
)
And indeed, one notebook had a only Video memory: 512MB
:-/
So I searched the WWW and I stumbled a lot about comments what could be done on Windows. Some advised setting registry keys. But I tested none of these, as I don’t have a Windows installed. Some even modifying the BIOS, but I didn’t like that idea either.
Then I had a look at some Intel systems with integrated graphics. And their glxinfo output had the line Unified memory: yes
and the video memory was simply all the RAM (system memory). This caught my interest!
Indeed this seemed straight forward logic. CPU and GPU are integrated and the only RAM is the system memory. There’s simply no real dedicated VRAM. So why shouldn’t the GPU be able to use all the RAM.
So at least for my system with Intel integrated graphics this was great news! No need to distinguish between RAM and VRAM. It’s all unified and flexible usable.
So I continued searching for AMD. On Linux modern GPUs (hardware since about 2015) is being controlled by the AMDgpu driver, which is actively developed by AMD itself. And so I stumbled onto this Reddit post, suggesting changing the amdgpu.gttsize
kernel boot parameter. I tested it, but the video memory value reported by glxinfo didn’t change. But the AMDgpu driver reports some more memory values which can be seen here:
cd /sys/module/amdgpu/drivers/pci\:amdgpu/ grep -H . ./*/mem_info_*{total,used} # Output on my system which has 16 GB of RAM: ./0000:05:00.0/mem_info_gtt_total:7291457536 ./0000:05:00.0/mem_info_vis_vram_total:2147483648 ./0000:05:00.0/mem_info_vram_total:2147483648 ./0000:05:00.0/mem_info_gtt_used:249622528 ./0000:05:00.0/mem_info_preempt_used:0 ./0000:05:00.0/mem_info_vis_vram_used:1144426496 ./0000:05:00.0/mem_info_vram_used:114442649
So there’s the GTT value. And indeed, it changed according to the value I set via amdgpu.gttsize
boot parameter (kernel documentation). And the default was already 50 % of my RAM. So you probably won’t need to set the amdgpu.gttsize
boot parameter. It’s already fine by default.
Side note: If you want to set the boot parameter anyway, see here for permanently setting boot parameters via GRUB.
Side note: Looks like GTT can’t be more than 50 % of the RAM, as described here by Alex Deucher (AMD): TTM (the kernel memory management infrastructure that the driver uses) imposes a default limit of 50% of system memory due to the way the OOM handler works on Linux.
So what’s that GTT? Wikipedia says it’s memory which can be directly accessed by the GPU (see DMA). And that makes a lot of sense for systems with dedicated GPUs, because this way the GPU can easily load data from the RAM to the VRAM.
But what’s the purpose of GTT when using integrated GPU? Turns out, GTT is pretty much the same for an integrated GPU as the VRAM which has been split of from the normal RAM. I did a few tests, lowering my VRAM from 2048 MB to 256 MB. And as long as my GTT was large enough, I didn’t had any major performance drawbacks. So Linux users actually don’t need to worry about the VRAM size for integrated GPUs configured in the BIOS. The gttsize allows the GPU to use half of the RAM in the same way as the VRAM by default :-)
Actually you might even lower the vram in BIOS. So the more flexible GTT memory area is used instead. GTT is more flexible, because it can be used by the CPU when not running GPU applications.
Site note running games via Wine:
You might want to set the corresponding Wine registry key „VideoMemorySize“ to report the correct video memory size to applications. This doesn’t change the memory usable by the GPU. But it may workarounds problems with applications thinking, that there’s not enough VRAM.
P.S.
Everything was tested using Debian-12 running a Linux-6.1 kernel.
And thanks to Mario Limonciello from AMD, who answered some of my questions regarding GTT.
More links: