Mar 16 2008

Cross Core Code

Published by mdanks at 9:51 pm under Code

I have been dealing with multicore code lately. This is both at work and in my spare programming time. At work, the PS3 is an interesting problem because there are heterogenous CPUs (the PPU and SPUs). It becomes more complicated when there is not unified memory. Licensed PS3 programmers can download my C++ template class which tries to address this problem. At home, I am programming on a dual-core Wintel box, and in some ways it is not any easier.

Previous to my game career, I used to do high end medical VR. Many, many years ago, I had an SGI Onyx as my “desktop” computer. With all of the extra hardware like dual graphics pipes, Polhemus sensors, gloves, and head displays, I probably had around a million dollars of hardware for my personal use. However, even though I was on a quad-processor Onyx, there were exactly the same problems which I am dealing with today…and my computing and graphics power is probably much greater now.

I have seen people write code to mask the differences between the various threading systems, like pthreads, win32 threads, SPU tasks, etc., but it never feels right. I guess that most of what I have looked at feels like a hack. In the PS3 model, you want a ton of little tasks. In the XBox360/quad-core model, you want monolithic threads which use each core fully. Thankfully, the little task model works fine on the XBox360 (as developers are beginning to figure out). It is still up to the developer to understand what of their data is read-only vs read/write, since that can make a huge difference in a non-unified memory environment. At home, with my brush work, I am looking at how to parallelize the brushes across multiple cores to try and get to interactive rates.

In the end, this post is more musings and rants about the current state of things. In general, most game developers are beginning to realize that the raw performance of their code is much less important to the memory model and data traversal. And with most CS students out of college learning C# and Java, they really do not understand what is happening at the raw RAM level…

No responses yet

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.