AMD OpenCL Ubuntu 22.04 not working with Darktable

I have another question regarding the different behavior of the 2 main brand gpu’s on darktable:

  1. GPU optimization
  2. Performance
    3.Stability

Witch do you recommend?
I already own an AMD r390x 8gb, and i know that vram is king in this kind of work-tasks.
Looking to invest in a more recent gpu to optimize performance. Even if i was happy with the r390x, WHEN opencl worked! Darktable without opencl is really slow, after a few modules exporting takes about 5 to 10mns!

(I know that AMD has a problem with local contrast calculations)
Thanks for your advice.

nVidia never gets flack for how it works. The only flack is that their driver is closed source.

I have a gtx 1050 4gb and it makes darktable very usable on my aging Haswell desktop.

2 Likes

Does it still with diffuse and sharpen? Never had any issue

“This is the first time photopanda has posted — let’s welcome them to our community!”

This is a lie! :wink:

Aurelien Pierre did mention that AMD gpu’s had a problem with local contrast modules, at what level i cannot say.

Please don’t ask me the reason but this works 100%. (There are few errors at installation time!)
Driver = amdgpu-install_22.20.50203-1_all.deb

amdgpu-install --usecase=graphics --opencl=legacy --accept-eula --no-32

for my rx-570 on Ubuntu Ubuntu 22.04.1 LTS
kernel 5.15.0-53-generic

2 Likes

useful link
AMD Available drivers

Ubuntu recently upgraded the kernel and the previous version amdgpu-install_22.20.50203-1_all.deb was giving dkms error but was working. But there is a newer version at 22.20.4 in the above link which installs properly without any errors
for Ubuntu 22.04 the link amdgpu-install_22.20.50204-1_all.deb
If you follow the above link you can find drivers for bionic & focal too.
I thought this information will be useful to many users.

1 Like

Unfortunately for me it still gives errors related to rocm packages and unmet dependencies.
Going to retry this method.

Your R9 390 is an old card and ROCm is not available, so openCL=legacy, use the command

amdgpu-install --usecase=graphics --opencl=legacy --accept-eula --no-32

But before this first uninstall the driver

amdgpu-install --uninstall
dpkg -r amdgpu-install
dpkg --purge amdgpu-install

then
Repair Ubuntu

then install the latest driver .deb file linked in previous post. Then install the driver with the command given above. IMHO you have tried many things and some how disturbed something.

In my case I have followed the above steps and now my system is stable and everything works.

1 Like

Still no luck.

The following additional packages will be installed:
amdgpu-core amdgpu-dkms-firmware amdgpu-pro-core gst-omx-amdgpu libdrm-amdgpu-amdgpu1 libdrm-amdgpu-common libdrm-amdgpu-radeon1 libdrm2-amdgpu libegl1-amdgpu-mesa
libegl1-amdgpu-mesa-drivers libgbm1-amdgpu libgl1-amdgpu-mesa-dri libgl1-amdgpu-mesa-glx libglapi-amdgpu-mesa libllvm14.0.50204-amdgpu libwayland-amdgpu-client0
libwayland-amdgpu-egl1 libwayland-amdgpu-server0 libxatracker2-amdgpu mesa-amdgpu-omx-drivers mesa-amdgpu-va-drivers mesa-amdgpu-vdpau-drivers ocl-icd-libopencl1-amdgpu-pro
xserver-xorg-amdgpu-video-amdgpu
Recommended packages:
libtxc-dxtn-s2tc0 | libtxc-dxtn0
E: Can’t find a source to download version ‘1.0.0.1-1271047’ of ‘gst-omx-amdgpu:amd64’

After resolving all dependencies problems amdgpu-dkms now impedes installation of the amdgpu driver.

did you follow the instructions in my previous post? which driver version you are trying to install?can you give me some more detail about your system? what do you mean by
After resolving all dependencies problems amdgpu-dkms now impedes installation of the amdgpu driver

Yes, after uninstalling the driver, sorting out the repositories and reinstalling the latest repo for amdgpu, amdgpu-dkms exits with error 10.

I had / I am having the same issues. I suppose it’s related to the kernel version you have installed on your system. I am on 5.17.x and amdgpu-kdms cannot be installed with that kernel version. I am still hoping that kernel 6.1 with Rust support will be available soon so one can try to install the rusticl drivers. Unfortunately 6.0 doesn’t support Rust yet.

I do not have dkms error at install but at the time when I am upgrading softwares, but the driver works and openCL also works in Darktable

Cannot directly help on your issue since I’m using arch linux but you don’t really need any additional kernel module, the kernel vanilla amdgpu module is enough. You only need the amd rocm opencl user space part.

Rusticl is a new mesa rust based user space opencl implementation that could/will replace the current opencl mesa implementation (clover). It’s completely unrelated to the linux kernel support for rust and will work also with current kernels.

1 Like

My observations and solution. In my case I was able to install 22.20.50204-1 driver and everything was working except when I would tired to upgrade software with apt upgrade it will try to rebuild the driver driver (dkms) and give errors. So as suggested in the error report I examined the make.log file which is as follows

DKMS make.log for amdgpu-5.16.9.22.20-1462318~22.04 for kernel 5.15.0-53-generic (x86_64)
Sunday 20 November 2022 11:45:26 AM IST
make: Entering directory ‘/usr/src/linux-headers-5.15.0-53-generic’
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
You are using: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
/var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/Makefile:26: “Local GCC version 110303 does not match kernel compiler GCC version 110200”
/var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/Makefile:27: “This may cause unexpected and hard-to-isolate compiler-related issues”
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/drm_gem_ttm_helper.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/scheduler/sched_main.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/scheduler/sched_fence.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/scheduler/sched_entity.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_tt.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_bo.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_bo_util.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/main.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_bo_vm.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/symbols.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_module.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_drv.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_execbuf_util.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_common.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_range_manager.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_kernel_params.o
LD [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amddrm_ttm_helper.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_resource.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_pool.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/dma-buf/dma-resv.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_device.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_sys_manager.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_agp_backend.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_backlight.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_ioctl.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_device.o
/var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_device.c:28: warning: “pr_fmt” redefined
28 | #define pr_fmt(fmt) "[TTM DEVICE] " fmt
|
In file included from ./include/linux/kernel.h:19,
from ./include/linux/list.h:9,
from ./include/linux/preempt.h:11,
from ./include/linux/spinlock.h:55,
from ./include/linux/kref.h:16,
from /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/include/kcl/kcl_kref.h:15,
from /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/backport/backport.h:6,
from :
./include/linux/printk.h:340: note: this is the location of the previous definition
340 | #define pr_fmt(fmt) fmt
|
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_kms.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_atombios.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_kthread.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_io.o
LD [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/scheduler/amd-sched.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/atombios_crtc.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_perf_event.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_seq_file.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_suspend.o
/var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/ttm_device.c:28: warning: “pr_fmt” redefined
28 | #define pr_fmt(fmt) "[TTM DEVICE] " fmt
|
In file included from ./include/linux/kernel.h:19,
from ./include/linux/list.h:9,
from ./include/linux/preempt.h:11,
from ./include/linux/spinlock.h:55,
from ./include/linux/kref.h:16,
from /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/include/kcl/kcl_kref.h:15,
from /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/backport/backport.h:6,
from :
./include/linux/printk.h:340: note: this is the location of the previous definition
340 | #define pr_fmt(fmt) fmt
|
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_pci.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_mm.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_memory.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_sched.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_fence.o
LD [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/ttm/amdttm.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_fence_array.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_reservation.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_cache.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_auth.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_fb.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_print.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_fbmem.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_crtc.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_connector.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_atomic_helper.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_device_cgroup.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_connectors.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/atom.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_mn.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_fence.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_modes.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_time.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_ftrace.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_acpi_table.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_page_alloc.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_numa.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_fs_read_write.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_aperture.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_drv.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_simple_kms_helper.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_bitmap.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_ttm.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_vmscan.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_dma_fence_chain.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_mce_amd.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_drm_hdcp.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_debugfs_inode.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/kcl_sysfs_emit.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_object.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_gart.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_encoders.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_display.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_i2c.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_fb.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_gem.o
LD [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdkcl/amdkcl.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_ring.o
CC [M] /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_cs.o
/var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_ttm.c: In function ‘amdgpu_ssg_init’:
/var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_ttm.c:2313:31: error: incompatible types when assigning to type ‘struct percpu_ref’ from type ‘struct percpu_ref *’
2313 | adev->ssg.pgmap.ref = &adev->ssg.ref;
| ^
make[2]: *** [scripts/Makefile.build:297: /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu/amdgpu_ttm.o] Error 1
make[2]: *** Waiting for unfinished jobs…
make[1]: *** [scripts/Makefile.build:560: /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build/amd/amdgpu] Error 2
make: *** [Makefile:1903: /var/lib/dkms/amdgpu/5.16.9.22.20-1462318~22.04/build] Error 2
make: Leaving directory ‘/usr/src/linux-headers-5.15.0-53-generic’

I saw that the mismatch of gcc version was a warning and Not an error, the actual error was in amdgpu_ttm.c at line 2313. I searched for this file and found 2 such file on my system, I removed the “&” from “&adev->ssg.ref” line from both files . Now when I gave the apt upgrade command it properly build the amd dkms and now there are no errors.

Please refer to my earlier posts for information about my Ubuntu, kernel and driver version.
Hope it helps someone.

1 Like

Finally I got opencl working with the integrated gpu of my Ryzen 9 5900hx processor using the mesa rusticl driver. Darktable now recognizes 2 GPUs (nVidia and AMD):

[opencl_init] OpenCL successfully initialized.
[opencl_init] here are the internal numbers and names of OpenCL devices available to darktable:
[opencl_init]		0	'AMD Radeon Graphics (renoir, LLVM 12.0.1, DRM 3.48, 6.0.0-1007-oem)'
[opencl_init]		1	'NVIDIA GeForce RTX 3060 Laptop GPU'
[opencl_init] FINALLY: opencl is AVAILABLE on this system.

Unfortunately I do have issues with black images shown now …

1 Like

Can you please give more information on downloading/installing/using the mesa rusticl driver.

After making the changes that you mentioned amdgpu-dkms installed but opencl is still not available.

[dt_get_sysresource_level] switched to 2 as `large’
total mem: 32003MB
mipmap cache: 4000MB
available mem: 21877MB
singlebuff: 500MB
OpenCL tune mem: WANTED
OpenCL pinned: WANTED
[opencl_init] opencl related configuration options:
[opencl_init] opencl: ON
[opencl_init] opencl_scheduling_profile: ‘very fast GPU’
[opencl_init] opencl_library: ‘default path’
[opencl_init] opencl_device_priority: ‘/!0,//
[opencl_init] opencl_mandatory_timeout: 400
[opencl_init] opencl_synch_cache: active module
[opencl_init] opencl library ‘libOpenCL’ found on your system and loaded
[opencl_init] found 2 platforms
[opencl_init] no devices found for Advanced Micro Devices, Inc. (vendor) - AMD Accelerated Parallel Processing (name)
[opencl_init] found 1 device

[dt_opencl_device_init]
DEVICE: 0: ‘AMD Radeon ™ R9 390 Series (hawaii, LLVM 13.0.1, DRM 3.46, 5.15.0-57-generic)’
CANONICAL NAME: amdradeontmr9390serieshawaiillvm1301drm346515057generic
PLATFORM NAME & VENDOR: Clover, Mesa
DRIVER VERSION: 22.0.5
DEVICE VERSION: OpenCL 1.1 Mesa 22.0.5
DEVICE_TYPE: GPU
*** The OpenCL driver doesn’t provide image support. See also ‘clinfo’ output ***
[opencl_init] no suitable devices found.
[opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
[opencl_init] initial status of opencl enabled flag is OFF.
[imageio_load_module_format] failed to open `avif’: (null)