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:

[Unit] Description=AMD PP adjust service [Service] User=root Group=root GuessMainPID=no ExecStart=/opt/amdgpu-pp.sh [Install] WantedBy=multi-user.target

Then in /opt/amdgpu-pp.sh:

#!/bin/bash echo "manual" > /sys/class/drm/card0/device/power_dpm_force_performance_level echo "1 2 3" > /sys/class/drm/card0/device/pp_dpm_mclk

chmod +x that bugger and enable/start the service:

systemctl enable amd-pp.service systemctl start amd-pp.service

There, done! I have never had any GPU resets after this. Thank you, haro41, for this workaround.

2 thoughts on “Fix AMD Vega GPU resets”

  1. 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.

    1. I’m glad it worked for you as well!

      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.

Leave a Reply

Your email address will not be published. Required fields are marked *