OpenCL ICD does not find radeon GPU

I have two GPUs in my laptop: integrated Radeon GPU, and discrete NVIDIA GPU, as shown by inxi:

$ inxi -G
  Device-1: NVIDIA GA106M [GeForce RTX 3060 Mobile / Max-Q] driver: nvidia
    v: 535.86.05
  Device-2: AMD Cezanne [Radeon Vega Series / Radeon Mobile Series]
    driver: amdgpu v: kernel
  Device-3: Quanta HD User Facing type: USB driver: uvcvideo
  Display: x11 server: X.Org v: with: Xwayland v: 22.1.8 driver: X:
    loaded: amdgpu,nvidia unloaded: fbdev,modesetting,nouveau,radeon,vesa
    dri: radeonsi gpu: amdgpu resolution: 1920x1080~144Hz
  API: OpenGL v: 4.6 Mesa 23.0.4-0ubuntu1~23.04.1 renderer: AMD Radeon
    Graphics (renoir LLVM 15.0.7 DRM 3.49 6.2.0-32-generic)

But if I ask clinfo to list the OpenCL drivers, it will only find one for the NVIDIA, and not one for the Radeon.

$ clinfo -l
Platform #0: NVIDIA CUDA
 `-- Device #0: NVIDIA GeForce RTX 3060 Laptop GPU

What do I need to do to make the Radeon usable for OpenCL?

I am running Ubuntu 23.04 and X11.

DRM info:

$ drm_info | grep Driver
├───Driver: amdgpu (AMD GPU) version 3.49.0 (20150101)
├───Driver: nvidia-drm (NVIDIA DRM driver) version 0.0.0 (20160202)
Asked By: Bram


After $ sudo apt install mesa-opencl-icd I now see more OpenCL platforms.

$ clinfo -l
Platform #0: NVIDIA CUDA
 `-- Device #0: NVIDIA GeForce RTX 3060 Laptop GPU
Platform #1: Clover
 `-- Device #0: AMD Radeon Graphics (renoir, LLVM 15.0.7, DRM 3.49, 6.2.0-32-generic)
Platform #2: rusticl

Unfortunately, using the radeon opencl platform yields an error.

cannot open file '/usr/lib/clc/gfx909-amdgcn-mesa-mesa3d.bc': No such file or directory

So even though there is now an ICD for the radeon GPU, it is bugged and not usable.

Answered By: Bram
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.