PS3 and parallell programming

Posted by Martin Vilcans on 26 May 2005

The demos of the Playstation 3 from E3 raised by interest in that machine. I have read a little on its CPU architecture, which seems quite novel. It uses IBM's Cell architecture - which is based on processor cells containing nine CPU cores. One of the CPU cores is likely to be something like a PowerPC processor, and the remaining eight cores are powerful vector processors, each with its own 256 KB of memory and DMA channels to the main memory. Several cells can be connected through high-speed buses, ethernet or whatever and work as a multi-processor system. This is based on Nicholas Blachford's interpretation of the patent documents. He's very enthusiastic about the processor. There is also this article, but I haven't got the time to read it yet.

The design philosophy for these processors is centered around simplicity and speed. By making the processor simple, they can make it faster. This places more of the burden on the programmer and/or the compiler, just like the RISC philosophy compared to CISC. RISC is old news and should be no problem for a good compiler, but we as programmers are currently facing another problem: New processor architectures utilize different kinds of multithreading to increase speed. It is no longer as easy to pump up the clock frequencies of the CPUs, so hardware developers go other routes, using hyperthreading, multicore or multiple CPUs to increase the power of the system. This requires the software to explicitly handle parallelism, e.g. by multithreading to get any performance. There is no widespread compiler that can generate multithreaded code automatically, and with today's popular programming languages it may take time before we see one. Instead, we must take care of the parallelism explicitly in our code.

On this problem, Herb Stutter says that The Free Lunch Is Over. We programmers can no longer rely on Moore's law (which isn't a law anyway, it's just a historical observation) to get us out of performance problems. We need to grasp the concepts of parallelism. The CPU manufacturers are going down that path, and we'll have to follow.

This is a huge problem, since parallel programming is hard to do correcly and no popular programming languages support it very well. Yes, Java has threads and synchronization built-in, but they are low-level concepts and not very simple to utilize. I guess there are many "academic" programming languages with good support for parallelism. Perhaps one or a few of these will find its way to the mainstream. Otherwise the currently popular languages will have to adapt.

Back to the Playstation 3. It looks like it will be mighty cool. The Cell architecture seems to be the right way to go for a game console, as games often rely on lots and lots of vector calculations, and not all of them are for the graphics, so it makes no sense do do them on the graphics chip. (Currently, the GPU is sometimes used for physics calculations or even data encryption.) I guess we can't rely very much on the compiler to utilize the new hardware very well, so PS3 programmers will probably need to get their hands dirty with the hardware specifics. But that's not necessarily a bad thing. Getting dirty is fun! (Which incidentally is the theme of Via's (the detergent) current ad campaign on Swedish TV and in Stockholm's subway.)

Next: The D programming language

Comments disabled on this post.