Bug 42616 - libclc '/usr/lib64/clc/gfx909-amdgcn-mesa-mesa3d.bc': No such file
Summary: libclc '/usr/lib64/clc/gfx909-amdgcn-mesa-mesa3d.bc': No such file
Status: CLOSED WONTFIX
Alias: None
Product: Sisyphus
Classification: Development
Component: libclc (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 critical
Assignee: Valery Inozemtsev
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-27 15:41 MSK by Iakunin Andrei
Modified: 2023-06-20 20:39 MSK (History)
3 users (show)

See Also:


Attachments
hardware info (2.38 KB, text/plain)
2022-04-27 15:41 MSK, Iakunin Andrei
no flags Details
glxinfo (146.84 KB, text/plain)
2022-04-27 15:42 MSK, Iakunin Andrei
no flags Details
clinfo (7.38 KB, text/plain)
2022-04-27 15:49 MSK, Iakunin Andrei
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Iakunin Andrei 2022-04-27 15:41:41 MSK
Created attachment 10676 [details]
hardware info

Unable to build any OpenCL program with libclc. libclc needs update.
Missing '/usr/lib64/clc/gfx909-amdgcn-mesa-mesa3d.bc'
Looks like libclc way too old for AMD Ryzen 3 5300U.

Way to reproduce:

apt-get install libMesaOpenCL clinfo libclc ocl-icd ocl-icd-devel

git clone https://github.com/rsnemmen/OpenCL-examples.git

cd OpenCL-examples/add_numbers; make

./add_numbers
fatal error: cannot open file '/usr/lib64/clc/gfx909-amdgcn-mesa-mesa3d.bc': No such file or directory


$ ls /usr/lib64/clc/gfx*.bc
/usr/lib64/clc/gfx900-amdgcn--.bc
/usr/lib64/clc/gfx900-amdgcn-mesa-mesa3d.bc
/usr/lib64/clc/gfx902-amdgcn--.bc
/usr/lib64/clc/gfx902-amdgcn-mesa-mesa3d.bc
/usr/lib64/clc/gfx904-amdgcn--.bc
/usr/lib64/clc/gfx904-amdgcn-mesa-mesa3d.bc
/usr/lib64/clc/gfx906-amdgcn--.bc
/usr/lib64/clc/gfx906-amdgcn-mesa-mesa3d.bc
Comment 1 Iakunin Andrei 2022-04-27 15:42:58 MSK
Created attachment 10677 [details]
glxinfo
Comment 2 Iakunin Andrei 2022-04-27 15:49:25 MSK
Created attachment 10678 [details]
clinfo
Comment 3 Valery Inozemtsev 2022-05-02 19:25:17 MSK
у нас древняя версия clc
clc нужно собирать из llvm
Comment 4 Arseny Maslennikov 2022-05-02 19:52:29 MSK
(In reply to Valery Inozemtsev from comment #3)
> у нас древняя версия clc
> clc нужно собирать из llvm

Ок, я попробую, но вслепую: насколько оно будет прилично работать — сказать не смогу, виднее будет тем, кто напрямую работает с OpenCL.
Comment 5 Konstantin A Lepikhov (L.A. Kostis) 2023-06-13 00:17:11 MSK
See #322784 for details.

Updated libclc works fine for me, I was able to built mesa/rusticl with it and clinfo works too:

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  rusticl
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [MESA]
  clCreateContext(NULL, ...) [default]            Success [MESA]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 rusticl
    Device Name                                   AMD Radeon HD 7700 Series (verde, LLVM 16.0.5, DRM 3.49, 6.1.0-lks-wks-alt6.32)
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 rusticl
    Device Name                                   AMD Radeon HD 7700 Series (verde, LLVM 16.0.5, DRM 3.49, 6.1.0-lks-wks-alt6.32)
  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                                 rusticl
    Device Name                                   AMD Radeon HD 7700 Series (verde, LLVM 16.0.5, DRM 3.49, 6.1.0-lks-wks-alt6.32)

Also tested with darktable/luxmark.
Comment 6 Konstantin A Lepikhov (L.A. Kostis) 2023-06-13 00:17:58 MSK
Given GPU output just an example, it should work on recent GPU too (and Intel as well).
Comment 7 Iakunin Andrei 2023-06-13 13:14:07 MSK
libclc-13.0.1-alt1.x86_64.rpm
contains:
/usr/lib64/clc/gfx900-amdgcn--.bc
/usr/lib64/clc/gfx900-amdgcn-mesa-mesa3d.bc
/usr/lib64/clc/gfx902-amdgcn--.bc
/usr/lib64/clc/gfx902-amdgcn-mesa-mesa3d.bc
/usr/lib64/clc/gfx904-amdgcn--.bc
/usr/lib64/clc/gfx904-amdgcn-mesa-mesa3d.bc
/usr/lib64/clc/gfx906-amdgcn--.bc
/usr/lib64/clc/gfx906-amdgcn-mesa-mesa3d.bc

No gfx909-amdgcn-mesa-mesa3d.bc
So it will not work on my hardware. 

>>Updated libclc works fine for me, I was able to built mesa/rusticl with it and clinfo works too:
Your hardware just too old.

>>Given GPU output just an example, it should work on recent GPU too (and Intel as well).
It does not work on my AMD Ryzen 3 5300U. libclc need update.
Comment 8 Konstantin A Lepikhov (L.A. Kostis) 2023-06-15 23:58:43 MSK
(In reply to Iakunin Andrei from comment #7)
> libclc-13.0.1-alt1.x86_64.rpm
> contains:
> /usr/lib64/clc/gfx900-amdgcn--.bc
> /usr/lib64/clc/gfx900-amdgcn-mesa-mesa3d.bc
> /usr/lib64/clc/gfx902-amdgcn--.bc
> /usr/lib64/clc/gfx902-amdgcn-mesa-mesa3d.bc
> /usr/lib64/clc/gfx904-amdgcn--.bc
> /usr/lib64/clc/gfx904-amdgcn-mesa-mesa3d.bc
> /usr/lib64/clc/gfx906-amdgcn--.bc
> /usr/lib64/clc/gfx906-amdgcn-mesa-mesa3d.bc
> 
> No gfx909-amdgcn-mesa-mesa3d.bc
> So it will not work on my hardware. 
> 
> >>Updated libclc works fine for me, I was able to built mesa/rusticl with it and clinfo works too:
> Your hardware just too old.
For modern hardware you can use rocm-opencl-runtime instead:

❯ clinfo 
Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3558.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                                     gfx1031

BTW gfx909 is supported too.

> 
> >>Given GPU output just an example, it should work on recent GPU too (and Intel as well).
> It does not work on my AMD Ryzen 3 5300U. libclc need update.
Use rocm-opencl-runtime and forget about libclc.
Comment 9 Konstantin A Lepikhov (L.A. Kostis) 2023-06-16 00:04:17 MSK
❯ sudo apt-get install ocl-icd-devel                                                                                                         
[sudo] password for lakostis:                                                                                                                
Reading Package Lists... Done                                                                                                                
Building Dependency Tree... Done                         
The following extra packages will be installed:                                                                                              
  opencl-headers                                                                                                                             
The following NEW packages will be installed:                                                                                                
  ocl-icd-devel opencl-headers                                                                                                               
0 upgraded, 2 newly installed, 0 removed and 47 not upgraded.
Need to get 0B/88.4kB of archives.                             
After unpacking 868kB of additional disk space will be used.
Do you want to continue? [Y/n]                                     
Committing changes...                                                                                                                        
Preparing...                                                                                                                                                                   #################################################################################################### [100%]
Updating / installing...                                     
1: opencl-headers-2.2-alt1                                                                                                                                                     #################################################################################################### [ 50%]
2: ocl-icd-devel-2.2.14-alt1                                                                                                                                                   #################################################################################################### [100%]
egrep: warning: egrep is obsolescent; using grep -E                 
egrep: warning: egrep is obsolescent; using grep -E                                                                                          
Done.                                                
                                                                      
❯ make                                                               
gcc -std=c99 -Wall -DUNIX -g -DDEBUG -m64 -o add_numbers add_numbers.c   -lOpenCL
add_numbers.c: In function ‘main’:                                   
add_numbers.c:197:4: warning: ‘clCreateCommandQueue’ is deprecated [-Wdeprecated-declarations]
  197 |    queue = clCreateCommandQueue(context, device, 0, &err);    
      |    ^~~~~                                                                                                                             
In file included from add_numbers.c:14:
/usr/include/CL/cl.h:1443:1: note: declared here
 1443 | clCreateCommandQueue(cl_context                     /* context */,
      | ^~~~~~~~~~~~~~~~~~~~

OpenCL-examples/add_numbers on  master [?] via  v12.2.1-gcc took 3s 
❯ ./
add_numbers     add_numbers.c   add_numbers.cl  Makefile        

OpenCL-examples/add_numbers on  master [?] via  v12.2.1-gcc took 4s 
❯ clinfo
Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3558.0)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback 
  Platform Extensions function suffix             AMD
  Platform Host timer resolution                  1ns
...

OpenCL-examples/add_numbers on  master [?] via  v12.2.1-gcc took 3s 
❯ ./add_numbers
Computed sum = 2016.0.
Check passed.
Comment 10 Iakunin Andrei 2023-06-20 11:21:21 MSK
> Use rocm-opencl-runtime and forget about libclc.
Ok. But what about p10? rocm-opencl-runtime appears only in sisyphus. And it is quite new, from 28 may 2023.
Comment 11 Konstantin A Lepikhov (L.A. Kostis) 2023-06-20 20:39:14 MSK
(In reply to Iakunin Andrei from comment #10)
> > Use rocm-opencl-runtime and forget about libclc.
> Ok. But what about p10? rocm-opencl-runtime appears only in sisyphus. And it
> is quite new, from 28 may 2023.

I'm on sisyphus so dunno about p10. In theory, one could build llvm15.0 for p10, then rocm-5.4.x can be backported too.