Objective

Overclock Radeon RX 400 series and newer graphics cards under Linux using the AMDGPU open source drivers.

Distributions

This method will work on any Linux distribution running the AMDGPU drivers.

Requirements

A working Linux install running kernel 4.10 or newer with root privileges and the AMDGPU drivers installed.

Difficulty

Easy

Conventions

  • # - requires given command to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - given command to be executed as a regular non-privileged user

Introduction

The open source AMDGPU drivers don't have a fancy GUI interface that lets you overclock your card. Actually, they don't come with any kind of control center at all. That's alright, though, you can still overclock your card by modifying a couple of values in configuration files, a perfectly Linux solution if you think about it.

Install Lm_sensors

If you don't already have lm_sensors installed, you should install it. The command below works on Debian distributions, but you can use your distro's package manager just the same.
$ sudo apt install lm-sensors
If your distribution doesn't start the service immediately, start and enable it.
$ sudo systemctl start lm-sensors
$ sudo systemctl enable lm-sensors

Detect Sensors

Once the service is running on your system, use the included utility to detect the sensors on your system. This should include your AMD graphics card.
$ sudo sensors-detect
Save your results at the end of the script.

In order to make sure that it worked, run sensors, and see if your card is there. Try restarting the lm-sensors service if you don't see your card there.

You should either run sensors on a loop in an open terminal or use a program like gkrellm or conky to continually monitor your card's temperatures and fans as you overclock. For maximum safety, keep your temperatures around or below 80C.

Fan Speeds

It's probably a good idea to set your fan speeds manually before you start messing with your clock and memory speeds. This way, you can control your temperatures more actively.

There are two files that you need to modify. You may want to make backup copies of them to restore to factory settings before doing this.

Set the value of pwm1_enable to 1 to manually control it with a percentage value.
$ sudo echo "1" > /sys/class/drm/card0/device/hwmon/hwmon1/pwm1_enable
Now, set the percentage of the fan speed.
$ sudo echo "65" > /sys/class/drm/card0/device/hwmon/hwmon1/pwm1

Overclocking

There are two files to modify when overclocking your card. They both set the percentage to which the card is overclocked. The maximum that you should enter for either is 20%, but never enter that at once. Begin at the base value of 0 and slowly step up, checking your temperatures every time.

Again, if you want to make backups of these files, you can. The default values here should be more obvious, though.

First, you can set the percentage of the overclock speed for the GPU clock.
$ sudo echo "8" > /sys/class/drm/card0/device/pp_sclk_od
Then, you can do the memory. Recent tests have indicated performance drops when overclocking memory. Test it out for yourself, but be aware that this can happen.
$ sudo echo "5" > /sys/class/drm/card0/device/pp_mclk_od
Once you've set these, you can use utilities like the Unigine benchmarks to stress your GPU and make sure that the overclocks are stable and your temperatures remain within a safe range.

If you want to monitor your card's clock speed while you test, you can run the following script in a separate terminal window.
while true; do
    cat /sys/kernel/debug/dri/0/amdgpu_pm_info;
	sleep 5;
done

Closing Thoughts

Overclocking should always be handled with caution. It's surprisingly easy to destroy your components. As long as you're careful, you can get a bit of additional performance out of your card without spending any extra cash.