I recently bought a new Radeon RX 7800 XT, mainly to use the OpenCL features, for example with Darktable.

However, I found it not easy to install all the drivers - especially the OpenCL created some headache for me. Therefore is here a short how to. I used Debian Bookworm for this.

  • First of all, install the firmware-amd-graphics package. Note: There is still this bug-report Debian bug #1052714, which means you have to download fresh firmware from the kernel firmware repo. To do so, download the latest tar (I used linux-firmware-20230919.tar.gz, copy the folder amdgpu to /usr/lib/firmware and run update-initramfs -c -k all)
  • Now - as described in the Debian Wiki Page, remove all nvidia stuff you might have: apt purge '*nvidia*'
  • Install the required packages: apt install libgl1-mesa-dri libglx-mesa0 mesa-vulkan-drivers xserver-xorg-video-all
  • Reboot. At least the graphical user interface should work now. You should also be able to play games. But OpenCL will not work.
  • For OpenCL, I found that the mesa driver (mesa-opencl-icd) does not work. You need the AMD "ROCm" stuff.
  • To install it, add the following repository: deb [arch=amd64] https://repo.radeon.com/rocm/apt/5.7 focal main, then run apt update and install apt install rocm-opencl-runtime
  • Add your user to the render and video groups: sudo usermod -a -G render,video $LOGNAME (This is very important! If you do not do this, OpenCL will print weird error messages but not say that you are not member of the group...)
  • Reboot and you should see OpenCL working, when using darktable-cltest

Here are some darktable benchmarks with my hardware (Ryzen 9 3900, 64GB RAM, SATA SSD, RX 7800 XT):

[dt_opencl_device_init]
   DEVICE:                   0: 'gfx1101'
   PLATFORM NAME & VENDOR:   AMD Accelerated Parallel Processing, Advanced Micro Devices, Inc.
   CANONICAL NAME:           amdacceleratedparallelprocessinggfx1101
   DRIVER VERSION:           3590.0 (HSA1.1,LC)
   DEVICE VERSION:           OpenCL 2.0 
   DEVICE_TYPE:              GPU
   GLOBAL MEM SIZE:          16368 MB
   MAX MEM ALLOC:            13913 MB
   MAX IMAGE SIZE:           16384 x 16384
   MAX WORK GROUP SIZE:      256
   MAX WORK ITEM DIMENSIONS: 3
   MAX WORK ITEM SIZES:      [ 1024 1024 1024 ]
   ASYNC PIXELPIPE:          NO
   PINNED MEMORY TRANSFER:   NO
   MEMORY TUNING:            NO
   FORCED HEADROOM:          400
   AVOID ATOMICS:            NO
   MICRO NAP:                250
   ROUNDUP WIDTH:            16
   ROUNDUP HEIGHT:           16
   CHECK EVENT HANDLES:      128
   PERFORMANCE:              23.375
   TILING ADVANTAGE:         0.000
   DEFAULT DEVICE:           NO
   KERNEL BUILD DIRECTORY:   /usr/share/darktable/kernels
   KERNEL DIRECTORY:         /home/reox/.cache/darktable/cached_v1_kernels_for_AMDAcceleratedParallelProcessinggfx1101_35900HSA11LC
   CL COMPILER OPTION:       -cl-fast-relaxed-math
   KERNEL LOADING TIME:       0.0382 sec
===================
#  OpenCL   TEST  #
===================
took 0.968 secs
took 0.966 secs
took 0.961 secs
===================
#  CPU ONLY TEST  #
===================
took 8.705 secs
took 8.722 secs
took 8.775 secs