Fix AMD Vega GPU resets

Update, 2020-04-29: Since upgrading to kernel 5.6.6 and Mesa 20.0.4 I haven’t had any GPU resets anymore even without this workaround. It seems the reclocking issue is fixed. Keeping the article for reference:

If you have an AMD Vega 56 or 64 you may have had some issues using the amdgpu driver, namely random GPU resets leaving you with a blank or colored screen and freezing the computer after a few minutes. It seems that too aggressive memory reclocking is the culprit, but I found a solution in the Freedesktop issue list on their GitLab instance:

Stick this in your systemd, e.g. to /etc/systemd/system/amdgpu-pp.service:

2 thoughts on “Fix AMD Vega GPU resets”

Thank you for leading me to know the solution!
I’m 5-6 hours in both playing game, and normal dev work without freezing although I’m using integrated GPU on Ryzen 2200g without dedicated one. Prior to this I experienced random freezing, and crashing.

Another solution is to use cronjob for root user as follows.

sudo crontab -e

then append the following line

@reboot /yourdir/yourscript.sh

I just knew that @reboot is special and will be executed only once when user logs in to the system. If user logs out, and logs in again, it will execute again.

The cronjob variant should do the trick, yes. I preferred the systemd unit file in this case because I also have another GPU-related script that needs to run as root at boot time and controls the GPU fan speed, and this way I have them both in there tidily.