SPO600 Project - Stage 1: Selection

Hello again, this post is my summary for Stage 1 of my SPO600 project. I'll be explaining the project in this post but the instructions for this project can be found here. The premise of this project is to add Scalable Vector Extension version two (SVE2) optimizations to an existing open source project. An introduction to SVE2 can be found here. To keep it incredibly short, SVE2 is a new, minor refinement over SVE, which itself is an improvement of SIMD (Single Instruction Multiple Data) optimizations. These are optimizations that improve code that process multitudes of data through a single instruction. Sorry I know this probably isn't the best explanation but that's the best I can do to give new readers some context. So with that let's dive into my project.


Step 1 - Candidate Identification

The first step is to identify some candidates to optimize. As a starting point to look for these candidates, I based my search around video games and the libraries these games used. The thought process is video games are often dealing with a multitude of data per frame: things like visual data or game physics or sound. Through this search I identified 3 possible candidates:

Chipmunk2D - a 2D physics engine written in C (with a very cute name), advertised as simple lightweight and portable. The project includes some arm neon optimizations which sounds promising, and a physics engine likely has to process some multitude of data per frame, possibly making it a good choice. 

Opus - an audio codec, built from processing live audio transmission over the internet. It specifically mentions game chats, video conferencing, and live music performances. There are some mentions of SIMD in the code which is a good sign, and it seems like it needs to process data quickly since the audio is live (though this might work against SVE2 as well, not sure)

SoX - a sound processing program advertised as the "Swiss Army knife of sound processing programs". SoX is capable of converting a wide range of audio formats and apply various effects to them. It can even play and record audio files. There is actually no SIMD optimizations in this package, however the large amount of utility to the package may up the chances of having something that could benefit from SVE2, and converting and manipulating audio files definitely sounds like a package that deals with multitudes of data.


Step 2 - Package Selection

Weighing the pros and cons, I have decided to go with SoX. Chipmunk2D's neon optimizations aren't really optimizations that seem to be able to benefit from SVE2 from my understanding, and it being a physics engine might work against us here, as the physics calculations seem to be based on two objects at a time, and there's no good loops that could be optimized through SIMD.

Opus on the other hand, I have a bit of a harder time understanding truthfully, and I'm sort of intimidated just for that reason. The live data also makes me a bit nervous about whether the optimizations would work under such a specific time limit, and so I decided on Sox, which despite lacking any type of SIMD instructions within the project, I do believe due to the way it handles multitudes of data in loops for multiple different, the project is is likely to benefit from SVE2 in some part.


Step 3 - Strategy for Changes

My strategy for my changes will be to use auto-vectorization. I believe in my professors own words, this is the "low-hanging fruit" and I'm not afraid to admit that I'm not the most ambitious person, especially towards the end of the semester. The process will simply be to see what optimizations the auto-vectorizer is able to come up with, and then test to see what changes the auto-vectorizer has made. In this course we lack the hardware needed to test the performance differences when using SVE2 enhancements, but at the very least I'll be able to search to see how many changes the auto-vectorizer has made, and judge the potential benefit based off that. Depending on where these changes are made, I will then use SoX's built in check functions to see if the project still runs as expected, and if required create my own tests to test the auto-vectorizers changes. Wish me luck!


Step 4 - Project Contributions and Community

The last update according to the SoX website was the 14.4.2 release on February 22, 2015. Patches and tickets on their sourceforge page have been frequent up to May 2021. The website says for changes you want to be added to future releases of SoX, you can use the following commands to commit your changes to a local repo and make a patch for submission:

 git commit -a
 git format-patch -1


 

Comments

Popular posts from this blog

SPO600 - Final Thoughts

Lab 4 - 64-bit Assembly Language Lab - Part 4