Leap + TW: Getting working OpenCL with AMD ROCm for videocards and APUs (AMD hardware)

This page describes installation of an OpenCL-only part of AMD ROCm software.

Info about AMD hardware: https://en.wikipedia.org/wiki/List_of_AMD_graphics_processing_units
Info about AMD APUs: https://en.wikipedia.org/wiki/List_of_AMD_accelerated_processing_units

Info about AMD ROCm:
https://github.com/RadeonOpenCompute/ROCm
https://rocm-documentation.readthedocs.io/en/latest/

Supported hardware for AMD ROCm: GCN2 - GCN5.
RDNA (Navi) have no OpenCL support yet: https://www.amd.com/ru/support/graphics/amd-radeon-5700-series/amd-radeon-rx-5700-series/amd-radeon-rx-5700-xt#amd_support_product_spec

How to install for SLE 15 SP 1 ≈ openSUSE Leap 15.1 with kernel 4.12: https://rocm-documentation.readthedocs.io/en/latest/Installation_Guide/Installation-Guide.html#sles-15-service-pack-1
Undescribed cases in this manual:

  1. TW
  2. Leap + newer kernels
  3. Using it with APU

AMDGPU-PRO drivers available for SLE = Leap 15.1 + discrete videocards, but not for TW, and not for APU.
When installing AMD ROCm + APU you may encouner this bug: https://forums.opensuse.org/showthread.php/539742-With-AMD-Picasso-APU-system-hangs-during-boot-with-kernel-5-6-2-(5-6-0-works)

For the best results use AMDGPU-PRO drivers, not Mesa 3D OpenCL + kernel ones.
With Mesa 3D OpenCL + LibreOffice you may encounter this bug: https://forums.opensuse.org/showthread.php/539315-LibreOfiice-hangs-AMD-CPU-Raven2-system-when-trying-to-use-OpenCL-from-Mesa-3D

AMD ROCm “Not currently supported on kernels newer than 5.4”.
Supposedly AMD ROCm will work with Leap 15.2 + its 5.3 kernels.

AMD supports rather new products.
That is, AMD drops Terascale, is dropping GCN1.
But:
AMD Radeon R7 240 which is GCN1 have SLE support: https://www.amd.com/ru/support/graphics/amd-radeon-r7-series/amd-radeon-r7-200-series/amd-radeon-r7-240
AMD Radeon HD 7790 which is GCN2 have no SLE support: https://www.amd.com/ru/support/graphics/amd-radeon-hd/amd-radeon-hd-7000-series/amd-radeon-hd-7790

You may use Mesa 3D + kernel drivers for OpenGL, Vulkan, VA-API, graphics output, and along with this use AMD ROCm for OpenCL.
With GCN1 and older hardware: try to use Mesa 3D + kernel drivers + OpenCL parts from AMDGPU-PRO and FireGL drivers.
AMD limits use of ROCm with APU to OpenCL-only drivers, for a full ROCm package you will need patches from a third-party suppliers.

Improving this I get:

Steps to follow:

  1. Uninstall Mesa 3D OpenCL packages.
    Often they don’t works, sometimes they hangs OS.

  2. Install DKMS from Main or Bumblebee repos.

  3. Add ROCm repo with no GPG check:


sudo zypper addrepo --no-gpgcheck https://repo.radeon.com/rocm/zyp/zypper/ rocm

  1. Install packages:
rocm-opencl
rocm-opencl-devel
rocminfo

Will be installed as a dependencies:

hsa-rocr-dev
hsakmt-roct
comgr

Additionally select

rocm-smi-lib64
  • 7 packages at all.

AMD ROCm 3.3+ support multiversioning.
If you choose to install packages without numbers in the names, you will get only one version installation.
If you choose to install packages with numbers in the names, you will get numbered installation => you will be able to use more than one version at a time.
Provide needed paths in the latter case.

  1. Add user to the “video” group.

  2. Add file

/etc/udev/rules.d/70-kfd.rules

Write this string in it:


SUBSYSTEM=="kfd", KERNEL=="kfd", TAG+="uaccess", GROUP="video"
  1. Reboot.

  2. Perform checks:

/opt/rocm-3.3.0/bin/rocminfo
/opt/rocm-3.3.0/opencl/bin/x86_64/clinfo
clinfo

“-3.3.0” means we are using ROCm 3.3 version.
Install clinfo if you need it.

That’s all.

After installation:

Check for possibilities with

clpeak

LibreOffice + OpenCL: works.
LuxMark: works.

FAHBench-2.3.2-Linux: works on CPU, with OpenCL - hangs.
Writes:

libGL error: MESA-LOADER: failed to open radeonsi (search paths /usr/lib64/dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open radeonsi (search paths /usr/lib64/dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open swrast (search paths /usr/lib64/dri)
libGL error: failed to load driver: swrast

SVP: works with CPU, refuses to use OpenCL.

Up ROCm from 3.3 to 3.10: update is not possible, only fresh installation.
ROCm is available for Leap 15.2, works with TW.
For OpenCL-only setup install only needed parts.
Needs to add paths after installation - read this for details: Clarence's Wicked Mind: ROCm OpenCL with openSUSE Tumbleweed

IDK whether adding custom *.icd file is needed - read this for details: https://wiki.tiker.net/OpenCLHowTo/

ROCm v. 3.7+ support works with images: ROCm 3.7 Has Open-Source OpenCL Image Module Included - Phoronix

OpenCL Image support is generally needed by imaging applications with the likes of Darktable and DaVinci Resolve, both of which seem to be happily playing fine now according to user reports with ROCm 3.7. This change in the OpenCL Image support was spotted on pixls.us.

ROCm 4.0 is released, I’m not tested it yet. Officially it supports only Vega (CDNA) dies.

ILL AMD APU + ROCm for OpenCL either unusable or nonworking.

For AMD APUs use headless amdgpu-pro OpenCL drivers: https://forums.opensuse.org/showthread.php/548518-Leap-TW-OpenCL-on-AMD-with-Mesa-3D-headless-amdgpu-pro

Reviving an old topic…

When is the last time this method worked?

As far as I can tell, it is only possible with the recent drivers and RDNA-based cards. My Polaris-based card, for instance, is not supported beyond a certain version (4.3.1), and even then that older driver does not work on TW. Apparently there is a patch for Arch to make recent releases of rocm work for Polaris, but obviously it’s not something that can be implemented in a step-by-step guide.

Has anyone figured this out? It’s a mess for every distribution except Arch.

This is an 15.1 thread (and in fact should have been closed long time ago). I doubt many people will see your contribution.

When you want exposure, start a new thread (and you can of course include a link to this one of you think that maybe of help).

This one will be closed.