New blogpost! This time we're fixing VRAM memory management for VRAM-constrained GPUs, especially for 8GB VRAM and lower!

I've been working on this for a while, and it's finally in a state where others can try! If you run into issues where game performance ends up degrading over time due to your GPU running out of VRAM, this should provide a really noticeable improvement.

https://pixelcluster.github.io/VRAM-Mgmt-fixed/

Fixing AMDGPU's VRAM management for low-end GPUs | pixelcluster's GPU blog

@pixelcluster, hmm… I had a look at the utilities' source code (not familiar with Rust…). The following looks like it works:

#! /bin/sh
sudo sh -c 'cd /sys/fs/cgroup/dmem
mkdir -p game-vram
cat dmem.capacity >game-vram/dmem.min
echo '$$' >game-vram/cgroup.procs'
exec "$@"

I'm assuming no inconvenient “max”s; I've not tested with the kernel patches in place; and hopefully I've understood it well enough that that script will help others who are also as yet unassimilated by the systemd collective.

(I don't plan to use exactly that. I'd use a daemon with a socket or I'd configure sudo specifically for that command, mainly 'cos I see sudo as “a bit risky”. Resisting systemd is not futile.)

@lp0_on_fire For launching a game this looks ok (save for some paths being not completely correct - you need to 'cd /sys/fs/cgroup' without 'dmem', and I'd heavily recommend using 'dmem.low' instead of 'dmem.min'), but the setup is not as easy. For one, I think all the desktop processes that should not be prioritized also have to be moved into some (non-root) cgroup, because memory protection is actually always relative to other cgroups. I heard OpenRC might do that, but I don't know for myself.

@lp0_on_fire Oh, also - you probably need to run 'cat dmem > cgroup.subtree_control' as root to actually activate the dmem cgroup controller. This probably needs to happen during login, because otherwise VRAM allocations made before the game was launched are not accounted in the controller.

Lastly, you might want to look into cgroup delegation, i.e. on login, you make an intermediate cgroup as root but change directory ownership to the user - then no sudo is needed to launch a game at all.