Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r1b1fae1.fsf@d>
Date: Sun, 28 Nov 2021 02:26:30 +0300
From: Aleksey Cherepanov <lyosha@...nwall.com>
To: john-users@...ts.openwall.com
Subject: installing OpenCL / gpu drivers on Debian for AMD Radeon R9 390 / Hawaii

The future is now: it is possible to use OpenCL on Debian 11 (Bullseye;
current stable) using only packages from the official repo. Kernel
already has amdgpu driver and can work with open source stack. OpenCL is
implemented in mesa.

Though firmware for gpu is in a non-free package. (I did not test
without the package though.)

Also it is possible to install opencl part only of non-free amdgpu-pro
driver on top of this.

47 of 91 of john's opencl formats fail with mesa. Speeds of the rest are
ok though. 5 of 91 opencl formats fail with amdgpu-pro driver installed
as described below.

Is there a better way of installation? Better drivers? Would amdgpu-gpu
or rocm installed on ubuntu as in official docs work better?

______________________________________________________________________

Steps to install opencl from mesa:

1) install the following packages (including Debian's non-free):
opencl-c-headers ocl-icd-opencl-dev ocl-icd-libopencl1 mesa-opencl-icd firmware-linux clinfo

mesa-opencl-icd is the opencl component. It is implementation from Mesa
(clover) / GalliumCompute.

2) switch from radeon driver to amdgpu adding command line options to
kernel as described here:
https://askubuntu.com/questions/927601/i-think-im-using-radeon-instead-of-amdgpu-how-do-i-change

(R9 390 requires .cik, not .si despite info on stackoverflow.)
(It looks like blacklisting radeon driver worked previously:
https://forums.debian.net/viewtopic.php?t=128067
It did not work for me on bullseye.)

OpenCL from mesa works with radeon driver, but most of formats would
show much lower speeds.

You may check which driver is active using `lspci -v`:
[...]
03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Hawaii PRO [Radeon R9 290/390] (rev 80) (prog-if 00 [VGA controller])
[...]
	Kernel driver in use: amdgpu
	Kernel modules: radeon, amdgpu
[...]

Example output from `clinfo` after successful setup:
$ clinfo -l
Platform #0: Clover
 `-- Device #0: AMD Radeon (TM) R9 390 Series (HAWAII, DRM 3.40.0, 5.10.0-9-amd64, LLVM 11.0.1)

______________________________________________________________________

It is possible to use opencl part of AMDGPU-PRO non-free driver as
described here:
https://gitlab.com/BCMM/amdgpu-opencl-on-debian

The above steps are needed excluding mesa-opencl-icd package. (I did not
try with this package.)

Example output from `clinfo`:
$ clinfo -l
Platform #0: AMD Accelerated Parallel Processing
 `-- Device #0: Hawaii

With AMDGPU-PRO 20.10, ocl-icd-libopencl1 is not needed, because
libOpenCL.so.1 is provided by non-free opencl-orca-amdgpu-pro-icd package.
But with 20.40, Debian's ocl-icd-libopencl1 is needed.

Without switching from 'radeon' to 'amdgpu', I got the following error:
amdgpu_device_initialize: DRM version is 2.50.0 but this driver is only compatible with 3.x.x.
Segmentation fault

With 20.10, I had to specify paths for opencl building john:
john/src$ LDFLAGS=' -L/opt/amdgpu-pro/lib/x86_64-linux-gnu/ ' CFLAGS=' -I/opt/amdgpu-pro/include/ ' ./configure ...

It would generate a warning:
configure: WARNING: No recognized optimization option present in CFLAGS ...

-O3 on CFLAGS would yield other warning during make. So I am not sure
how is right.

______________________________________________________________________

There is a pretty overview of gpu families here:
https://wiki.gentoo.org/wiki/AMDGPU#Feature_support

There is a short overview of drivers here:
https://wiki.gentoo.org/wiki/OpenCL#AMD

Installing ROCm through additional repo did not work for me. There are
reports that R9 support was broken and I don't know if it was fixed:
https://github.com/RadeonOpenCompute/ROCm/issues/906
There is report that version 1.9 worked well (current is 4.5):
https://github.com/RadeonOpenCompute/ROCm/issues/871

I tried all above steps on the same system without clean installation,
so something may be missing or wrong in my instructions. Please report!

Thanks!

--
Regards,
Aleksey Cherepanov

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.