How to get OpenCL support for navi10 GPUs from AMD?

7,653

Solution 1

So, I couldn't manage amdgpu/amdgpu-pro driver to install on Ubuntu 18.04 with all permutations of:

kernels 5.0,5.2,5.3,5.4,5.5

gcc 7,8,9 (every version was giving different errors which I was fixing to just get other errors)

amdgpu and amdgpu-pro versions 19.30,19.50

But I did manage to get OpenCL working ;) What eventually succeeded for me:

  • fresh Ubuntu 18.04.3 installation
  • update kernel to version 5.4 with ukuu (next (mesa) step fails on kernel version 5.5)
  • reboot
  • install mesa 19.3:

    sudo add-apt-repository ppa:kisak/kisak-mesa

    sudo apt-get dist-upgrade

    sudo apt-get update

  • reboot
  • install OpenCL:

    sudo apt install opencl-headers ocl-icd-libopencl1 clinfo

    sudo ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/lib/libOpenCL.so

P.S. Exploring and learning about amdgpu-pro sources while trying to fix compilation errors I discovered that AMD devs implement forthcoming GPUs directly within mesa open-source drivers and Linux kernel - months before GPUs even released. So, to jusfify AMD devs a bit, that's where the development focus is - not on amdgpu-pro.

Solution 2

Glad you got it working, I saw your inquiry on a few other forums while trying to find a solution. I managed to get a somewhat working solution.

I also have the RX 5700XT, and I'm running Pop!_OS 19.10 on 5.5.5-050505-generic. For my PPA's, I have cappelikan, kisak, and oibaf; I suspect this is reproducible without them as I mainly have [a few of] them for general drivers (other than OpenCL).

I downloaded the amdgpu-pro drivers 19.50, and installed the following (in order):

Setting up amdgpu-core (19.50-967956) ...
Setting up amdgpu-pro-core (19.50-967956) ...
Setting up opencl-amdgpu-pro-comgr (19.50-967956) ...
Setting up opencl-amdgpu-pro-icd (19.50-967956) ...
Setting up libdrm2-amdgpu:amd64 (1:2.4.99-967956) ...
Setting up libdrm-amdgpu-amdgpu1:amd64 (1:2.4.99-967956) ...
Setting up libopencl1-amdgpu-pro:amd64 (19.50-967956) ...
Setting up clinfo-amdgpu-pro (19.50-967956) ...

To test if OpenCL works, I ran darktable-cltest and looked for successful outputs when loading the opencl kernel.

There is a big 'but' in all this: I cannot boot successfully (black screen, flashing lines). I'd have to CTRL+ALT+F2 and run ./amdgpu-pro-install --uninstall from the amdgpu-pro drivers directory, and then repeat the same steps above. I've tested this with the 5.3 and 5.5 kernel so far.

Share:
7,653

Related videos on Youtube

Slaus
Author by

Slaus

Updated on September 18, 2022

Comments

  • Slaus
    Slaus almost 2 years

    For my AMD Radeon RX 5700XT I tried amdgpu-pro drivers (v19.50) installation on modern (kernel 5.3) Ubuntu 18.04.3 as driver claims it's supported but compilation failed with C++ errors. Tried the same on 5.0 and 5.5.2 kernels with same results (on 5.5.2 kernel it was different error though: <drm/drmP.h>: No such file or directory).

    Currently I'm on kernel 5.5.2 with mesa 19.3 installed. clinfo prints a lot of satisfying information seeming it's all cool, but with such tiny little line in-between:

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

    which causes kernels compilation to fail (with the same error).

    Anyone having any luck getting navi10 GPU OpenCL working on Ubuntu any distro?

  • Slaus
    Slaus over 4 years
    Oh, it installed!? Black screen is a big 'but' though :). Anyway, I don't understand how you managed to install 19.50 driver on 5.5 core since it compiles drm which fails with couldn't find drp/drmP.h and it's because it was removed from linux kernel 5.5, but in-kernel driver was fixed in response to drmP.h removal.
  • mikkeyboi
    mikkeyboi over 4 years
    Yup, installing only those packages did not give any error. I'm not sure what else I can add, but have you tried using ROCm? The closest to our setup would be ROCm 3.0, and its setup ships with OpenCL.
  • Slaus
    Slaus over 4 years
    Yes, I tried ROCm, but also failed - can't remember my set up atm. Anyway, ROCm just tries to install the same amdgpu-pro drivers, which fails. I also installed ComputeCpp from Codeplay (which should target OpenCL on AMD), but it again was failing with cannot open file '/usr/lib/clc/gfx1010-amdgcn-mesa-mesa3d.bc' error. Btw, I'm happy with my current OpenCL installation through kernel 5.4 and mesa 19.3 - everything works fine ;)
  • Rod Burns
    Rod Burns over 4 years
    ComputeCpp only works with a specific older version of the drivers (see Platform Support Notes developer.codeplay.com/products/computecpp/ce/guides/…) because AMD stopped providing support for SPIR in their drivers.
  • mikkeyboi
    mikkeyboi over 4 years
    By now you're probably content with your setup and don't want to change anything, but the stable version of kernel 5.5.6 released today and it seems to have addressed /most/ of our issues. Long story short, I removed OpenCL and the amdgpu 19.50 drivers that were downloaded from their site and stuck with the PPA repos. When I did the kernel update it detected the firmware and libraries I was missing (including OpenCL!), and after successful reboot my OpenCL tests worked.