darktable

I recently purchased an AMD Raedon RX 570 GPU in order to accelerate Darktable processing operations using OpenCL. It looks like ROCm, AMD's open-source OpenCL implementation, should work. However, the process to install ROCm and enable image support on Arch Linux was not intuitive, so I'm documenting it here.

Before starting, make sure you have installed the open-source AMDGPU driver (via the xf86-video-amdgpu package).

Install the following ROCm packages from the AUR (I recommend using pacaur to make this easier):

  • rocm-opencl-runtime
  • rocr-runtime
  • roct-thunk-interface

At the time of this writing, hsa-ext-rocr is also required (as noted here), however the PKGBUILD is not up-to-date so use this one instead:

# Maintainer: Bruno Filipe <bmilreu@gmail.com>
pkgname=hsa-ext-rocr
pkgver=1.1.9
pkgrel=15
_debfile=hsa-ext-rocr-dev_1.1.9.0-rocm-rel-3.0-6-7128d0d_amd64.deb
pkgdesc="ROCm Platform Runtime: Closed source components"
arch=('x86_64')
url="https://github.com/RadeonOpenCompute/ROCm"
license=('EULA')
groups=()
depends=(rocm-opencl-runtime)
makedepends=()
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
replaces=()
backup=()
options=()
source=("http://repo.radeon.com/rocm/apt/debian/pool/main/h/hsa-ext-rocr-dev/${_debfile}")
sha256sums=('308bb895465562a2faf002970ffad3e9b204a21265032277e7b7bb1115caff5f')

package() {
        cd "$srcdir"
        tar xf data.tar.gz

        mkdir -p ${pkgdir}/usr/lib

        cp -ax opt/rocm/hsa/lib/* ${pkgdir}/usr/lib
}

After writing this PKGBUILD to a directory, run the following commands to build and install it:

makepkg
sudo pacman -U hsa-ext-rocr-1.1.9-15-x86_64.pkg.tar.xz

Finally, install these packages with pacman:

  • clinfo
  • ocl-icd

You may need to reboot, and then confirm that your graphics card is recognized and that image support is working:

$ clinfo | grep -iE 'Device Name|Image support' | head -n2
  Device Name                                     gfx803
  Image support                                   Yes

At this point, run darktable-cltest to confirm that Darktable can load the OpenCL drivers. If it reports success, you should be ready to enjoy the speed improvements with OpenCL.