Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
OpenCL and Darktable on AMD Hardware
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
FrancisGreaves
n00b
n00b


Joined: 31 Oct 2014
Posts: 67
Location: Ireland

PostPosted: Sun Jan 12, 2025 2:22 pm    Post subject: OpenCL and Darktable on AMD Hardware Reply with quote

I am trying to get OpenCL working with darktable.
I have an AMD Radeon RX 7800 XT with 16Gb memory
I have worked through the AMDGPU Wiki and tried both the Open Source option and the PRO option.
The latter fails, I cannot find the Ubuntu 20.04 drivers. I am not the only one, see this https://forums.gentoo.org/viewtopic-t-1171061-highlight-darktable.html and elsewhere.
So it is the Open Source option, fine.
I have built media-libs/mesa with the USE flag -opencl as recommended.
Here is the output of clinfo:
Code:

Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP.dbg (3590.0)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback
  Platform Extensions function suffix             AMD
  Platform Host timer resolution                  1ns

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     gfx1101
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 2.0
  Driver Version                                  3590.0 (HSA1.1,LC)
  Device OpenCL C Version                         OpenCL C 2.0
  Device Type                                     GPU
  Device Board Name (AMD)                         AMD Radeon RX 7800 XT
  Device PCI-e ID (AMD)                           0x747e
  Device Topology (AMD)                           PCI-E, 0000:07:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               30
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                32
  SIMD instruction width (AMD)                    1
  Max clock frequency                             2213MHz
  Graphics IP (AMD)                               11.0
  Device Partition                                (core)
    Max number of sub-devices                     30
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Preferred work group size (AMD)                 256
  Max work group size (AMD)                       1024
=== CL_PROGRAM_BUILD_LOG ===
opencl_lib.bc: error: Unknown attribute kind (91) (Producer: 'LLVM18.1.8' Reader: 'LLVM 17.0.6')
Error: Linking bitcode failed: linking source & IR libraries.
  Preferred work group size multiple (kernel)     <getWGsizes:1980: create kernel : error -6>
  Wavefront width (AMD)                           32
  Preferred / native vector sizes                 
    char                                                 4 / 4       
    short                                                2 / 2       
    int                                                  1 / 1       
    long                                                 1 / 1       
    half                                                 1 / 1        (cl_khr_fp16)
    float                                                1 / 1       
    double                                               1 / 1        (cl_khr_fp64)
  Half-precision Floating-point support           (cl_khr_fp16)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              17163091968 (15.98GiB)
  Global free memory (AMD)                        16541696 (15.78GiB) 16541696 (15.78GiB)
  Global memory channels (AMD)                    8
  Global memory banks per channel (AMD)           4
  Global memory bank width (AMD)                  256 bytes
  Error Correction support                        No
  Max memory allocation                           14588628168 (13.59GiB)
  Unified memory for Host and Device              No
  Shared Virtual Memory (SVM) capabilities        (core)
    Coarse-grained buffer sharing                 Yes
    Fine-grained buffer sharing                   Yes
    Fine-grained system sharing                   No
    Atomics                                       No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Preferred alignment for atomics                 
    SVM                                           0 bytes
    Global                                        0 bytes
    Local                                         0 bytes
  Max size for global variable                    14588628168 (13.59GiB)
  Preferred total size of global vars             17163091968 (15.98GiB)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        32768 (32KiB)
  Global Memory cache line size                   128 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            134217728 pixels
    Max 1D or 2D image array size                 8192 images
    Base address alignment for 2D image buffers   256 bytes
    Pitch alignment for 2D image buffers          256 pixels
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             16384x16384x8192 pixels
    Max number of read image args                 128
    Max number of write image args                8
    Max number of read/write image args           64
  Max number of pipe args                         16
  Max active pipe reservations                    16
  Max pipe packet size                            1703726280 (1.587GiB)
  Local memory type                               Local
  Local memory size                               65536 (64KiB)
  Local memory size per CU (AMD)                  65536 (64KiB)
  Local memory banks (AMD)                        32
  Max number of constant args                     8
  Max constant buffer size                        14588628168 (13.59GiB)
  Preferred constant buffer size (AMD)            16384 (16KiB)
  Max size of kernel argument                     1024
  Queue properties (on host)                     
    Out-of-order execution                        No
    Profiling                                     Yes
  Queue properties (on device)                   
    Out-of-order execution                        Yes
    Profiling                                     Yes
    Preferred size                                262144 (256KiB)
    Max size                                      8388608 (8MiB)
  Max queues on device                            1
  Max events on device                            1024
  Prefer user sync for interop                    Yes
  Number of P2P devices (AMD)                     0
  Profiling timer resolution                      1ns
  Profiling timer offset since Epoch (AMD)        0ns (Thu Jan  1 00:00:00 1970)
  Execution capabilities                         
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Thread trace supported (AMD)                  No
    Number of async queues (AMD)                  8
    Max real-time compute queues (AMD)            8
    Max real-time compute units (AMD)             30
  printf() buffer size                            4194304 (4MiB)
  Built-in kernels                                (n/a)
  Device Extensions                               cl_khr_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_media_ops cl_amd_media_ops2 cl_khr_image2d_from_buffer cl_khr_subgroups cl_khr_depth_images cl_amd_copy_buffer_p2p cl_amd_assembly_program

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
  clCreateContext(NULL, ...) [default]            No platform
  clCreateContext(NULL, ...) [other]              Success [AMD]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   gfx1101
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   gfx1101
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   gfx1101

ICD loader properties
  ICD loader Name                                 Khronos OpenCL ICD Loader
  ICD loader Vendor                               Khronos Group
  ICD loader Version                              3.0.6
  ICD loader Profile                              OpenCL 3.0

I am a bit concerned with this bit of the output:
Code:

opencl_lib.bc: error: Unknown attribute kind (91) (Producer: 'LLVM18.1.8' Reader: 'LLVM 17.0.6')
Error: Linking bitcode failed: linking source & IR libraries.
  Preferred work group size multiple (kernel)     <getWGsizes:1980: create kernel : error -6>

I am not sure why I get this error, or whether I should be doing about it.
I am not using Clang/LLVM to compile, just gcc.
I seem to have versions 17, 18 and 19 of them both installed.
Darktable Problem
For Darktable, I have tried the portage version which is 4.8.0 and the AppImage for version 5.0.0 and both fail enabling the OpenCL
The output from running for each version like this:
Code:
darktable -d opencl
is pretty identical:
Code:

darktable 4.8.0
Copyright (C) 2012-2024 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  Debug                  -> DISABLED
  SSE2 optimizations     -> ENABLED
  OpenMP                 -> ENABLED
  OpenCL                 -> ENABLED
  Lua                    -> DISABLED
  Colord                 -> ENABLED
  gPhoto2                -> DISABLED
  GMIC                   -> DISABLED - Compressed LUTs are NOT supported
  GraphicsMagick         -> ENABLED
  ImageMagick            -> DISABLED
  libavif                -> DISABLED
  libheif                -> DISABLED
  libjxl                 -> DISABLED
  OpenJPEG               -> DISABLED
  OpenEXR                -> ENABLED
  WebP                   -> DISABLED

See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.

    11.7846 [init] database version of `library.db' is too new for this build of darktable. aborting
    11.7849 ERROR : cannot open database
francis@scorpio ~ $ darktable -d  opencl
darktable 4.8.0
Copyright (C) 2012-2024 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  Debug                  -> DISABLED
  SSE2 optimizations     -> ENABLED
  OpenMP                 -> ENABLED
  OpenCL                 -> ENABLED
  Lua                    -> DISABLED
  Colord                 -> ENABLED
  gPhoto2                -> DISABLED
  GMIC                   -> DISABLED - Compressed LUTs are NOT supported
  GraphicsMagick         -> ENABLED
  ImageMagick            -> DISABLED
  libavif                -> DISABLED
  libheif                -> DISABLED
  libjxl                 -> DISABLED
  OpenJPEG               -> DISABLED
  OpenEXR                -> ENABLED
  WebP                   -> DISABLED

See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.

     0.0261 [dt_get_sysresource_level] switched to 1 as `default'
     0.0261   total mem:       64195MB
     0.0261   mipmap cache:    8024MB
     0.0261   available mem:   32097MB
     0.0261   singlebuff:      501MB
     0.0279 [opencl_init] opencl library 'libOpenCL' found on your system and loaded, preference 'default path'
     0.0673 [opencl_init] found 1 platform
[opencl_init] found 1 device

[dt_opencl_device_init]
   DEVICE:                   0: 'gfx1101', NEW
   CONF KEY:                 cldevice_v5_amdacceleratedparallelprocessinggfx1101
   PLATFORM, VENDOR & ID:    AMD Accelerated Parallel Processing, Advanced Micro Devices, Inc., ID=4098
   CANONICAL NAME:           amdacceleratedparallelprocessinggfx1101
   DRIVER VERSION:           3590.0 (HSA1.1,LC)
   DEVICE VERSION:           OpenCL 2.0
   DEVICE_TYPE:              GPU, dedicated mem
   GLOBAL MEM SIZE:          16368 MB
   MAX MEM ALLOC:            13913 MB
   MAX IMAGE SIZE:           16384 x 16384
   MAX WORK GROUP SIZE:      256
   MAX WORK ITEM DIMENSIONS: 3
   MAX WORK ITEM SIZES:      [ 1024 1024 1024 ]
   ASYNC PIXELPIPE:          NO
   PINNED MEMORY TRANSFER:   NO
   AVOID ATOMICS:            NO
   MICRO NAP:                250
   ROUNDUP WIDTH & HEIGHT    16x16
   CHECK EVENT HANDLES:      128
   TILING ADVANTAGE:         0.000
   DEFAULT DEVICE:           NO
   *** could not create command queue *** CL_OUT_OF_HOST_MEMORY
[opencl_init] no suitable devices found.
     0.0887 [opencl_init] FINALLY: opencl PREFERENCE=ON is NOT AVAILABLE and NOT ENABLED.

In Darktable itself in Settings -> Processing you cannot activate OpenCL Support, it is greyed out.
I did try and compile Darktabel 5, but despite having the OpenCL drivers in the correct place it would not find them.
Any ideas on how to fix this so OpenCL is found?
_________________
Perfect in every way, Modest and Misunderstood!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54691
Location: 56N 3W

PostPosted: Sun Jan 12, 2025 2:45 pm    Post subject: Reply with quote

FrancisGreaves,

Code:
opencl_lib.bc: error: Unknown attribute kind (91) (Producer: 'LLVM18.1.8' Reader: 'LLVM 17.0.6')
Error: Linking bitcode failed: linking source & IR libraries.


You are trying to use two incompatible version of LLVM. Portage won't spot that for you yet.

Whatever was built with LLVM 17.0.6 needs to be rebuilt with LLVM18.1.8.

You need to look at the build log to see what that something is.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
FrancisGreaves
n00b
n00b


Joined: 31 Oct 2014
Posts: 67
Location: Ireland

PostPosted: Sun Jan 12, 2025 2:56 pm    Post subject: Reply with quote

Many thanks @NeddySeagoon for your very swift response.

I will see what I can find and report back.
_________________
Perfect in every way, Modest and Misunderstood!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum