Friday, December 01, 2006

Stop It With The Extra Cores Already!

Game programming is a very monolithic and event driven. I should restate that... it has been very monolithic and event driven. And now with machines like the PS3, there are five bazillion (slower) cores on a CPU die instead of a single, long-pipeline overclocked processor. So if you're going to see any speed bumps in your code, you need to find a way to separate your engine logic out into multiple threads.

This is hard, mainly due to resource contention and scheduling synchronization. Gamasutra has a very down-to-earth and easy to read article of the different multithreading architectures developers are evaluating, along with the pros and cons of each.

To see how someone has actually implemented these architectures, or hybrid versions of them at least, one can look at how Valve has threaded their system. Not only did they have to make their events more atomic, they had to re-order and redesign their entire render pipeline. I still don't quite get how one can do animation in a separate thread (you'd think it would need to be synchronized with shading/rendering/drawing/blah), but the results do seem impressive.

The crazy thing was that they said threads spent 95% of the time reading memory, 5% writing. That's insane. But again, the results speak for themselves.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.