AMD GPU RX 6700 XT support in Tumbleweed

Instructions after the wall of text

Last year I made a definitive switch from macOS to Linux as my primary desktop use
This was not my first time using Linux, as my adventure with computing began in the 1990s precisely with Linux Debian 1.3 aka Bo.
Over the years I have always used Linux in various complementary systems to macOS as my main system, and exactly one year ago I definitely made the switch to Linux for my main system as well.
The choice obviously fell on Debian because it is the one I know best. I started with first with Debian stable. It all worked right the first time, but for desktop use it was quite limited and some devices didn’t work well especially the bluetooth support. I also felt like using newer applications and switched to unstable.
But exactly as the name says, it is not stable and you have to live with several compromises. Reluctantly I decided to abandon Debian in favor of Kubuntu to stay in an area I know. All is well, the devices work perfectly, and I must admit that for a few months I was very satisfied with my choice. But even in Kubuntu things were not perfect, particularly the management of packages with snap of which I just could not appreciate the concepts.

I have heard the good and bad of the various rolling releases and somewhat by accident I landed on Tumbleweed. Never made a better choice. Installed everything and configured the snapshots. Everything still works from day one. In this year the only real big problem for me were the drivers for my AMD RX 6700 XT GPU and OpenCL support for darktable which is the main reason for my switch.

The compromise I found was RustiCL which I used until a few days ago, when I found this post that prompted me to investigate the situation better. And I finally succeeded. Not only OpenCL in darktable but also HIP on Blender and OpenCL in Resolve Da Vinci.

I leave my instructions below both for future reference and to help those who like me occasionally run into difficulties.
As geeky as I am and can move well through complex situations for the average person, I am unfortunately not a black belt in OpenCL, HIC, drivers, kernels, Vulkan, Mesa, and all these layers needed to make a GPU work. This is the one positive aspect I miss about macOS where I never had to worry about making the GPU work.

My setup is based on Tumbleweed and Your mileage may vary.

What I have learned in Linux is that every configuration is different and all it takes is even a small detail - a different PATH, one library more or less - and what works for me, will not work for another. For this reason, my post is not intended to be a complete guide or tutorial. It is probably not even complete and there is missing or misleading information for your configuration. Use it as a reference and adapt it to your needs. In any case, do not hold me responsible if you mess up your setup.

I hope that having shared my frustration and solution can help those who have encountered the same difficulties as me. If this post was helpful to you, please let me know by commenting below.

Thanks to everyone that makes Tumbleweed the best linux experience I have ever had.


Instructions

First of all, I removed the Mesa packages for RustCL:

sudo zypper rm Mesa-libRusticlOpenCL Mesa-libOpenCL

Added the repos from Leap 15.6:

sudo zypper addrepo https://repo.radeon.com/amdgpu/6.2/sle/15.6/main/x86_64/ amdgpu
sudo zypper addrepo https://repo.radeon.com/rocm/zyp/zypper/ rocm
sudo zypper ref

To activate OpenCL in darktable

sudo zypper in rocm-opencl rocm-opencl-icd-loader
sudo reboot

Test with clinfo the information about OpenCL:

clinfo | egrep -m 6 "Name|Vendor|Version"

  Platform Name                                   Portable Computing Language
  Platform Vendor                                 The pocl project
  Platform Version                                OpenCL 3.0 PoCL 3.1  Linux, RelWithDebInfo, RELOC, SPIR, LLVM 16.0.6, SLEEF, FP16, DISTRO, POCL_DEBUG
  Platform Extensions with Version                cl_khr_icd                                                       0x400000 (1.0.0)
  Platform Numeric Version                        0xc00000 (3.0.0)
  Platform Name                                   AMD Accelerated Parallel Processing

Something that is very important that I never consider in my previous attempts:

  • make a backup of ./config/darktable e.g. mv ~/.config/darktable ~/.config/darktable-backup

This step is important because it for darktable recreate the full config and in my case it recognized the new GPU driver.
Run darktable, enable ROCm and activate OpenCL support from the settings.

After some test, I moved the newly created darktablerc in my previous ~/.config/darktable-backup folder and renamed it to be the default folder:

mv ~/.config/darktable/darktablerc ~/.config/darktable-backup/darktablerc
rm -rf ~/.config/darktable
mv ~/.config/darktable-backup ~/.config/darktable

Use also darktable-cltest to test if openCL is available and enable/disabled. After verifying that evertyhing was ok, I used Sarunas’ benchmarks as a reference to do some benchmarks and for the first time I can see very good performances:

darktable-cli setubal.orf setubal.orf.xmp test.jpg --core -d perf -d opencl

 4.1880 [dev_process_export] pixel pipeline processing took 2.119 secs (3.575 CPU)
 5.3875 [export_job] exported to `test_19.jpg'
 [opencl_summary_statistics] device 'AMD Accelerated Parallel Processing gfx1031' (0): 197 out of 197 events were successful and 0 events lost. max event=196

To activate HIP in Blender

I found out that these are the minimum required packages to activate HIP:

sudo zypper in rocm-cmake rocm-core rocm-device-libs rocm-llvm rocm-opencl rocm-opencl-icd-loader rocminfo hip-devel hip-runtime-amd hipcc

Add the ROCm path:

export PATH=$PATH:/opt/rocm-6.2.0/bin

I had to add the PATH environment variable in KDE as well:

'PATH=/opt/rocm-6.2.0/bin:/usr/local/bin:/usr/bin:/bin'

In Blender > Preferences the GPU option is now available.

To activate the GPU in Resolve Da Vinci:

Download Resolve da Vinci from the website:

cd ~/Downloads/DaVinci_Resolve_18.6.6_Linux/  
chmod +x DaVinci_Resolve_18.6.6_Linux.run

After a first run the installer complains about some missing libraries: libapr1 and libapr-util1

I’ve only installed libapr1 from opi:

opi libapr1

and run the installer skipping the library check:

SKIP_PACKAGE_CHECK=1 ./DaVinci_Resolve_Studio_18.1_Linux.run

After the installation I had other issues, and looking for them on forums and reddit I did:

sudo cp /usr/lib64/libglib-2.0.so.0 /opt/resolve/libs/  
sudo cp /usr/lib64/libgdk_pixbuf-2.0.so.0 /opt/resolve/libs/ 

and disabled some libraries:

cd /opt/resolve/libs  
sudo mkdir disabled-libraries  
sudo mv libglib* disabled-libraries  
sudo mv libgio* disabled-libraries  
sudo mv libgmodule* disabled-libraries  

I had to install also the following packages:

sudo zypper in libxcrypt-compat libcurl libcurl-devel mesa-libGLU

Now is it possibile to run Resolve da Vinci from the terminal or the Application Launchder:

/opt/resolve/bin/resolve

In Preferences > Memory and GPU the GPU configuration shows the GPU and the OpenCL support.

References

ROCm Quick start
ROCm Post install these steps are very important, do not ignore them

3 Likes

Your description of the process is much better than the one I did (it didn’t get any response or interaction from other users either), so thank you very much for your post.
Personally, I was unaware of PoCL, and it seems more interesting because it provides OpenCL version 3.0. In my case, I was stuck on version 2.1 provided by AMD.

And you have also explained the steps to make it work in the applications I was talking about, although here I must point out two things:

For Darktable, I didn’t have to backup the configuration file. Darktable automatically disables OpenCL related options when launched if it doesn’t detect OpenCL, but not the other way around. That is, in my tests, if OpenCL was not available in previous Darktable session and it’s available yet, I had to open Darktable, activate ‘OpenCL support’ in ‘Performance’, close Darktable, reopen it and finally select again in ‘Performance’ to use ‘ROCm’. That way it was already enabled. I prefer to do it this way, less chance of error when typing commands.

As of today, I added an additional environment variable which is LD_LIBRARY_PATH, so in my ~/.bashrc file I have the following lines:

export ROCM_PATH=/opt/rocm-6.1.2
export PATH=$PATH:$ROCM_PATH/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROCM_PATH/lib

And regarding the DaVinci installation process, again, thank you very much for the details. It differs from the one I use in just a couple of ways:
I needed to install also libapr-util1-0 and on the other hand, I moved to the ‘disabled-libraries’ folder also the ‘libgobject*’ files but I had a problem: In DaVinci you couldn’t see the videos, you could only hear them and I supposed it was because of the OpenCL version. I’ll try your method using PoCL, and I’ll let you know how it works.

I think for the kind of power user you are, you won’t regret choosing Tumbleweed. I’ve been using openSUSE (also LEAP) for more than 15 years and I can’t change it (the problems come more from Plasma … but that’s another topic).

As I started to follow your installation steps again, I ran into a problem: In your system PoCL appears instead of AMD-APP as OpenCL driver. However, at no point do you mention how you installed PoCL, so I started to test and investigate. There is a PoCL library (zypper in pocl) but that is not enough. In fact, you would have to uninstall any ROCm or AMD library packages that reference AMD-APP and then create the “pocl.icd” file:

echo “/usr/lib64/libpocl.so.2” | sudo tee /etc/OpenCL/vendors/pocl.icd

and in ~/.bashrc I added

export POCL_DEVICES=cpu
export POCL_PLATFORM=Portable Computing Language
export POCL_BUILDING=1
export OCL_ICD_VENDORS=pocl.icd

But no way to get your configuration. I’m afraid there is some step you have performed that you don’t remember doing. It happened to me when I posted my thread, and it’s normal. Luckily, I pulled the BTFRS snapshots (except for the handwritten changes I made in “.bashrc”) and I have the computer back to the way it was before the PoCL “experiment”.

  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3625.0)
  Platform Name                                   AMD Accelerated Parallel Processing
  Device Name                                     gfx1102
  Device Vendor                                   Advanced Micro Devices, Inc.

Yo can see main difference with your configuration is “Name” and “Version”.

More research to be done.

Hi @rafaellinuxuser thanks for the feedback.
You are right probably I missed a step or something that I did in the past that impacted the current system. If can help I’m adding other details:

My repos:

Repository priorities in effect: (See 'zypper lr -P' for details)
      70 (raised priority)  :  1 repository
      90 (raised priority)  :  1 repository
      99 (default priority) :  7 repositories

#  | Alias                            | Name                                                 | Enabled | GPG Check | Refresh | URI
---+----------------------------------+------------------------------------------------------+---------+-----------+---------+------------------------------------------------------------------------------------------------
 1 | amdgpu                           | amdgpu                                               | Yes     | (r ) Yes  | No      | https://repo.radeon.com/amdgpu/6.2/sle/15.6/main/x86_64/
 2 | devel_languages_pharo_stable     | devel:languages:pharo:stable                         | Yes     | (r ) Yes  | Yes     | https://download.opensuse.org/repositories/devel:/languages:/pharo:/stable/openSUSE_Tumbleweed/
 3 | download.opensuse.org-non-oss    | Main Repository (NON-OSS)                            | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/tumbleweed/repo/non-oss/
 4 | download.opensuse.org-oss        | Main Repository (OSS)                                | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/tumbleweed/repo/oss/
 5 | download.opensuse.org-tumbleweed | Main Update Repository                               | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/tumbleweed/
 6 | graphics_darktable_master        | Darktable-Org Master snapshots (openSUSE_Tumbleweed) | Yes     | (r ) Yes  | Yes     | https://download.opensuse.org/repositories/graphics:/darktable:/master/openSUSE_Tumbleweed/
 7 | openh264                         | openh264                                             | Yes     | (r ) Yes  | Yes     | http://codecs.opensuse.org/openh264/openSUSE_Tumbleweed/
 8 | packman                          | Packman                                              | Yes     | (r ) Yes  | Yes     | https://ftp.fau.de/packman//suse/openSUSE_Tumbleweed/
 9 | repo-debug                       | openSUSE-Tumbleweed-Debug                            | No      | ----      | ----    | http://download.opensuse.org/debug/tumbleweed/repo/oss/
10 | repo-openh264                    | Open H.264 Codec (openSUSE Tumbleweed)               | No      | ----      | ----    | http://codecs.opensuse.org/openh264/openSUSE_Tumbleweed
11 | repo-source                      | openSUSE-Tumbleweed-Source                           | No      | ----      | ----    | http://download.opensuse.org/source/tumbleweed/repo/oss/
12 | rocm                             | rocm                                                 | Yes     | (r ) Yes  | No      | https://repo.radeon.com/rocm/zyp/zypper/

The packages installed from the repo rocm:

Loading repository data...
Reading installed packages...

S  | Name                   | Summary                                                     | Type
---+------------------------+-------------------------------------------------------------+--------
i+ | comgr                  | Library to provide support functions for ROCm code objects. | package
i+ | hip-devel              | HIP:Heterogenous-computing Interface for Portability        | package
i  | hip-runtime-amd        | HIP:Heterogenous-computing Interface for Portability        | package
i+ | hipcc                  | hipcc built using CMake                                     | package
i+ | hsa-rocr               | hsa-runtime64 built using CMake                             | package
i+ | hsa-rocr-devel         | hsa-runtime64 built using CMake                             | package
i  | hsakmt-roct-devel      | hsakmt built using CMake                                    | package
i  | rocm-cmake             | rocm-cmake built using CMake                                | package
i  | rocm-core              | Radeon Open Compute (ROCm) Runtime software stack           | package
i+ | rocm-device-libs       | Radeon Open Compute - device libraries                      | package
i  | rocm-llvm              | ROCm core compiler                                          | package
i+ | rocm-opencl            | clr built using CMake                                       | package
i+ | rocm-opencl-icd-loader | OpenCL-ICD-Loader built using CMake                         | package
i+ | rocminfo               | Radeon Open Compute (ROCm) Runtime rocminfo tool            | package
i  | rocprofiler-register   | Registration library for rocprofiler                        | package

The ones from the repo amdgpu:

Loading repository data...
Reading installed packages...

S  | Name        | Summary           | Type
---+-------------+-------------------+--------
i  | amdgpu-core | Core meta package | package

Packages from repo packman:

Loading repository data...
Reading installed packages...

S  | Name                          | Summary                                                         | Type
---+-------------------------------+-----------------------------------------------------------------+--------
i  | autopano-sift-C               | SIFT Feature Detection implementation                           | package
i  | dvgrab                        | Record Digital Video (DV) via an IEEE 1394 (Firewire) Interface | package
i+ | gstreamer-plugins-bad-codecs  | Codecs/plugins for gstreamer-plugins-bad                        | package
i+ | gstreamer-plugins-ugly-codecs | Codecs/plugins for gstreamer-plugins-ugly                       | package
i  | libavcodec61                  | FFmpeg codec library                                            | package
i  | libavfilter10                 | FFmpeg audio and video filtering library                        | package
i  | libavformat61                 | FFmpeg's stream format library                                  | package
i  | libavutil59                   | FFmpeg's utility library                                        | package
i  | libde265-0                    | Open H.265 video codec implementation - libraries               | package
i  | libfaac0                      | Shared library part of faac                                     | package
i  | libfaad2                      | Shared library part of faad2                                    | package
i  | libopenaptx0                  | An implementation of Audio Processing Technology codec (aptX)   | package
i  | libpostproc58                 | FFmpeg post-processing library                                  | package
i  | librtmp1                      | RTMP Stream Dumper Library                                      | package
i  | libswresample5                | FFmpeg software resampling library                              | package
i  | libswscale8                   | FFmpeg image scaling and colorspace/pixel conversion library    | package
i  | libvo-aacenc0                 | VisualOn AAC encoder library                                    | package
i  | libx264-164                   | A free h264/avc encoder - encoder binary                        | package
i  | libx265-209                   | A free H265/HEVC encoder - encoder binary                       | package
i+ | pipewire-aptx                 | PipeWire Bluetooth aptX codec plugin                            | package

Info about the pocl package:

Loading repository data...
Reading installed packages...


Information for package pocl:
-----------------------------
Repository     : Main Repository (OSS)
Name           : pocl
Version        : 3.1-6.2
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 74.6 MiB
Installed      : Yes
Status         : up-to-date
Source package : pocl-3.1-6.2.src
Upstream URL   : http://portablecl.org/
Summary        : Portable Computing Language - an OpenCL implementation
Description    : 
    Portable Computing Language (pocl) is an implementation of the OpenCL standard
    which can be adapted for new targets and devices, both for homogeneous CPU and
    heterogenous GPUs/accelerators.

    pocl uses Clang as an OpenCL C frontend and LLVM for the kernel compiler
    implementation, and as a portability layer. If your desired target has an LLVM
    backend, it should be possible to get OpenCL support by using pocl.

    pocl yields improved performance portability by using a kernel compiler that
    can generate multi-work-item work-group functions that exploit various types of
    parallel hardware resources, such as VLIW, superscalar, SIMD, SIMT, multicore
    and multithread.
Requires       : [4]
    libc.so.6(GLIBC_2.34)(64bit)
    libOpenCL.so.1()(64bit)
    libOpenCL.so.1(OPENCL_1.0)(64bit)
    libpocl.so.2()(64bit)

If I try to remove it no other packages are impacted.

$ sudo zypper rm --dry-run pocl
Reading installed packages...
Resolving package dependencies...

The following package is going to be REMOVED:
  pocl

1 package to remove.

Package install size change:
              |         0 B    required by to be installed packages
   -74.6 MiB  |  -   74.6 MiB  released by to be removed packages

Backend:  classic_rpmtrans --dry-run
Continue? [y/n/v/...? shows all options] (y): 

But if I remove it, OpenCL is not active.

I tried Resolve Da Vinci, Blender, darktable and kdenlive and all of them are working. For the videos I tried from recordings from my camera (Fuji X100F) and they are ok, I did some test, applying LUTs, white balance and didn’t have issues so far :crossed_fingers:

Please, put these info too:

  • ls -alh /etc/OpenCL/vendors
  • If there is a “pocl.icd” there, cat /etc/OpenCL/vendors/pocl.icd
  • printenv | grep -i "rocm\|pocl\|amd"

Here the info:

$ ls -alh /etc/OpenCL/vendors
total 20K
drwxr-xr-x 1 root root 136 Aug 13 23:02 ./
drwxr-xr-x 1 root root  14 Aug  8 14:18 ../
-rw-r--r-- 1 root root  15 Aug 13 23:02 amdocl64_60200_sles155_66.icd
-rw-r--r-- 1 root root  26 Aug  8 14:19 amdocl64.icd
-rw-r--r-- 1 root root  19 Aug  8 14:19 mesa.icd
-rw-r--r-- 1 root root  28 Aug  8 14:19 pocl.icd
-rw-r--r-- 1 root root  22 Aug  8 14:19 rusticl.icd
$ cat /etc/OpenCL/vendors/pocl.icd
/usr/lib64/libpocl.so.2.10.0
$ printenv | grep -i "rocm\|pocl\|amd"
PATH=/opt/rocm-6.2.0/bin:/home/fabio/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/fabio/.local/bin:/home/fabio/bin:/usr/local/bin:/usr/bin:/bin

PoCL translates OpenCL to CPU instructions. Possibly your system doesn’t utilise GPU - this needs tests. You can use nvtop to assess GPU utilisation.

Thanks, I didn’t known nvtop.
This is a screenshot I took when exporting images in darktable:

Is the GPU working, right?

Edit:

This is the result of:

➜  ~  clinfo | egrep -m 6 "Name|Vendor|Version".
  Platform Name                                   Portable Computing Language
  Platform Vendor                                 The pocl project
  Platform Version                                OpenCL 3.0 PoCL 3.1  Linux, RelWithDebInfo, RELOC, SPIR, LLVM 16.0.6, SLEEF, FP16, DISTRO, POCL_DEBUG
  Platform Extensions with Version                cl_khr_icd                                                       0x400000 (1.0.0)
  Platform Numeric Version                        0xc00000 (3.0.0)
  Platform Name                                   AMD Accelerated Parallel Processing

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.