How to enable Opencl support on hikey960?

Hello,

I’m also waiting for opencl enabled drivers for the Hikey960 on android. [1] shows a userspace driver that seems to contain the opencl symbols. Is this the one promised above?
If so, do I have to take extra steps to integrate them with my kernel?
I am using the android-hikey-linaro-4.9 of [2]. The provided binaries have the version r9p0-01rel0, the kernel contains the define MALI_RELEASE_NAME=r7p0-01rel0.

[1] https://developer.arm.com/products/software/mali-drivers/user-space
[2] kernel/hikey-linaro - Git at Google

Here it is folks - https://developer.arm.com/products/software/mali-drivers/user-space

Credits to Arm. Ignore the description error atm - being fixed as we speak. OpenCL 2.0 is available.

HTHs,
Yang

3 Likes

What kind of kernel support is required for this Open*L library mali-G71_r9p0-01rel0_linux_1fbdev.tar.gz ?
I have seen only these integrated gpu/arm drivers

/drivers/gpu/arm/bifrost-r0p0-06rel0
/drivers/gpu/arm/bifrost-r2p0-00dev0
/drivers/gpu/arm/bifrost-r2p0-02dev0
/drivers/gpu/arm/bifrost-r8p0-00cet0

You can download the kernel driver from https://developer.arm.com/products/software/mali-drivers/bifrost-kernel

I’ve downloaded the ARM Bifrost GPU package and pointed the ICD at the libOpenCL.so driver.

The clinfo utility is able to report some useful (and correct) info but certain queries are failing:

Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded

I assume this means the kernel doesn’t have proper support for the user-space driver?

Can anyone point me in the right direction?

Example:

root@linaro-developer:~# clinfo
Number of platforms                               1
  Platform Name                                   ARM Platform
  Platform Vendor                                 ARM
  Platform Version                                OpenCL 2.0 v1.r9p0-01rel0.37c12a13c46b4c2d9d736e0d5ace2e5e
  Platform Profile                                FULL_PROFILE
  Platform Extensions function suffix             ARM

  Platform Name                                   ARM Platform
Number of devices                                 1
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Device Name                                     <printDeviceInfo:0: get Device Name size : error -6>
  Device Vendor                                   ARM

I have integrated the Bifrost kernel driver into the latest HiKey960 kernel from 96boards at https://github.com/TallGuy74/linux/tree/feature/update-to-mali-r9p0-01rel0

Try compiling that kernel, and install the modules. OpenCL works, but the driver does not have support for powersaving or clock control. I tried modifying the hisilicon platform in the original branch to work with this driver, but that didn’t change anything.

If anyone is interested, I also have a debian 9 (stretch) image with the kernel + modules installed. It boots, WiFi works, and OpenCL works as well. It does not have a mali.icd at the moment, but that’s easy enough to add. No real X support though, as I didn’t look into that. Feel free to ping me if interested, and I’ll set up a download of it.

Bas Vermeulen

1 Like

I have checked out the -b feature/update-to-mali-r9p0-01rel0 branch from your repository.
The kernel compiles and boots on my debian setup (with hikey960_defconfig),
but i don’t see r9p0-01rel0 in the tree.
The modules are disabled. Which .config are you using ?

I’m using this defconfig to build. The driver is built as a module.

Bas

OK, you have used defconfig and not hikey960_defconfig.

No, I modified the hikey960_defconfig and used that instead. Copy my
defconfig to your_defconfig in arch/arm64/configs and do a make
your_defconfig, copy defconfig to .config and compile, or even replace hikey960_defconfig with mine.

Bas

Fantastic! I was going to do the same thing. I’ll try this out tonight.

Did you notice that ARM updated the Bifrost kernel driver to r11?

Do you know if the kernel and user-space driver rXX versions are supposed to match?

I just noticed the defconfig I attached to the email didn’t get attached here.

Please cherry-pick commit 97a703e840eea6a51157abffa332ad4610d2a8e2 and use daedalean_defconfig to compile a kernel with mali support enabled as a module.

Bas

1 Like

I did notice the r11 kernel driver, but wanted to keep the userspace and kernel driver matched as closely as possible.

Bas

1 Like

FWIW, Vulkan 1.0 symbols are in the downloaded libmali.so library but ARM didn’t include libvulkan.so* links.

Hello all and @ric96, I have hikey960 boards, it has android os in it. However, when I run opencl program, it say

terminate called after throwing an instance of ‘cl::Error’
what(): clGetDeviceInfo.

I download mali-450_r7p0-00rel0_android-6.0_1.tar.gz from https://developer.arm.com/products/software/mali-drivers/user-space and pushed libOpenCL.so to hikey. But also get same error shown above.
Can you give me more information about how to give it work on opencl with hikey960?
Thanks you

The mali gpu driver yoi downloaded is only for hikey that uses the 450mp gpu. The hikey960 has only debian linux binaries available publically. For aosp its a wip.

So, does debian linux support opencl?
link https://github.com/96boards/documentation/blob/master/consumer/hikey960/installation/linux-fastboot.md here only directs to aosp not debian.

There is no ready made image, but you can roll your own debian image.

Hi, @bvermeul, is it possible to share your debian 9(stretch) image? I’d like to test some opencl application in HiKey960 board.

Thanks
Ralph

You can download the image here:
http://blackstar.xs4all.nl/debian-hikey960-public.rootfs.img.gz
http://blackstar.xs4all.nl/debian-hikey960-public.rootfs.img.md5

There is an empty root password. When using wifi, setup /etc/wpa_supplicant/wpa_supplicant-wlan0.conf (or something similar). Make sure to set up UEFI boot for the normal rpb linux images, and flash this image as system with fastboot.

2 Likes