OpenCL stopped working after update

I updated today, and after I rebooted, OpenCL stopped working:

ggml_opencl: kernel compile error:
fatal error: cannot open file '/usr/share/clc/gfx1010-amdgcn-mesa-mesa3d.bc': No such file or directory

This happens with two different programs that use OpenCL.

The file is indeed not there, however there are other files instead:

$ ls /usr/share/clc/
amdgcn--amdhsa.bc              gfx906-amdgcn-mesa-mesa3d.bc   pitcairn-amdgcn--.bc
aruba-r600--.bc                hainan-amdgcn--.bc             pitcairn-amdgcn-mesa-mesa3d.bc
barts-r600--.bc                hainan-amdgcn-mesa-mesa3d.bc   polaris10-amdgcn--.bc
bonaire-amdgcn--.bc            hawaii-amdgcn--.bc             polaris10-amdgcn-mesa-mesa3d.bc
bonaire-amdgcn-mesa-mesa3d.bc  hawaii-amdgcn-mesa-mesa3d.bc   polaris11-amdgcn--.bc
caicos-r600--.bc               hemlock-r600--.bc              polaris11-amdgcn-mesa-mesa3d.bc
carrizo-amdgcn--.bc            iceland-amdgcn--.bc            redwood-r600--.bc
carrizo-amdgcn-mesa-mesa3d.bc  iceland-amdgcn-mesa-mesa3d.bc  spirv64-mesa3d-.spv
cayman-r600--.bc               juniper-r600--.bc              spirv-mesa3d-.spv
cedar-r600--.bc                kabini-amdgcn--.bc             stoney-amdgcn--.bc
clspv64--.bc                   kabini-amdgcn-mesa-mesa3d.bc   stoney-amdgcn-mesa-mesa3d.bc
clspv--.bc                     kaveri-amdgcn--.bc             sumo2-r600--.bc
cypress-r600--.bc              kaveri-amdgcn-mesa-mesa3d.bc   sumo-r600--.bc
fiji-amdgcn--.bc               mullins-amdgcn--.bc            tahiti-amdgcn--.bc
fiji-amdgcn-mesa-mesa3d.bc     mullins-amdgcn-mesa-mesa3d.bc  tahiti-amdgcn-mesa-mesa3d.bc
gfx900-amdgcn--.bc             nvptx64--.bc                   tonga-amdgcn--.bc
gfx900-amdgcn-mesa-mesa3d.bc   nvptx64--nvidiacl.bc           tonga-amdgcn-mesa-mesa3d.bc
gfx902-amdgcn--.bc             nvptx--.bc                     turks-r600--.bc
gfx902-amdgcn-mesa-mesa3d.bc   nvptx--nvidiacl.bc             verde-amdgcn--.bc
gfx904-amdgcn--.bc             oland-amdgcn--.bc              verde-amdgcn-mesa-mesa3d.bc
gfx904-amdgcn-mesa-mesa3d.bc   oland-amdgcn-mesa-mesa3d.bc
gfx906-amdgcn--.bc             palm-r600--.bc

I looked into a snapshot from before the update (when it was working), and the file is not there, either. So it does not seem to be necessary.

I have an RX 5700XT. I already updated clblast, and recompiled the programs that use OpenCL after the update.

$ paru -Ss opencl | grep -i installed
extra/clinfo 3.0.21.02.21-1 [50.70KiB 141.72KiB] [Installed]
extra/libclc 15.0.7-1 [8.20MiB 79.45MiB] [Installed]
extra/ocl-icd 2.3.2-1 [84.88KiB 459.23KiB] [Installed]
extra/opencl-headers 2:2023.04.17-2 [0B 376.39KiB] [Installed]
extra/rocm-clang-ocl 5.6.0-1 [0B 6.65KiB] [Installed]
extra/rocm-opencl-runtime 5.6.0-1 [0B 2.69MiB] [Installed]
extra/rocm-opencl-sdk 5.6.0-1 [0B 0B] [Installed]
multilib/lib32-ocl-icd 2.3.2-1 [40.12KiB 215.97KiB] [Installed]
multilib/lib32-opencl-mesa 23.1.3-1 [8.36MiB 69.11MiB] [Installed]
aur/clblast-git 1.5.2.30.g4500a034-2 [+3 ~0.43] [Installed: 1.6.1-1]

Any idea what could be the issue? When I look online, I only find things about using the proprietary AMD drivers. This is old information, since I was definitely able to run it without them.

$ clinfo
clinfo
Number of platforms                               3
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 23.1.3
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   rusticl
  Platform Vendor                                 Mesa/X.org
  Platform Version                                OpenCL 3.0
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_khr_il_program
  Platform Extensions with Version                cl_khr_icd                                                       0x400000 (1.0.0)
                                                  cl_khr_il_program                                                0x400000 (1.0.0)
  Platform Numeric Version                        0xc00000 (3.0.0)
  Platform Extensions function suffix             MESA
  Platform Host timer resolution                  0ns

  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP.dbg (3570.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                                   Clover
Number of devices                                 1
  Device Name                                     AMD Radeon RX 5700 XT (navi10, LLVM 15.0.7, DRM 3.52, 6.4.3-273-tkg-pds-llvm)
  Device Vendor                                   AMD
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.1 Mesa 23.1.3
  Device Numeric Version                          0x401000 (1.1.0)
  Driver Version                                  23.1.3
  Device OpenCL C Version                         OpenCL C 1.1
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Max compute units                               40
  Max clock frequency                             2100MHz
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
=== CL_PROGRAM_BUILD_LOG ===
fatal error: cannot open file '/usr/share/clc/gfx1010-amdgcn-mesa-mesa3d.bc': No such file or directory
  Preferred work group size multiple (kernel)     <getWGsizes:1504: create kernel : error -46>
  Preferred / native vector sizes
    char                                                16 / 16
    short                                                8 / 8
    int                                                  4 / 4
    long                                                 2 / 2
    half                                                 0 / 0        (n/a)
    float                                                4 / 4
    double                                               2 / 2        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  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                              8589934592 (8GiB)
  Error Correction support                        No
  Max memory allocation                           2147483648 (2GiB)
  Unified memory for Host and Device              No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       32768 bits (4096 bytes)
  Global Memory cache type                        None
  Image support                                   No
  Local memory type                               Local
  Local memory size                               65536 (64KiB)
  Max number of constant args                     16
  Max constant buffer size                        67108864 (64MiB)
  Max size of kernel argument                     1024
  Queue properties
    Out-of-order execution                        No
    Profiling                                     Yes
  Profiling timer resolution                      0ns
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    ILs with version                              SPIR-V                                                           0x400000 (1.0.0)
  Built-in kernels with version                   (n/a)
  Device Extensions                               cl_khr_byte_addressable_store 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_fp64 cl_khr_extended_versioning
  Device Extensions with Version                  cl_khr_byte_addressable_store                                    0x400000 (1.0.0)
                                                  cl_khr_global_int32_base_atomics                                 0x400000 (1.0.0)
                                                  cl_khr_global_int32_extended_atomics                             0x400000 (1.0.0)
                                                  cl_khr_local_int32_base_atomics                                  0x400000 (1.0.0)
                                                  cl_khr_local_int32_extended_atomics                              0x400000 (1.0.0)
                                                  cl_khr_int64_base_atomics                                        0x400000 (1.0.0)
                                                  cl_khr_int64_extended_atomics                                    0x400000 (1.0.0)
                                                  cl_khr_fp64                                                      0x400000 (1.0.0)
                                                  cl_khr_extended_versioning                                       0x400000 (1.0.0)

  Platform Name                                   rusticl
Number of devices                                 0

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     gfx1010:xnack-
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 2.0
  Driver Version                                  3570.0 (HSA1.1,LC)
  Device OpenCL C Version                         OpenCL C 2.0
  Device Type                                     GPU
  Device Board Name (AMD)                         AMD Radeon RX 5700 XT
  Device PCI-e ID (AMD)                           0x731f
  Device Topology (AMD)                           PCI-E, 0000:2d:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               20
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                32
  SIMD instruction width (AMD)                    1
  Max clock frequency                             2100MHz
  Graphics IP (AMD)                               10.1
  Device Partition                                (core)
    Max number of sub-devices                     20
    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
  Preferred work group size multiple (kernel)     32
  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                                     No
    Infinity and NANs                             No
    Round to nearest                              No
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    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                              8573157376 (7.984GiB)
  Global free memory (AMD)                        8122368 (7.746GiB) 8122368 (7.746GiB)
  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                           7287183768 (6.787GiB)
  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                    7287183768 (6.787GiB)
  Preferred total size of global vars             8573157376 (7.984GiB)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        16384 (16KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             29471
    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                            2992216472 (2.787GiB)
  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                        7287183768 (6.787GiB)
  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 01: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)             20
  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 [MESA]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 Clover
    Device Name                                   AMD Radeon RX 5700 XT (navi10, LLVM 15.0.7, DRM 3.52, 6.4.3-273-tkg-pds-llvm)
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 Clover
    Device Name                                   AMD Radeon RX 5700 XT (navi10, LLVM 15.0.7, DRM 3.52, 6.4.3-273-tkg-pds-llvm)
  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                                 Clover
    Device Name                                   AMD Radeon RX 5700 XT (navi10, LLVM 15.0.7, DRM 3.52, 6.4.3-273-tkg-pds-llvm)
	NOTE:	your OpenCL library only supports OpenCL 2.2,
	        but some installed platforms support OpenCL 3.0.
	        Programs using 3.0 features may crash
	        or behave unexpectedly

I looked a bit more, and found, that gfx1010 is my GPU: https://github.com/CNugteren/CLBlast/blob/master/doc/tuning.md#already-tuned-for-devices

Apparently, opencl-mesa got removed from the repo? https://archlinux.org/packages/extra/x86_64/opencl-mesa/

Solved the issue. I simply had to remove opencl-mesa and lib32-opencl-mesa. opencl-mesa got removed from the repo. I assume it got replaced by opencl-clover-mesa or opencl-rusticl-mesa. I don’t know what the difference between those two is. I further assume that the program now uses rocm-opencl-runtime, which I also have installed. If anyone know more about all of this, please tell me :slight_smile:

I have some packages for it installed but I’m not using it for any purpose. Is it already built into the nvidia drivers? I’m using Wayland on Kde with nvidia.

[ricklinux@asus-tuff ~]$ yay -Ss opencl | grep -i installed
extra/clinfo 3.0.21.02.21-1 (50.7 KiB 141.7 KiB) (Installed)
extra/ocl-icd 2.3.2-1 (84.9 KiB 459.2 KiB) (Installed)
[ricklinux@asus-tuff ~]$ 
[ricklinux@asus-tuff ~]$ clinfo
Number of platforms                               0

On my Ryzen system with amdgpu i get more info like your post above but i don’t have all the packages installed. I’m not using it for any purpose and not even sure what you’re using it to do? This system is also running Kde Wayland.

I found more info about rusticl: It appears to be deactivated by default, so you have to activate it using something like RUSTICL_ENABLE=radeonsi. I tried uninstalling rocm, and installed opencl-rusticl-mesa, and when I use the environment variable, it still works.

the mesa opencl package was split, the reasoning is explained in the Bug report:

there was an issue with the splitting that was now fixed:

you should not have several OpenCL providers installed in the first place. rocm-opencl-runtime is one provider, the mesa packages are other providers. My guess would be that opencl-rusticl-mesa is the one that should work best from the 2 mesa alternatives.

1 Like

Thanks for the explanation! Would you recommend opencl-rusticl-mesa or rocm-opencl-runtime?

not sure, haven’t seen any benchmarks yet and also have no personal experience. As mesa is completely free and part of the core Linux system, I would try that and only switch to rocm in case there are compatibility issues or performance issues.
Mesa’s OpenCL was broken/had issues for a long time, that’s why suggestions were to use rocm-opencl-runtime (which is the part of the proprietary driver that was actually needed, switching completely to the proprietary one was overkill) but mesa’s RustiCL should work good now.

1 Like

I thought ROCm was FOSS? The git repo says MIT-License: https://github.com/RadeonOpenCompute/ROCm

AMD’s proprietary driver package is mostly Open Source, they are big with that. Rocm is open source but still not as Linux-native as the mesa-project, meaning changes in kernel/mesa can potentially break Rocm and would exist until a future rocm release fixes it, while the kernel/mesa releases are coherent and tested as a whole, which means that breaking changes usually are being seen and fixed during development so the users don’t get hit by those.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.