OpenCL with the open-source amdgpu kernel module

2023.05.02. Tested with Ubuntu 22.10 and Debian 12 Bookworm.

Visit > ROCm Release Documentation > Installation guide. Download and install amdgpu-install.x.y.z.deb. This will 1) configure additional deb repositories; 2) install amdgpu-install script.

Install ROCm OpenCL support from the newly added repositories:

    apt install rocm-opencl-runtime
This will pull some additional packages.
Alternatively, the same can be achieved by running:
    amdgpu-install --no-dkms --usecase=opencl

NB: Repositories can also be added manually, see Package Manager Method in Installation guide.

NB: Installing amdgpu-dkms package will attempt to compile amdgpu kernel module from source in AMD repository. Most likely this will only work with specific kernel versions.


To install OpenCL part from AMDGPU-PRO, run:

    ./amdgpu-install --opencl=legacy --headless --no-dkms

Last tested with:

* As of AMDGPU-PRO 20.45-1188099-ubuntu-20.04 (and perhaps earlier), amdgpu-install does not honor --no-dkms option when run with --opencl=rocr, i.e. amdgpu-dkms is intalled and kernel module amdgpu.ko is compiled, replacing the one from Linux kernel tree.
* amdgpu-install may complain that it can't install, because this is not Ubuntu version expected. Edit /etc/os-release and replace Ubuntu version with what installer wants. After amdgpu-install completes /etc/os-release may be changed back.
* In Ubuntu 20.04 /dev/kfd is owned by root.render, not by Add user intended to use OpenCL to render group.

‘amdgpu’ is an open source Linux kernel module for AMD graphics. It is available in stock kernels starting with Linux 4.2. OpenCL support can be added by installing libraries from binary AMDGPU-PRO driver download, provided by AMD. AMDGPU-PRO itself only works with certain distributions/releases/kernel versions.

Check `lsmod` and /var/log/Xorg.log that you have amdgpu loaded and working.

Download AMDGPU-PRO package for your Linux distribution from

`tar -xvf ...` to upack the downloaded file and run:

    amdgpu-pro-install --compute    (see Update above)
which is for “compute only”, i.e. it will install only the following:

Run clinfo to check OpenCL support.
Or run darktable-cltest :)