Original Author: Jaymin Kessler
After a 1 year hiatus from the site (including a bit of crunch), I thought I’d try to start making videos again. Hopefully I can also finish a bunch of the almost dones and post them as well. I apologize in advance for how hastily I threw this together.
Implementing absolute value using only odd instructions on the SPUs.
To me, the most fun part of programming is finding fun and creative ways to use an ISA. There are few joys greater than exploiting really weird instructions in ways they may or may not have been designed for to save a few cycles. While the solution to this one didn’t really involve anything too crazy, its was still quite a fun puzzle.
This one was inspired by a challenge posed to me by Cort Stratton of Naughty Dog ICE team fame. We were at a Sony dev con and everyone was going out drinking, so of course we decided to break off from the group and talk about programming. There he challenged me to find a way to implement absolute value using only odd instructions. The answer I gave him was, in his own words, a little “floaty” and “not too concrete.” I mumbled some lame excuse about arriving in NJ the day of Superstorm Sandy, spending 3 days jetlagged with no electricity or internet, before catching a flight to cali for the conference. I also promised him that I would send him my (more comprehensible) answer as soon as I got back to Japan.
One and a half years later my answer still isn’t concrete. Its still floaty and inexact. It may not even be correct. But this time it has nice pictures and animations to go along with it.