You are not logged in.

#1 2020-06-20 08:53:58

Lattitude
Member
Registered: 2020-06-20
Posts: 5

[SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

I have the following AMD graphics card and I have been trying to use it for GPU accelerated computing using OpenCL mesa driver. I am trying to use ArrayFire for the computation and after posting a couple of issues about it in the ArrayFire github page, found that the issue is with the Mesa driver for Arch.

0d:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / Radeon 520 Mobile] (rev 83)
	Subsystem: Hewlett-Packard Company Device 80c2
	Flags: bus master, fast devsel, latency 0, IRQ 52
	Memory at b0000000 (64-bit, prefetchable) [size=256M]
	Memory at d4000000 (64-bit, non-prefetchable) [size=256K]
	I/O ports at 4000 [size=256]
	Expansion ROM at d4040000 [disabled] [size=128K]
	Capabilities: <access denied>
	Kernel driver in use: radeon
	Kernel modules: radeon, amdgpu

I tried using the mesa driver with OpenCl support in the official repositories, but found that it is buggy and would always result in some error. Also, it does not support any higher version other than OpenCL 1.1. After a distro hop to Ubuntu, I used the mesa driver from Oibaf's PPA and it seemed to work pretty well. After some searching, I found that an equivalent in Arch is the mesa-git driver. Now, in my Arch, I installed the compiled mesa-git and opencl-mesa-git from Laurent Carlier's repository. After, testing it with Julia I find the following errors.

julia> a = AFArray(rand(4,4))
AFArray: 4×4 Array{Float64,2}:
 0.910863  0.528568   0.769485  0.262519
 0.758505  0.59156    0.464172  0.498584
 0.888846  0.839448   0.482488  0.179536
 0.470455  0.0313732  0.784979  0.995334

julia> a+1
AFArray: Error showing value of type AFArray{Float64,2}:
ERROR: ArrayFire Error (998) : Internal error
OpenCL Error (-11): Build Program Failure when calling clBuildProgram
Stacktrace:
 [1] _error(::UInt32, ::Bool) at /home/<username>/.julia/packages/ArrayFire/wYxcd/src/util.jl:96
 [2] _error at /home/<username>/.julia/packages/ArrayFire/wYxcd/src/util.jl:85 [inlined]
 [3] get_data_ptr at /home/<username>/.julia/packages/ArrayFire/wYxcd/src/wrap.jl:748 [inlined]
 [4] convert_array(::AFArray{Float64,2}) at /home/<username>/.julia/packages/ArrayFire/wYxcd/src/util.jl:216
 [5] Array at /home/<username>/.julia/packages/ArrayFire/wYxcd/src/array.jl:33 [inlined]
 [6] toa(::AFArray{Float64,2}) at /home/<username>/.julia/packages/ArrayFire/wYxcd/src/util.jl:48
 [7] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::AFArray{Float64,2}) at /home/<username>/.julia/packages/ArrayFire/wYxcd/src/util.jl:52
 [8] display(::REPL.REPLDisplay, ::MIME{Symbol("text/plain")}, ::Any) at /build/julia/src/julia-1.4.2/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:137
 [9] display(::REPL.REPLDisplay, ::Any) at /build/julia/src/julia-1.4.2/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:141
 [10] display(::Any) at ./multimedia.jl:323
 [11] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [12] invokelatest at ./essentials.jl:711 [inlined]
 [13] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /build/julia/src/julia-1.4.2/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:161
 [14] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /build/julia/src/julia-1.4.2/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:146
 [15] (::REPL.var"#do_respond#38"{Bool,REPL.var"#48#57"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /build/julia/src/julia-1.4.2/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:729

So, it seems the mesa-git is also buggy in my case. My question is why are the drivers on Mesa buggy and can it be fixed? Also, is there any way that I can install the drivers from Oibaf's PPA(which are for Ubuntu) on Arch as they seem to work without any errors? You help here would be great as I will then be able to do my calculations without the need to switch over from Arch.

Linux <username> 5.7.3-arch1-1 #1 SMP PREEMPT Wed, 17 Jun 2020 19:42:12 +0000 x86_64 GNU/Linux

Further information: I am using the latest Arch kernel and have just updated all my drivers after a fresh reinstall a couple of days ago. I would be happy to provide any other information as needed. Thank you

Last edited by Lattitude (2020-06-21 04:23:29)

Offline

#2 2020-06-20 09:48:52

Ropid
Member
Registered: 2015-03-09
Posts: 856

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

There's a package "opencl-amd" in the AUR. That package downloads the "AMDGPU-PRO" driver package and then extracts just the OpenCL driver part out of it. Perhaps try that opencl-amd package and see if it works for you. Your GPU is old so it might not work. Remove the opencl-mesa package while you try opencl-amd.

You will need to run the "amdgpu" kernel module while you try this. Your system currently uses "radeon". You need to force a switch to amdgpu. Check the ArchWiki amdgpu article to see how to do that.

Offline

#3 2020-06-20 10:01:37

Lattitude
Member
Registered: 2020-06-20
Posts: 5

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

Thank you for the reply. I actually tried that too. I did a complete switch to amdgpu by blacklisting the radeon module in the mkinitcpio and setting the required kernel parameters. Then, I installed opencl-amd which supports the mesa driver from amdgpu pro. This did not work either. I also found that my card is not supported by the amdgpu-pro driver. The only option which did work was using the updated Clover drivers from OiBaf's PPA as I said earlier, but obviously only in Ubuntu. I think I want a similar driver for Arch if possible.

Offline

#4 2020-06-20 12:25:41

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 8,265

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

julia> a = AFArray(rand(4,4))
ERROR: UndefVarError: AFArray not defined
Stacktrace:
 [1] top-level scope at REPL[1]:1

Please provide a clear testcase suitable for someone that has no experience with julia and arrayfire .
Falling back to troubleshooting with limited info.

Mesa OpenCL uses libclc .
The libclc version Oibaf provides is 0.2.0+git20200209.1921.9aa6f3~oibaf , which builds from exactly the same commit (9aa6f3 ) as the archlinux libclc pacakge .

Looking further at oibaf ppa they build mesa-git against llvm 10 , the mesa-git in Lordheavy's repo is build against llvm git (currently at 11) .

My aur mesa-git package[1] allows selecting against which llvm version it should be build , repo llvm is one of the choices.
Try building that and verify if it solves your problems.

If it doesn't help, please link to the issues in arrayfire github about this.
They may provide enough info to figure out what's causing the problem.



[1] https://aur.archlinux.org/packages/mesa-git/

Last edited by Lone_Wolf (2020-06-20 12:26:35)


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#5 2020-06-20 17:21:46

Lattitude
Member
Registered: 2020-06-20
Posts: 5

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

Thank you very much for the reply, Lone_Wolf. I would try building mesa-git as you suggested and get back to you. I will also raise an issue in ArrayFire github page and see if they can shine some light on the issue. Is it okay if I keep this thread open until then?

Offline

#6 2020-06-20 19:47:32

Arup
Member
From: Earth
Registered: 2014-02-20
Posts: 86

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

This package works fine with my RX570, Open CL working in Darktable and Libre Office.

https://aur.archlinux.org/packages/opencl-amd

Offline

#7 2020-06-20 20:31:52

Lattitude
Member
Registered: 2020-06-20
Posts: 5

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

@Arup, Thanks. But, my card is R5 M330. I tried to use the proprietary drivers too as I said earlier. But, it did not help.

To add further, this is the information from clinfo:

Number of platforms                               1
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 20.2.0-devel (git-e94a122642)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   Clover
Number of devices                                 1
  Device Name                                     AMD HAINAN (DRM 2.50.0, 5.7.3-arch1-1, LLVM 11.0.0)
  Device Vendor                                   AMD
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.1 Mesa 20.2.0-devel (git-e94a122642)
  Driver Version                                  20.2.0-devel
  Device OpenCL C Version                         OpenCL C 1.1
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Max compute units                               5
  Max clock frequency                             1030MHz
  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//usr/lib/clc/hainan-amdgcn-mesa-mesa3d.bc': No such file or directory
  Preferred work group size multiple              <getWGsizes:1256: 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                              2147483648 (2GiB)
  Error Correction support                        No
  Max memory allocation                           1503238553 (1.4GiB)
  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                               32768 (32KiB)
  Max number of constant args                     16
  Max constant buffer size                        1503238400 (1.4GiB)
  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
  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

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 HAINAN (DRM 2.50.0, 5.7.3-arch1-1, LLVM 11.0.0)
  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 HAINAN (DRM 2.50.0, 5.7.3-arch1-1, LLVM 11.0.0)
  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 HAINAN (DRM 2.50.0, 5.7.3-arch1-1, LLVM 11.0.0)
Lattitude wrote:

OpenCL Error (-11): Build Program Failure when calling clBuildProgram

And in the above code I see that it is unable to get the file hainan-amdgcn-mesa-mesa3d.bc. And from preliminary search, I found that it is available in libclc-amdgcn_0.2.0 in some ubuntu packages. Is there any way this error can be averted? Or is this file available in the libclc package from the base repository?

@Lone_Wolf I have built the mesa-git with libclc, llvm-libs=10.0.0. But, is there an opencl-mesa package for it? The official opencl-mesa does not seem to work with mesa-git package built from your repo. ArrayFire uses OpenCL from Mesa Clover for the calculations. I see that the clinfo shows zero platforms after installing mesa-git from your aur.

Last edited by Lattitude (2020-06-20 21:31:51)

Offline

#8 2020-06-20 21:44:03

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 8,265

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

My mesa-git package combines the functionality of repo mesa, opencl-mesa, vulkan-intel, vulkan-radeon, vulkan-mesa-layer, libva-mesa-driver and mesa-vdpau stock packages into one package .
To use it you have to answer yes to all conflicts upon install.

You may not need to test with my mesa-git package though, the clinfo gives a clue about what may be wrong.

/usr//usr/lib/clc/hainan-amdgcn-mesa-mesa3d.bc

clinfo is looking at the wrong path , the file is at /usr/lib/clc/hainan-amdgcn-mesa-mesa3d.bc .
This suggests something is wrong with your ICD loader setup or ld.so searchpath.


post

$ pacman -Qs icd
$ ls -l /etc/ld.so.conf.d/ 

Last edited by Lone_Wolf (2020-06-20 21:44:55)


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#9 2020-06-20 21:52:26

Arup
Member
From: Earth
Registered: 2014-02-20
Posts: 86

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

@Lattitude if its any help here is my clinfo

[arup@ryzen-arup ~]$ clinfo
Number of platforms                               2
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 20.1.1
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

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

  Platform Name                                   Clover
Number of devices                                 1
  Device Name                                     Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.4-arch1-1, LLVM 10.0.0)
  Device Vendor                                   AMD
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.1 Mesa 20.1.1
  Driver Version                                  20.1.1
  Device OpenCL C Version                         OpenCL C 1.1 
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Max compute units                               32
  Max clock frequency                             1268MHz
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
  Preferred work group size multiple              64
  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                           6871947673 (6.4GiB)
  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                               32768 (32KiB)
  Max number of constant args                     16
  Max constant buffer size                        2147483392 (2GiB)
  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
  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

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     Ellesmere
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.2 AMD-APP (3110.6)
  Driver Version                                  3110.6
  Device OpenCL C Version                         OpenCL C 1.2 
  Device Type                                     GPU
  Device Board Name (AMD)                         Radeon RX 570 Series
  Device Topology (AMD)                           PCI-E, 08:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               32
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                16
  SIMD instruction width (AMD)                    1
  Max clock frequency                             1268MHz
  Graphics IP (AMD)                               8.0
  Device Partition                                (core)
    Max number of sub-devices                     32
    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              64
  Wavefront width (AMD)                           64
  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                                     No
    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                              8259293184 (7.692GiB)
  Global free memory (AMD)                        8046132 (7.673GiB)
  Global memory channels (AMD)                    8
  Global memory banks per channel (AMD)           16
  Global memory bank width (AMD)                  256 bytes
  Error Correction support                        No
  Max memory allocation                           4244635648 (3.953GiB)
  Unified memory for Host and Device              No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       2048 bits (256 bytes)
  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             16
    Max size for 1D images from buffer            134217728 pixels
    Max 1D or 2D image array size                 2048 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                             2048x2048x2048 pixels
    Max number of read image args                 128
    Max number of write image args                8
  Local memory type                               Local
  Local memory size                               32768 (32KiB)
  Local memory syze per CU (AMD)                  65536 (64KiB)
  Local memory banks (AMD)                        32
  Max number of constant args                     8
  Max constant buffer size                        4244635648 (3.953GiB)
  Preferred constant buffer size (AMD)            16384 (16KiB)
  Max size of kernel argument                     1024
  Queue properties                                
    Out-of-order execution                        No
    Profiling                                     Yes
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      1ns
  Profiling timer offset since Epoch (AMD)        1592680572751492895ns (Sun Jun 21 03:16:12 2020)
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Thread trace supported (AMD)                  Yes
    Number of async queues (AMD)                  2
    Max real-time compute queues (AMD)            0
    Max real-time compute units (AMD)             0
    SPIR versions                                 1.2
  printf() buffer size                            4194304 (4MiB)
  Built-in kernels                                (n/a)
  Device Extensions                               cl_khr_fp64 cl_amd_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_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_amd_bus_addressable_memory cl_khr_spir cl_khr_gl_event 


NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Clover
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [MESA]
  clCreateContext(NULL, ...) [default]            Success [MESA]
  clCreateContext(NULL, ...) [other]              Success [AMD]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 Clover
    Device Name                                   Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.4-arch1-1, LLVM 10.0.0)
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 Clover
    Device Name                                   Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.4-arch1-1, LLVM 10.0.0)
  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                                   Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.4-arch1-1, LLVM 10.0.0)

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.12
  ICD loader Profile                              OpenCL 2.2
[arup@ryzen-arup ~]$ 

Last edited by Arup (2020-06-20 22:00:59)

Offline

#10 2020-06-20 21:57:59

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 8,265

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

Lattitude wrote:

I see that the clinfo shows zero platforms after installing mesa-git from your aur.

The majority of mesa runtime functionality is provided by llvm-libs, but for opencl you need a bit more.
Use pacman -Qi mesa-git and check the optional dependencies.

Last edited by Lone_Wolf (2020-06-20 21:58:16)


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#11 2020-06-21 04:19:21

Lattitude
Member
Registered: 2020-06-20
Posts: 5

Re: [SOLVED]Problem with OpenCL support for Mesa with radeon kernel driver

Lone_Wolf wrote:

The majority of mesa runtime functionality is provided by llvm-libs, but for opencl you need a bit more.
Use pacman -Qi mesa-git and check the optional dependencies.

Thank you very much for this advice. Seems, like I missed the packages clang and compiler-rt. Once I installed them, I could get the opencl-mesa to work with the following info.

Number of platforms                               1
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 20.2.0-devel (git-0c32403c73)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   Clover
Number of devices                                 1
  Device Name                                     AMD HAINAN (DRM 2.50.0, 5.7.3-arch1-1, LLVM 10.0.0)
  Device Vendor                                   AMD
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.1 Mesa 20.2.0-devel (git-0c32403c73)
  Driver Version                                  20.2.0-devel
  Device OpenCL C Version                         OpenCL C 1.1
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Max compute units                               5
  Max clock frequency                             1030MHz
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
  Preferred work group size multiple              64
  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                              2147483648 (2GiB)
  Error Correction support                        No
  Max memory allocation                           1503238553 (1.4GiB)
  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                               32768 (32KiB)
  Max number of constant args                     16
  Max constant buffer size                        1503238400 (1.4GiB)
  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
  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

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 HAINAN (DRM 2.50.0, 5.7.3-arch1-1, LLVM 10.0.0)
  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 HAINAN (DRM 2.50.0, 5.7.3-arch1-1, LLVM 10.0.0)
  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 HAINAN (DRM 2.50.0, 5.7.3-arch1-1, LLVM 10.0.0)

With the above change, I am now able to run ArrayFire in Julia without any errors. Seems like my only step was to compile mesa-git from your aur with the default packages and install clang and compiler-rt.

Lone_Wolf wrote:

post
$ pacman -Qs icd

local/ocl-icd 2.2.12-4
    OpenCL ICD Bindings
local/vulkan-icd-loader 1.2.141-1
    Vulkan Installable Client Driver (ICD) Loader
Lone_Wolf wrote:

ls -l /etc/ld.so.conf.d/

total 12
-rw-r--r-- 1 root root 21 Jun 19 09:20 arrayfire.conf
-rw-r--r-- 1 root root 21 Nov 13  2019 fakeroot.conf
-rw-r--r-- 1 root root 17 Jun 14 16:12 openmpi.conf

I will now mark this as solved.

Offline

Board footer

Powered by FluxBB