Weekly Progress Report Thread: GPGPU with GLES

Hi,
This is weekly report thread for the GPGPU with GLES project for GSoC 2021. My mentors are Iain Hunter and Hunyue Yau. This thread will be updated in a weekly manner so that interested people may track the progress of my project. The more in-detail progress plus my ramblings on topics related to the project may be found here.

The github repository containing the project code is under this link.

My accomplishments so far (week 1 + 2):

  • Set up the Beaglebone Black and flashed an image with PowerVR EGL and OpenGLESv2 support
  • Set up network forwarding via USB on the BBB
  • Wrote CMake files for building the GPGPU library with examples, following the famous CMake guide
  • Learned about EGL and its extensions
  • Experimented with various EGL settings to get a headless display and context for rendering to it
  • Wrote the init() function of the library to test context creation
  • Wrote a simple example for the library testing
  • Recorded the introductory video on the subject
  • Set up Libera IRC bridge with the Matrix client due to recent issues with the Freenode IRC

Current-blockers:
Being sure that context creation will work on every image (if not then I will have to stick to just the Imagination image for now).
Figuring out how can I modify input data via shaders.

Resolved blockers:
N/A

Plans for next week:
Writing shaders for data computation (array addition, FIR filtering, Matrix multiplication) and embedding it into the library. Also writing all the necessary glue code for GLES calls and fleshing out library functions. Start writing documentation for the library.

Week 3
Last week was mostly spent on expanding my knowledge and reading up on various GPGPU techniques and about OpenGL ES/EGL capabilities and about Linux graphics stack.

Accomplishments:

  • Polished CMake files and added configuration for external EGL/GLES libraries
  • Used GBM for context device and surface creation
  • Wrote basic vertex shader for GPGPU computing
  • Wrote fragment shader for array addition (2 arrays)
  • Wrote necessary glue code for GL calls (shader creation/attribute/uniform binding)
  • Wrote framebuffer creation for GL_FLOAT textures (for now fails to work even though both host and BBB support this GL extension)
  • Updated basic (array addition) example

Current blockers:
It seems like I cannot use GL_FLOAT for textures in the FBO (framebuffer object), thus I will try to compute the array addition using GL_BYTEs instead. Also the EGL context issue on BBB is not tackled yet.

Resolved blockers:
I learned how to use shaders to compute the data from textures. I use the vertex shader to perform identity mapping of the data and then do the actual computation in the fragment shader.

Plans for next week:
Resolving my blockers and getting the computation running. Realizing the last week’s plans (they should be faster to implement once the general core of the library is functioning fine both on the host and target). Write a blog post detailing how the library functions as OpenGL is quite complex and took me a while to understand what exactly is going on.

Week 5
This week’s update is full of awesome news! The library is finally computing something. In fact, both the array addition and 2D convolution work in the GPU which puts me back on track. The headless issue on BBB will be circumvented using a headless plug

Accomplishments:

  • Added array addition
  • Added 2D convolution
  • Refactored code and split it into multiple files
  • Fixed shader code to rescale properly
  • Wrote a new example for 2D convolution

Current blockers:
The only blocker (semi-blocker) is being handled by Imagination in this query

Resolved blockers:
The actual computation is working! Also the headless plug will obviate the EGL context creation problem on BBB.

Plans for next week:
Benchmarking the functions both on the GPU and CPU and seeing how big the difference is. Minor tweaks and TODO’s to resolve in the library. Testing the headless plug to see if it solves the context creation problem. Testing the code on BBB. Writing documentation and blog explaining how the library works.

Week 6
As planned, this week was dedicated to porting the code to BBB. It was successful, albeit with some changes and minor tweaks. The EGL context is created in less precision (16-bits) because of some bug in driver code/PVR libraries which causes 32-bit contexts to spur a CRTC error. I also wrote benchmarking code which I used to create several benchmarks.

Accomplishments:

  • Ported the code to BBB
  • Added fixed-point 16-bit array addition
  • Wrote benchmarking code
  • Benchmarked the computations of array addition

Current blockers:
Same as before the headless context creation is being handled by Imagination in this query. Additional blocker is creation of 32-bit contexts on BBB (SGX530) handled by Imagination.

Resolved blockers:
Computing on the BBB!

Plans for next week:
Adding the chaining operations and exploring how many operations have to be chained on the GPU to compensate for GPU<=>CPU transfers. Fix convolution2D to work on BBB, add convolution 1D.

Week 7 + 8
Week 7 was another major breakthrough. I was able to implement 32-bit computation on the BBB with help of Omar from Imagination.
Also I implemented the computation chaining API so now different operations may be chained and the overhead of data moving to and fro CPU and GPU is mitigated.
Week 8 was more of a documentation writing week, as I have my university programme summer school.

Accomplishments:

  • 32-bit computing on BBB!
  • Added chaining API
  • Added Conv2D 5x5
  • Ported Conv2D 3x3 and 5x5 to BBB
  • Benchmarked the convolutions on both host and BBB
  • Wrote the Library Innards blog post explaining how it works on the low level

Current blockers:
Same as before the headless context creation is being handled by Imagination in this query.

Resolved blockers:
32-bit rendering on the BBB! YAY!

Plans for next week:
Writing documentation and more benchmarks. Add additional operators for computations.

Week 9 + 10
During Week 9 I finished my summer school and won with our Medpipe project (assisting patients which go through long rehabilitation and surgeries with a companion app)! What a week it was!

Additionally I updated the README of my repository and wrote the final report. I also added the broadcast operators for both scalars and two arrays elementwise. I cleaned the repository structure and removed some redundant code and comments.

Accomplishments:

  • Wrote README
  • Wrote project report
  • Added broadcast scalar operators
  • Added elementwise array operators
  • Added noop benchmark
  • Updated the benchmark post
  • Cleaned up the repository

Current blockers:
Probably already solved, but being tested by Imagination - headless rendering query.

Resolved blockers:
None

Plans for next week:
Sit back and relax :relaxed:!

1 Like