mn416 / QPULib

Language and compiler for the Raspberry Pi GPU
Other
430 stars 63 forks source link

Add VPM size to detectPlatform output #57

Closed wimrijnders closed 4 years ago

wimrijnders commented 6 years ago

Now that DMA is enabled, it's interesting to know what the actual size is of the VPM. This adds it to the output of detectPlatform.

Example output:

> sudo obj-qpu/bin/detectPlatform
Detected platform: Raspberry Pi 2 Model B Rev 1.1
Hardware revision: a01041
Number of slices: 3
Number of QPU's per slice: 4
Size of VPM: 12KB                    # <-- This is new

NOTE: This will probably not work on your machine until #52 and #53 have been merged.

wimrijnders commented 6 years ago

So, the VPM can hold 192 blocks of 16-floats at any time.

If I read the reference doc properly, the VPM is also used for outgoing data, so assume 96 blocks for incoming data.

This means that when utilizing all 12 QPU's, you can prefetch 8 full groups of data with DMA. There is definitely room for keeping the QPU's busy here. Looking forward to maximal utilization of this.

EDIT: If you can reuse the blocks for incoming data for writing back the results, it will be double that! Very exciting this. I'm hoping that I'm smart enough to figure how to make this work, otherwise I'm really hoping that you implement it.

wimrijnders commented 6 years ago

Also, I think it is now possible to use the VPM for local storage of data, correct? This opens possibilities. Or would you regard it as an abuse of the VPM?

wimrijnders commented 6 years ago

Examined the VPM register definitions in the reference docs, p56 onwards. It's appears that I was overly optimistic in my utterances. Please confirm if the following is correct, if you can:

A given QPU can initiate at most one DMA read and one DMA write at any given time. However, the read and the write can overlap.

In addition, I encountered something about limits of VPM usage with respect to given shader types. So possibly not all of the VPM is available at any given time. However, OTOH, it's possible to configure what shaders are allowed to use the VPM.

So my grand scheme of maximal prefetching is not possible. Time to start thinking about something else right now.

wimrijnders commented 6 years ago

Last commit: Added two more methods to RegisterMap, which I'm interested in: