Live data from Hacker News

LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

github.com

11–20 of 54 posts

Re: LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

#12

What can you do with this?

Lessen the burden from the relatively weak ARM core used as CPU. The VPU seems very potent.

The RPi can handle playing back video (1080p) very well. Raspbian comes with omxplayer which uses the GPU to play video.

Re: LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

#13
post #4

Earlier quoted context omitted.

This has some additional info from the author: http://crna.cc/

I get that it's a compiler backend for the GPU of the Raspi, but what does that mean? I mean, can you compile arbitrary C code to run on the GPU? Is this for making a GPU firmware? Divers? games? Bitcoin miners?

Any and all of the above.

Although the VideoCore in the Pi is particularly interesting because it's responsible for the early stages of the Pi's boot process (the ARM cores are actually turned off when you initially apply power). Right now, that's all a big Broadcom-proprietary binary chunk; good compilers would be the first step towards freeing that code.

Re: LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

#14

What can you do with this?

To elaborate, I made this to develop an open source VPU side bootloader for Raspberry Pi because I was unhappy with the state of other C compilers targeting VC4 (I explained why in my blog). I haven't had the time to work on my firmware recently due to IRL events so I decided to publish the compiler.

Not publishing any of the firmware work yet since it can't boot ARM yet (but SDRAM init reliably works across all boards). Once I get ARM working to some extent, I'll probably clean the code up and publish it too.

Re: LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

#15
post #7

You can run C code on GPUs? I don't know anything about GPUs, but I thought they had a completely different programming model that requires different programming languages and paradigms.

Yup. Check out the VideoCore ISA: http://www.broadcom.com/docs/support/videocore/VideoCoreIV-A... Note that in this case, the author is writing the bootloader firmware so performance isn't a major concern, though.

This isn't the same, the document in question relates to the QPU ISA. The VPU ISA hasn't been officially documented but there were many projects that involved reverse engineering it. The VC4 ISA is documented here:

https://github.com/hermanhermitage/videocoreiv

The VPU is basically a general purpose RISC processor with some fancy vector instructions on top. In fact, most of the firmware that runs on it is written in C.

Re: LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

#16
post #7

You can run C code on GPUs? I don't know anything about GPUs, but I thought they had a completely different programming model that requires different programming languages and paradigms.

They do. Or, at least they did. But, their capabilities have been improving rapidly for a couple decades now. To the point that shader compilers are integrating recent C++ features and some degrees of straight-up C++ support. You won't be able to magically run classic, single-threaded programs fast. But, you can start using advanced features you already know from CPU programming to write programs for the GPU.

Re: LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

#17

It bugs me that LLVM targets are not properly 'plug in'. LLVM backends can be in a plugin, but you have to tell the frontend which target to use (so it can use the correct data-layout etc). Its the frontends that don't support plug-in targets. Clang, for example, hardcodes the supported targets. A combination of using enums as a 'target triple' and lack of dynamic target registration conspire against easy-to-use out-…

"A combination of using enums as a 'target triple' and lack of dynamic target registration conspire against easy-to-use out-of-tree targets :(

Have you considered this is a deliberate decision, with a goal of having most targets in-tree? :)

Re: LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

#19

What can you do with this?

To elaborate, I made this to develop an open source VPU side bootloader for Raspberry Pi because I was unhappy with the state of other C compilers targeting VC4 (I explained why in my blog). I haven't had the time to work on my firmware recently due to IRL events so I decided to publish the compiler. Not publishing any of the firmware work yet since it can't boot ARM yet (but SDRAM init reliably works across all boar…

This is awesome! It seems like an important series of steps towards having a legitimately-open educational platform, rather than the somewhat asterisk-laden one that the Pi currently represents.

Re: LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

#20

Earlier quoted context omitted.

Yup. Check out the VideoCore ISA: http://www.broadcom.com/docs/support/videocore/VideoCoreIV-A... Note that in this case, the author is writing the bootloader firmware so performance isn't a major concern, though.

This isn't the same, the document in question relates to the QPU ISA. The VPU ISA hasn't been officially documented but there were many projects that involved reverse engineering it. The VC4 ISA is documented here: https://github.com/hermanhermitage/videocoreiv The VPU is basically a general purpose RISC processor with some fancy vector instructions on top. In fact, most of the firmware that runs on it is written in…

Ah okay, this explains a lot! I somehow thought that the initial boot happened on the QPU.
Post reply on HN