doe300 / VC4CL

OpenCL implementation running on the VideoCore IV GPU of the Raspberry Pi models
MIT License
728 stars 80 forks source link

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

Open sandyz1000 opened 5 years ago

sandyz1000 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

@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 commented 4 years ago

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

iDoka commented 3 years ago

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 commented 3 years ago

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

truboxl commented 3 years ago

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

antonakv commented 3 years ago

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

mggevaer commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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