Bug 516875 - OpenCL not detected on AMD RADEON RX 470 card
Summary: OpenCL not detected on AMD RADEON RX 470 card
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Setup-Misc (other bugs)
Version First Reported In: 8.8.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-02-28 21:42 UTC by FrankNFurter
Modified: 2026-03-15 08:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 9.1.0
Sentry Crash Report:


Attachments
Python3 Test OpenCL (1.77 KB, text/x-python)
2026-03-04 20:33 UTC, FrankNFurter
Details
Output of clinfo (21.38 KB, text/plain)
2026-03-04 20:39 UTC, FrankNFurter
Details
Output of glxinfo (88.88 KB, text/plain)
2026-03-04 20:39 UTC, FrankNFurter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description FrankNFurter 2026-02-28 21:42:17 UTC
SUMMARY
On my Ubuntu 24.04 LTS client system with an AMD Radeon RX 470 card the "Test GPU AI Compatibility" in system settings fails

STEPS TO REPRODUCE
1. Install an AMD RADEON RX 470 on Asus Z170-A motherboard
2. Install and run Ubuntu 24.04 LTS
3. Download digiKam 8.8.0 AppImage
4. Download AMD Software and driver from https://www.amd.com/en/resources/support-articles/release-notes/RN-AMDGPU-UNIFIED-LINUX-25-35.html
5. Follow the AMD instructions and install software with the amdgpu-install script, i.e. amdgpu-install --usecase=rocm --no-dkms
6. add user to video and render group
7. Start digiKam on Wayland or X11
8. In digiKam open system settings and run the test

OBSERVED RESULT
Output of test is 
Starting OpenCV OpenCL DNN test...
Checking for OpenCL GPU acceleration compatibility with AI models...
Fehler: Auf Ihrem System steht OpenCL nicht zur Verfügung.

Test failed. Your system may not be able to use GPU acceleration for the AI models.

EXPECTED RESULT
Test should end with success and hardware acceleration should be enabled for auto tagging.


SOFTWARE/OS VERSIONS
Operating System: Ubuntu Studio 24.04
KDE Plasma Version: 5.27.12
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13
Kernel Version: 6.8.0-101-lowlatency (64-bit)
Graphics Platform: offscreen
Processors: 4 × Intel® Core™ i5-6400 CPU @ 2.70GHz
Memory: 15.6 GiB of RAM
Graphics Processor: AMD Radeon ™ RX 470 Graphics


ADDITIONAL INFORMATION

Motherboard/CPU has also an CPU graphik unit. I never used a graphik card on linux and habe less knowlede about. I'm not sure it i installed the right usecase of the amd software. The are a lot of usecases listed with the command "amdgpu-install --list-usecase".

When I start digiCam appimage in terminal window I also get
MESA-LOADER: failed to open radeonsi....
MESA-LOADER: failed to open zink...
MESA-LOADER: failed to open kms_swrast
MESA-LOADER: failed to open swrast

I left also a comment on Bug https://bugs.kde.org/show_bug.cgi?id=511487

eglinfo -B when runing without sudo prints an error message:
GBM platform:
_amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
amdgpu: amdgpu_device_initialize failed.
_amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
amdgpu: amdgpu_device_initialize failed.

when run as sudo no error. But this seem to be off topic. See here: https://bbs.archlinux.org/viewtopic.php?id=304742

running the amd installer script without --no-dkms installs kernel driver but then logging in to wayland fails/stops. So I deinstalled and installed leaving the original kernel drivers untouched.
Comment 1 caulier.gilles 2026-02-28 21:55:13 UTC
Before to run the OPenCL compatibility test in digiKam, you need to setup a env. variable for OPenCV to handle your GPU:

export OPENCV_OPENCL_DEVICE=AMD:GPU:0

https://answers.opencv.org/question/185514/opencl-can-not-detect-my-amd-gpu-using-opencv/
https://docs.opencv.org/4.x/d6/dea/tutorial_env_reference.html#autotoc_md997
Comment 2 FrankNFurter 2026-02-28 23:00:38 UTC
(In reply to caulier.gilles from comment #1)
> Before to run the OPenCL compatibility test in digiKam, you need to setup a
> env. variable for OPenCV to handle your GPU:
> 
> export OPENCV_OPENCL_DEVICE=AMD:GPU:0
> 
> https://answers.opencv.org/question/185514/opencl-can-not-detect-my-amd-gpu-
> using-opencv/
> https://docs.opencv.org/4.x/d6/dea/tutorial_env_reference.html#autotoc_md997
Dear Gilles,

i tried in a terminal and started appimage within after exporting the variable. It still doesn't work. I also tired with export OPENCV_OPENCL_DEVICE=AMD:GPU:1, because I have seen some bugs about wrong numeration of GPU but this does not work either.
Comment 3 FrankNFurter 2026-03-01 21:38:22 UTC
Hi,

I did some further steps trying to fix it myself. So with Synaptic I installed some further packages, that I thought might be helpful. Here is the list (some of them automatic added as dependency)
libegl1-amdgpu-mesa (1:26.0.0.70200-2278374.22.04)
libegl1-amdgpu-mesa-drivers (1:26.0.0.70200-2278374.22.04)
libgbm1-amdgpu (1:26.0.0.70200-2278374.22.04)
libgl1-amdgpu-mesa-dri (1:26.0.0.70200-2278374.22.04)
libgl1-amdgpu-mesa-glx (1:26.0.0.70200-2278374.22.04)
libllvm20.1-amdgpu (1:20.1.70200-2278374.22.04)
libwayland-amdgpu-client0 (1.24.0.70200-2278374.22.04)
libwayland-amdgpu-server0 (1.24.0.70200-2278374.22.04)
mesa-amdgpu-libgallium (1:26.0.0.70200-2278374.22.04)
mesa-amdgpu-va-drivers (1:26.0.0.70200-2278374.22.04)
libclang-common-20-dev (1:20.1.2-0ubuntu1~24.04.2)
libclang-cpp20 (1:20.1.2-0ubuntu1~24.04.2)
libclang-rt-20-dev (1:20.1.2-0ubuntu1~24.04.2)
libclc-20 (1:20.1.2-0ubuntu1~24.04.2)
libclc-20-dev (1:20.1.2-0ubuntu1~24.04.2)
libllvmspirvlib20.1 (20.1.0-1~ubuntu1~24.04.1)
mesa-opencl-icd (25.2.8-0ubuntu0.24.04.1)
radeontop (1.4-2)

Then, in a new terminal, I exported the OPENCV_OPENCL_DEVICE variable again. Then started digiKam AppImage. When hitting the button to test KI feature under system setting, in terminal a message was printed out, the the device AMD.GPU.0 could not be found.
So I closed app and terminal and started a fresh terminal window again. I just startet AppImage again without setting the variable. And now the AI test was successful. :-)
So, could you tell, which of these packages fixed the problem?
Comment 4 caulier.gilles 2026-03-02 06:34:24 UTC
Hi,

The key package that enabled OpenCL support for the AMD RADEON RX 470 is mesa-opencl-icd (version 25.2.8-0ubuntu0.24.04.1). This package provides the OpenCL ICD (Installable Client Driver) loader for the open-source AMD GPU stack, allowing applications like digiKam to detect and use the GPU for OpenCL acceleration.
To confirm, you can run:
bash
Copy

clinfo | grep "Device Name"

This should now list your AMD GPU as an available OpenCL device.

Gilles Caulier
Comment 5 FrankNFurter 2026-03-02 09:32:09 UTC
Dear Gilles,

thanks. I will do these further test later today. But I have something new to report. Yesterday I had not looked at the details of the test. So the test was successful in the way that it did dedect the OpenCL capabilities of the hardware. But the test get stuck at the point "Preparing face for feature extraction". I do not know how long this on an Radeon card normally would take, but after I while I closed the window leaving the test unsuccessful. So to me it seems that there is sitll something missing.

And of course, I even do not know how radeontop should look like, when the card is doing hard work. :-) I only know how I am looking like, when I do hard work ;-)
Comment 6 caulier.gilles 2026-03-02 09:48:10 UTC
On my Linux NVIDIA computer or on my Macbook Pro M1, the test time less than one second.

Notes : 

- Mac do not require any extra install as the system hardware from Apple is well integrated.
- Linux NVidia requires proprietary linux modules and extra package named CUDA + cuDNN.

Gilles Caulier
Comment 7 FrankNFurter 2026-03-02 11:01:59 UTC
CUDA, afaik, is nothing you have for AMD. I guess there is much more documentation to read and things to test. Maybe this documentation helps to unterstand: https://wiki.archlinux.org/title/General-purpose_computing_on_graphics_processing_units
So could be, that I have to call amdgpu-install script with different parameters and still it might me, that some more AMD or Radeon packages are missing.
Gilles, could you guide me to the Source code of digiKam, where the AI test is implemented? So I can do further studies.
Comment 8 caulier.gilles 2026-03-02 12:05:13 UTC
From the dialog, the test is started in this slot when the button is pressed :

https://invent.kde.org/graphics/digikam/-/blob/master/core/utilities/setup/misc/ocvocldnntestdlg.cpp?ref_type=heads#L139

It run this method in a separated thread :

https://invent.kde.org/graphics/digikam/-/blob/master/core/utilities/setup/misc/ocvocldnntestdlg.cpp?ref_type=heads#L247

These methods are used from OpenCV API to check OpenCL and GPU availability:

cv::ocl::haveOpenCL() : https://docs.opencv.org/4.x/dc/d83/group__core__opencl.html#gaf8716694664cb127e7928c335b97d217
cv::ocl::Device::getDefault() : https://docs.opencv.org/4.x/d7/d9f/classcv_1_1ocl_1_1Device.html#ae539c774ca7c37a8fde069e96aa11139

If it's pass, a test image is loaded (DNNTestImage) and a simple face detection is done to see if it works using YuNet DNN model. In a second stage the faces are extracted and aligned using SFace DNN model.

Files relevant :

YuNet : https://files.kde.org/digikam/facesengine/yunet/face_detection_yunet_2023mar.onnx
Test Image : https://www-ftp.lip6.fr/pub/X11/kde-applicationdata/digikam/facesengine/dnntestimage.jpeg
SFace : https://files.kde.org/digikam/facesengine/dnnface/face_recognition_sface_2021dec.onnx

Best regards

Gilles Caulier
Comment 9 FrankNFurter 2026-03-02 19:56:26 UTC
So here is the output of clinfo | grep "Device Name"
  Device Name                                     AMD Radeon (TM) RX 470 Graphics (radeonsi, polaris10, ACO, DRM 3.57, 6.8.0-101-lowlatency)
    Device Name                                   AMD Radeon (TM) RX 470 Graphics (radeonsi, polaris10, ACO, DRM 3.57, 6.8.0-101-lowlatency)
    Device Name                                   AMD Radeon (TM) RX 470 Graphics (radeonsi, polaris10, ACO, DRM 3.57, 6.8.0-101-lowlatency)
    Device Name                                   AMD Radeon (TM) RX 470 Graphics (radeonsi, polaris10, ACO, DRM 3.57, 6.8.0-101-lowlatency)

Also: When started in a terminal, when pressing the button the following error is shown in terminal:
"Error on line 2772 (ocl.cpp): clSVMAlloc returned NULL..."
And if you hit the button again and close the GUI afterwards, digiKam does not end. It hangs in the background and two processes are still alive.
I did also a STRACE but it crashes. I guess the problem is in the underlying OpenCV API, but have no time to find out. Mmmh. Any idea. A smaller program to test OpenCV with detailed logging would be great. Does anybody have one?
Comment 10 FrankNFurter 2026-03-04 20:33:31 UTC
Created attachment 190359 [details]
Python3 Test OpenCL

Script mainly designed by AI. Removed AMD spezifica.
Comment 11 FrankNFurter 2026-03-04 20:39:18 UTC
Created attachment 190360 [details]
Output of clinfo
Comment 12 FrankNFurter 2026-03-04 20:39:49 UTC
Created attachment 190361 [details]
Output of glxinfo
Comment 13 FrankNFurter 2026-03-04 20:56:02 UTC
I'm still very unhappy about that. I filed some more info and a python testfile I used. Output of the testfile is:
---------------------------------------
Found OpenCL plattforms:
0: rusticl - Mesa/X.org
Used Plattform: rusticl
Found devices:
0: AMD Radeon RX 470 Graphics (radeonsi, polaris10, ACO, DRM 3.57, 6.8.0-101-lowlatency) - ALL | GPU
OpenCL kernel successfull! GPU is functional.
--------------------------------------

Before this I tested a lot of different installations and version of amdgpu one can find at AMD website. I tested some of the usecases of amdgpu-install script but nothing will work. Without the -no-dkms switch the kernel module is build by the amdgpu-install script and after reboot even the screen stays black. So I have to uninstall them in recovery mode. I had some variants with amdgpu-install where Wayland login hangs but X11 works. :-( 
So I did not install these amdgpu things at the moment and my python test I did without amdgpu driver. 

I also installed phoronix-test-suite and run the gputest benchmark while watching radeontop. So I could see that the gpu was doing hard work. 

In digiKam, the OpenCL testoutput hangs where the line ' Q_EMIT signalNotification(i18n("Preparing face for feature extraction..."));' ends. This is the last message. The thread hangs. Because I am not able to debug I could not tell where exactly. There is no output in kernel log or journalctl -f . 

Any further support?
Comment 14 FrankNFurter 2026-03-14 12:47:26 UTC
After several attempts to get it running, I have given up. In my opinion, the problem is that Ubuntu 24.04 is "too new" for the Radeon driver version that supports OpenCV. I found a compatibility matrix that might be worth checking out:
https://rocm.docs.amd.com/projects/radeon-ryzen/en/latest/docs/compatibility/compatibilityrad/native_linux/native_linux_compatibility.html

The main issue for me was often the poor documentation—not of digiKam, but of amdgpu-install. The installation frequently left the system broken after a reboot, forcing me to uninstall and reinstall the drivers multiple times to get my system working again. Last but not least, I bought another graphics card (NVIDIA) and was able to get it running with that. I am now running:
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 580.126.09
on Ubuntu  24.04.4 (glxinfo)

One last thing: Could you please clarify in the digiKam documentation whether the environment variable OPENCV_OPENCL_DEVICE needs to be set on Linux systems? In my case, I did not set it and it works with NVIDIA, but not with AMD. For AMD, I had to set it to :GPU:0 for the test to detect the card (though it still didn’t work properly).

You can close this thread now. Thanks for your help anyway.
Comment 15 caulier.gilles 2026-03-15 08:51:47 UTC
Git commit 6da24218e5f745e77bcab5b0f19ad665e50f2f7b by Gilles Caulier.
Committed on 15/03/2026 at 08:50.
Pushed by cgilles into branch 'master'.

Update instructions for the OpenCL setup for the DNN support
FIXED-IN: 9.1.0

M  +4    -4    setup_application/miscs_settings.rst

https://invent.kde.org/documentation/digikam-doc/-/commit/6da24218e5f745e77bcab5b0f19ad665e50f2f7b