Original Post
Have you guys read the Intel Smoke article? It should be quite old news by now, and I suppose most of you engine developers have already seen it a long time ago (first on Intel site and then at Dj Dobb's, and whereever else it has been posted at). Now this time they republished the article at Gamasutra just a moment ago, where it caught my attention once again. Gamasutra: Sponsored Feature: Designing the Framework of a Parallel Game Engine or the old (Nov 2008) link to the same article at Intel website. Source and exe download is available here: And if you're lazy, there's just a video here: ">YouTube: Intel Nehalem Smoke Demo I tried to search for a thread where the design would have been discussed before, but couldn't find one. My first question is that what is your take on the article? Anyone followed the design all the way to their own implementation? Anyone read the article in detail? I've played with the demo for a while, and have tweaked the code a bit to try to get some performance estimates on how it might perform in my application, but it's difficult. My issues with the demo was the following. Most of the threads run at <5% most of the time: Geometry, AI, Audio, Scripting, Input, Animation, Procedural Trees, Volumetric Smoke. Two threads, Graphics and Physics, are running at about 10%. The big performance hog in the whole application is Procedural Fire, which takes 30%-50% of the time. Now, this is a really bad demo in this respect, as procedural fire simulation is not something you would need a "generic" parallel architecture for, since you could easily contain the fire simulation to run on its nonshared data without having to complicate the grand-scale application design. And it is questionable as to how much it makes sense to parallelize Input updates for example. The performance statistics seem smelly. I had a case where the procedural fire was reported to take 118% of the time. What does that mean.. Also, if you sum all those percentages up, most of the time the sum is less than 50%. Does that mean the other 50% is spent in sequential synchronization points? The resulting performance compared to the amount of visual complexity (disregarding the fire) is underwhelming. On my Intel quadcore system, all the 8 threads go at about 90%, but I get less than 30 fps most of the time. Looking at the number of objects in this scene, I would be expecting a lot more. To the article then. I'm surprised that, coming from Intel, how low the quality of the writing seems to be. I'm not a native english speaker, so that might affect my ability to consume the text, but to me it seems to be filled with difficult ways to put words. For example,
Quote:
The Smoke article, paragraph 3. "The interfaces are the means of communication between the engine and the systems. Systems implement the interface so that the engine can get access to a system’s functionality, and the engine implements the interface so that the systems can access the managers."
Quote:The first paragraph says the systems can access the managers, but the second paragraph contradicts that the managers are not accessible by the systems. Now, after looking at the code it is clear that the individual systems do gain the access to the managers, but the article is just being horribly misaccurate in ways like this.. Now, the point of this post is obviously not to focus on bashing the demo. What I'd like to know is what you think as game developers about their overall design? Did you get something out of it? Did you/Are you going to model your next architecture according to something similar, or even be bold to take it directly as the base design? Do you think it's flawed/useless/using a wrong approach? Do you think it's overcomplicated? I'm being really cautious about giving too much time to entertain this kind of design in our next project, especially since that demo doesn't really make go "wow, cool!" in any way (it's slightly the opposite). But I don't want to turn down a new idea, hence trying to raise some discussion. Then the obvious second question. How do you utilize multiple cores in your engine? No need to write a "minitutorial", I'm quite familiar with several techniques, and so far I've usually gone with one of the two different approaches. In an old project I've used a simple OpenMP-style "parallel for" data parallelization methods inside a sequential game loop, and in a more recent projects I've usually utilized "hardcoded" threading, where I manually craft the different thread systems (usually just main loop, AI, renderer and data loading) that are needed and explicitly define their synchronization boundaries. The first approach (OpenMP) is just devilishly easy. Small oneliners to your foreach(particle), foreach(skinnedobject), foreach(physicsupdatable), etc. Also, complex subroutines like PVS queries from an octree (and updates) have usually deserved their own multithreaded approach, but as the whole app is sequential, it's very easy to reason about. The second approach is not that difficult to implement either. The possible "worry" about it is that you would be explicitly writing the threading system (thread code, identifying what data is shared and needs to be locked, how to signal/message between threads, possible timing/waiting semantics, how to do updates back and forth and so on) for each threaded task separately, which of course requires effort. The good side of this is of course that all the threads you create and their cooperation will be manually crafted to yield the best possible performance. There will be no unnecessary data in shared memory and so forth. Now, I'm more interested in what do you think about these kind of more "generic" parallel architectures, where the whole system is revolving around frame tasks being solved by different threaded subsystems, the synchronization mechanisms of which are specified in an abstract way, like in the Intel Smoke demo. Do you think there is a big point to those? Are you doing something like this? What do you think about flexibility or performance in this kind of architecture? If anyone has a summary of profiling statistics from their projects, those would be interesting to read as well. Last note, I'd like to keep any discussion away from Larrabee/CUDA/GPGPU/alternatives. Last last note, anyone have the Game Programming Gems 6 that has the article "Managing High-Level Script Execution Within Multithread Environments" and do a quick one or two lines of review about it? Finally for reference, here are some related game multithreading articles around the web, hoping they might ease the discussion: A short survey to different techniques (not that descriptive, read the references section): Gamasutra: Ville Mönkkönen: Multithreaded Game Engine Architectures Threading for game logic updates. Very interesting, but I'm more interested in threading at the whole application level: AiGameDev.com: Parallel Game Logic with Independent Entity Updates AiGameDev.com: Alex J. Champandard: Hierarchical Logic and Multi-threaded Game AI Very good source for general high-performance threading programming: Dr Dobb's.:Go Parallel Blog Dr Dobb's applied to games: Gamasutra: Gabb, Lake: Threading 3D Game Engine Basics GarageGames: Eric Preisz: Multithreading in games- the future, the scam! Gamasutra: Tommy Refenes: Sponsored Feature: Multi-Threading Goo!: A Programmer’s Diary
The Smoke article, paragraph 4.2. "The managers, even though they are singletons, are only directly available to the framework which means that the different systems do not have access to them."