Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCL support for Raspberry pi 4 GPU (VideoCore VI) #86

Open
sandyz1000 opened this issue Nov 17, 2019 · 13 comments
Open

OpenCL support for Raspberry pi 4 GPU (VideoCore VI) #86

sandyz1000 opened this issue Nov 17, 2019 · 13 comments

Comments

@sandyz1000
Copy link

First of all thank you for building OpenCL compiler for VideoCoreIV GPUs. Just wanted to know is there is possibility to support for VC6 GPU devices.

@doe300
Copy link
Owner

doe300 commented Nov 18, 2019

Short answer: no, see also #79.
The VideoCore VI GPU is a very different architecture (e.g. with MMU, without 2 separate register files AFAIK), so supporting it require rewriting most of the compiler.
Also, I don't know of any publicly available hardware and instruction set documentation.

@antonakv
Copy link

@doe300 As I see Eben Upton co-founder of the Raspberry Pi Foundation, has announced open source Vulkan graphics driver for the Raspberry Pi 4 family. So I guess He can share VideoCore VI specs with you as well.

@thortex
Copy link

thortex commented Sep 10, 2020

Does anyone refer to Idein's py-videocore6?
https://github.com/Idein/py-videocore6
It may be useful for VC6CL.

@iDoka
Copy link

iDoka commented Oct 26, 2021

First of all thank you for building OpenCL compiler up to RPi3.
Also can’t wait to see OpenCL support on the RaspberryPi 4.

May it helps https://www.raspberrypi.com/news/vulkan-update-version-1-1-conformance-for-raspberry-pi-4/ ?

@antonakv
Copy link

Maybe there is a way to use Vulkan 1.1 on Rpi4 for Machine Learning instead of OpenCL ?

@truboxl
Copy link

truboxl commented Oct 28, 2021

If Raspberry Pi 4 has Vulkan, then they can use https://github.com/kpet/clvk to get OpenCL out of Vulkan

@antonakv
Copy link

That's amazing news @truboxl
So ticket can be closed then.

@mggevaer
Copy link

mggevaer commented Jan 1, 2022

I tried to get this working:
https://github.com/kpet/clvk
But first off it needs a whole lot of ram to build (4gb ram + 6 gb swap for me). And unfortunately failed to build. Installing Vulkan on RPi isn't straightforward either.
I'm not in urgent need to run OpenCL on RPi, but wanted to post this to point out that this ticket probably can't be closed.
(Unless I missed something and recent developments have led to a better working approach?)

@stolk
Copy link

stolk commented Jun 2, 2023

I can confirm that CLVK in combination with the latest version of Mesa's v3dv Vulkan driver, you can get OpenCL on a rPi4.

Unfortunately, important extensions are missing. The v3dv Vulkan driver can't do FP16 (16 bit floats.) Nor can it do 8 bits integers. This limits the usefulness for me personally, as my kernels are written to operate on FP16 values.

If your kernels don't use FP16 / INT8, you may have better luck than me, though.

@nullr0ute
Copy link

I suspect the best way to get a decent supported OpenCL will be using the mesa gallium driver in conjunction with the new mesa rusticl opencl stack. rusticl is being actively developed and a there has been support added for a bunch of other arm GPUs that support opencl (panfrost for MALI, etnaviv for Vivante).

@stolk
Copy link

stolk commented Jun 9, 2023

the new mesa rusticl opencl stack.

It can find the rusticl platform.

$ clinfo --list
Platform #0: Clover
Platform #1: rusticl

But it cannot find any devices:

$ clinfo 
Number of platforms                               2
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 23.0.2
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   rusticl
  Platform Vendor                                 Mesa/X.org
  Platform Version                                OpenCL 3.0 
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions with Version                cl_khr_icd                                                       0x400000 (1.0.0)
  Platform Numeric Version                        0xc00000 (3.0.0)
  Platform Extensions function suffix             MESA
  Platform Host timer resolution                  0ns

  Platform Name                                   Clover
Number of devices                                 0

  Platform Name                                   rusticl
Number of devices                                 0
...

This is with Ubuntu 23.04 on rPi-400.

$ inxi -G
Graphics:
  Device-1: bcm2711-hdmi0 driver: vc4_hdmi v: N/A
  Device-2: bcm2711-hdmi1 driver: vc4_hdmi v: N/A
  Device-3: bcm2711-vc5 driver: vc4_drm v: N/A
  Display: wayland server: X.Org v: 1.22.1.8 with: Xwayland v: 22.1.8
    compositor: gnome-shell v: 44.0 driver: X: loaded: modesetting
    unloaded: fbdev dri: vc4
    gpu: vc4-drm,vc4_crtc,vc4_dpi,vc4_dsi,vc4_firmware_kms,vc4_hdmi,vc4_hvs,vc4_txp,vc4_v3d,vc4_vec
    resolution: 1280x768~60Hz
  API: OpenGL v: 2.1 Mesa 23.0.2 renderer: V3D 4.2

@nullr0ute
Copy link

the new mesa rusticl opencl stack.

It can find the rusticl platform.

$ clinfo --list
Platform #0: Clover
Platform #1: rusticl

But it cannot find any devices:

There's probably some driver work required, but ultimately that will be the best/quickest way to get GPU HW OpenCL on the rpi4

@Pepslee
Copy link

Pepslee commented Jun 16, 2023

I can confirm that CLVK in combination with the latest version of Mesa's v3dv Vulkan driver, you can get OpenCL on a rPi4.

Unfortunately, important extensions are missing. The v3dv Vulkan driver can't do FP16 (16 bit floats.) Nor can it do 8 bits integers. This limits the usefulness for me personally, as my kernels are written to operate on FP16 values.

If your kernels don't use FP16 / INT8, you may have better luck than me, though.

Can I make a build in docker on the amd64 platform with arm64 emulation ? It might to decrease building time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants