FeralInteractive / gamemode

Optimise Linux system performance on demand
BSD 3-Clause "New" or "Revised" License
4.7k stars 185 forks source link

AMDGPU: Evict in-use VRAM to system RAM before starting a game #445

Open mygamingaccount opened 9 months ago

mygamingaccount commented 9 months ago

Used-up VRAM can cause unexpected losses of performance in a very significant magnitude. This comes from my experience on an 8GB Radeon RX5700 on a WQHD display.

The real problem probably lies with Linux's video memory allocator. It does not seem to work the same way as on Windows where this kind of performance drop does not appear to happen. Even under pressure, the unused pages in GPU memory aren't moved to make more RAM available. One could say that due to this behavior, system requirements are more heavy on Linux.

In my case, I have found relief by manually "evicting" the VRAM to the system memory, also called the GTT, using a program called UMR (https://gitlab.freedesktop.org/tomstdenis/umr)

image

There appears to be a debugfs file at /sys/kernel/debug/dri/0/amdgpu_evict_vram, reading this file causes the VRAM pages to be moved to the system memory GTT.

Gamemode could have a feature where executing gamemoderun would do this automatically, until the memory allocator becomes on-par with the one in other operating systems.

mygamingaccount commented 9 months ago

More info https://gitlab.freedesktop.org/mesa/mesa/-/issues/5902