OpenCL on the 6900 XT in Linux

Anyone get OpenCL working on the 6900 XT in Linux? If so, can you please share how? I know I’m not the only one having trouble.

Which thing do you want to work right? :wink:

Namely, ethminer. I’m experiencing the same core issue referenced in that thread. clinfo will correctly identify the device, but then it hangs, and when attempting to run ethminer, hashrate is 0.00 and it has to be force-killed to close it.

➜  ~  ls /opt/amdgpu-pro/lib/x86_64-linux-gnu/ 
amdvlk64.so            libamdhip64.so             libamdocl12cl64.so   libcltrace.so  libglapi.so    libGLESv2.so.2  libGL.so.1.2               libOpenCL.so.1
libamd_comgr.so.1      libamdhip64.so.4           libamdocl64.so       libEGL.so      libglapi.so.1  libGL.so        libhsa-runtime64.so.1      libOpenCL.so.1.2
libamd_comgr.so.1.9.0  libamdhip64.so.4.0.21115-  libamdocl-orca64.so  libEGL.so.1    libGLESv2.so   libGL.so.1      libhsa-runtime64.so.1.2.0[/code]
➜  ~ ls -go /lib/firmware/amdgpu | grep sienna*
-rw-r--r-- 1 263296 Apr  4 07:25 sienna_cichlid_ce.bin
-rw-r--r-- 1  97908 Apr  4 07:25 sienna_cichlid_dmcub.bin
-rw-r--r-- 1 263424 Apr  4 07:25 sienna_cichlid_me.bin
-rw-r--r-- 1 268592 Apr  4 07:25 sienna_cichlid_mec2.bin
-rw-r--r-- 1 268592 Apr  4 07:25 sienna_cichlid_mec.bin
-rw-r--r-- 1 263424 Apr  4 07:25 sienna_cichlid_pfp.bin
-rw-r--r-- 1 128608 Apr  4 07:25 sienna_cichlid_rlc.bin
-rw-r--r-- 1  34048 Apr  4 07:25 sienna_cichlid_sdma.bin
-rw-r--r-- 1 247396 Apr  4 07:25 sienna_cichlid_smc.bin
-rw-r--r-- 1 215152 Apr  4 07:25 sienna_cichlid_sos.bin
-rw-r--r-- 1 317184 Apr  4 07:25 sienna_cichlid_ta.bin
-rw-r--r-- 1 526912 Apr  4 07:25 sienna_cichlid_vcn.bin

I tried this with Folding@Home and the rocm and rocm-opencl libraries. I reported bugs to the rocm project and they just closed it saying RDNA2 is not being implemented yet.

It does sort of work. I could run hashcat OK.

Edit: I was not using the amdgpu-pro stuff.

That being said I couldn’t even get FAH to use OpenCL on a Vega card (also F33).
Probably would need the amdgpu-pro stuff which I don’t want to use because I’m also gaming on it.

I wish they would apply the same streamlining they did with the AMD graphics stack to the compute stack…

I ended up creating a Manjaro VM and using the PKGBUILD file in this post to use OpenCL with my 6900XT. Worked great.

1 Like

Now I’m getting the itch to rewrite this for an RPM but I don’t think I got the time or motivation for it :eyes:

1 Like

Attempts at overclocking using amdgpu-clocks has resulted in full system lockup requiring a hard reset. It doesn’t require any extreme overclocking either. Just running it a few times seems to crash everything, and doesn’t appear to actually change the clocks.

Something else I found interesting is that if I attempt to ssh into the system and start nsfminer, it doesn’t detect any usable devices, but if I start it directly from within a tmux session in XFCE it runs fine and I’m able to ssh and connect to the session.

Some discussion on 6900XT usage here

This configuration worked, but unfortunately, 1075MHz is the maximum allowed value for OC_MCLK.

OD_SCLK:
0: 500MHz
1: 2400MHz
OD_MCLK:
1: 1075MHz
OD_VDDGFX_OFFSET:
-25mV
FORCE_PERF_LEVEL: manual

edit Changed OD_VDDGFX_OFFSET because mining was throttling. Optimal value is probably somewhere between -25mV and -50mV.

I was able to get opencl “working” on debian bullseye with an rx6900xt.

The new AMD rocm software is a little fresh, and I think it was recent “unified” starting in 21.40.1. They have switched to an distro/repository style updater, rather than tarring up all the packages into one file.

As far as I can tell, the new version really doesn’t do anything without the DKMS kernel modules, which aren’t easily built out of the box on debian bullseye kernels (5.10 and 5.14). Ubuntu is using 5.11 and maybe an earlier, LTS kernel.

Things seems to work well in Ubuntu with the kernel modules, but not so much in debian. I ended up doing some unspeakable things to get it to work. It’s not the best solution and I don’t intend to use this as a daily driver. I don’t work with openCL; I was just curious if it was possible…

In a nutshell, I built the DKMS kernel modules in ubuntu and then transplanted the kernel, modules, and firmware into my debian system. It’s all the files in /boot /lib/modules/5.11 /usr/src/<5.11 stuff> and /lib/firmware/updates/amdgpu. I don’t know if this last one does anything in debian, but I included it anyway.

From there, I was able to download and install the 21.40.1 amdgpu-install deb and use that to install opencl support amdgpu-install --opencl=rocm --no-dkms --no-32.

There is a build dependancy for libstdc+±5 or -7?, so I made a fake debian package that provides those and installs libstd+±10-dev, which is in the debian repos.

There were a few incantations of update-grub and update-initramfs -vuk all to get crypto mounts and other things squared away.

Overall, it’s not recommended. Things work on the 5.11 kernel on ubuntu, but if I boot into a debian stock kernel, I lose my second screen. This is probably not a problem if you are using a headless server and actually use openCL for work or blender benchmarks. Let me know if you want more details, although I suspect that most people would prefer a more stable solution. I do expect the rocm drivers will improve with time, although it’s anyone’s guess on how long it would take.

1 Like

AMD just released ROCM 5.0(.1).

This should work on debian Bullseye with the 5.10 kernel now, with a few caveats. The backports kernel is still too fresh and not supported with the kernel modules.

The caveats are that you will need a fake package so that the installer thinks that libstdc-7 is installed. libstdc-10 is installed in Bullseye and doesn’t seem to cause any problems.

I haven’t tested this extensively, so YMMV. I do expect better ROCM support in debian soon since it looks like there are debian developers/packagers working on it. There are some rocm packages popping up in Sid.

1 Like

I forked an existing script and updated it for use with the 20.40 driver. It “works” but the desktop environment fails to load on reboot. I’m using Linux Mint 20.3 with the Cinnamon desktop and have a 6900XT as my primary card with a 3090 in passthrough. Based on some existing comments, I think removing the second card might fix the problem, but I have yet to try it.

What drivers does mint use by default, or what was it using before you ran the script?

➜  ~ inxi -G
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] driver: amdgpu v: kernel 
           Device-2: NVIDIA driver: vfio-pci v: N/A 
           Display: x11 server: X.Org 1.20.13 driver: amdgpu,ati unloaded: fbdev,modesetting,radeon,vesa 
           resolution: 3840x2160~60Hz 
           OpenGL: renderer: AMD Radeon RX 6900 XT (SIENNA_CICHLID DRM 3.44.0 5.17.11-xanmod1 LLVM 12.0.0) v: 4.6 Mesa 21.2.6 

Also, were those cards supported with the 20.04 driver? The driver might predate the cards.

Yes, it supports the 6900XT. I was previously using it in Manjaro under a VM and had OpenCL working using this PKGBUILD.

My solution in Mint at the moment is two scripts to install and uninstall OpenCL components as necessary.

#!/bin/bash
# install needed deps
apt-get update
apt-get -y install vainfo clinfo libvdpau1
dpkg -i amdgpu-core_*_all.deb
dpkg -i amdgpu-pro-core_*_all.deb
# install openCL
dpkg -i opencl-amdgpu-pro-comgr_*_amd64.deb
dpkg -i opencl-amdgpu-pro-icd_*_amd64.deb
dpkg -i libdrm2-amdgpu_*_amd64.deb
dpkg -i libdrm-amdgpu-common_*_all.deb
dpkg -i libdrm-amdgpu-amdgpu1_*_amd64.deb
dpkg -i opencl-orca-amdgpu-pro-icd_*_amd64.deb
#!/bin/bash
dpkg -r libdrm-amdgpu-amdgpu1:amd64 libdrm-amdgpu-common libdrm2-amdgpu:amd64 opencl-amdgpu-pro-comgr opencl-amdgpu-pro-icd amdgpu-pro-core amdgpu-core opencl-orca-amdgpu-pro-icd:amd64

Updating this thread to note that OpenCL works in the Ubuntu 22.04 driver.

  • Grab the .deb for the AMD repo from here
  • sudo dpkg -i amdgpu-install_<version>.deb
  • sudo apt update
  • sudo amdgpu-install --usecase=workstation -y --vulkan=pro --opencl=rocr,legacy
  • sudo usermod -a -G render username
  • sudo reboot

Got my 6900XT folding proteins now.

3 Likes