|
[In this Intel-sponsored feature article, part of its Visual Computing Gamasutra microsite, Intel Software and
Services Group application engineer Orion
Granatir and PC Perspective editor-in-chief Ryan Shrout introduce the concept and practical benefits behind Intel's multi-threaded Smoke framework.]
After processor technology improvements slowed with the gigahertz race in 2004, a new era in consumer computing emerged with the first multi-core processor to reach mainstream markets. Along with the doubling of processing cores came the promise of doubling the performance, but now, years later, we all know that’s still not the case for some of our favorite applications.
Utilizing the full capacity of multi-core processors requires multi-threaded applications, and developing properly threaded software is a different and more difficult task than traditional coding.
Game development is one area that has lagged behind in the progression of multi-threaded software. With a typical coding structure that involves basically one enormous while loop, games have epitomized single-threaded programs that fed off the pure speed of the processors involved in the gigahertz race.
Now that we are moving in the direction of "more cores" rather than "more clocks," game developers need to adjust their programming models and mindsets to take advantage of the hardware available to the PC and even console gaming communities.
As any modern coder knows threading can be difficult, but although initially constructing a many-threaded game engine requires a significant effort, the reward will no doubt be worthwhile and could span years into the future. (For more details, refer to "Designing a Parallel Game Engine" by Jeff Andrews on http://whatif.intel.com.)
As a manufacturer of multi-core processors, Intel obviously has an interest in promoting the proper techniques that will utilize the full horsepower of its processors. With this intent in mind, Intel developed Smoke, a dual-purpose framework and tech demo that emphasizes the advantages of multi-threaded gaming that is correctly implemented.
It also shows game developers how thread management, resource sharing, and workloads can be balanced to create a highly modularized and flexible gaming engine for both today’s and tomorrow’s CPUs.
What is Smoke?
Smoke is a model framework that maximizes the performance of the processor in a purely gaming environment. Built to take advantage of all available threads, it works equally efficiently on standard dual-core Intel Celeron processors as well as on new Intel Core i7 Processors with Intel Hyper-Threading Technology.
The Smoke video demonstration, shown at many trade shows and technology events, uses modern game-development technologies, including Havok for physics processing, FMOD for audio playback, Ogre 3D and DirectX 9 for graphics rendering, and more. As you would expect for an internally developed demo, the code shows the Smoke framework as a well-partitioned and configurable product.
Intel developed Smoke mainly as a teaching tool to demonstrate the ability to create a framework that can scale to any number of threads. Developers are encouraged to explore the technology by examining new threading techniques and learning about the interactions between various game engine systems that typically hold back a game’s potential threadability.
Intel’s goal through this and other efforts is to help prove that multi-threaded gaming can be done effectively and is an investment in time that is worth taking.
The Smoke Framework
The simplicity of Smoke’s framework design (see Figure 1) is obvious once it is broken down into its various pieces, and doing so clearly shows how the software enables hardware with N-threads to function efficiently.
Figure 1. Smoke framework.
The framework’s design is built around a Scheduler that manages system jobs and a Change Control Manager (CCM) that is responsible for minimizing the traditional drawback of threaded games: thread synchronization. The data structures share data between the various jobs and threads in the Smoke framework and are designed to support independent processing and system modularity with easy-to-develop interfaces.
The Scheduler is the logical component that manages the various system jobs that are determined by each individual system. Once each system implements the proper interface, that system is able to interact with the framework easily and efficiently.
Figure 2. The CCM is responsible for inter-system communications.
The CCM (see Figure 2) reduces the framework’s dependence on heavy thread synchronization operations. For example, if the physics API system changes an object that is also registered with other systems, instead of sending that change to them directly, the other systems are notified of the change at the end of the current frame, allowing them to continue processing the current frame independently.
|
The real chalenge would be using more complex scene to render from 1 thread to 8 threads. For exemple a farm 8 time bigger or with a lot more rigid body.
The Smoke team is working on another demo called Horsepower. This demo is supposed to show “perceivable difference" based on the number of available threads; very similar to what you are suggesting. In Horsepower, with an increasing number of threads the demo will be able to process more objects animating, using physics, and running AI. All of the source code for Smoke is available here: http://software.intel.com/en-us/articles/smoke-game-technology-demo. Please feel free to experiment with Smoke and I’d love to hear what you do with it.
There is a lot of work to do for the last part :)
About Horsepower, it seems to be very interesting, can you give us more informations ?
I'am interesting about horsepower because I'am actualy working on a demo of my own with physics and 3D only, no animation (object or 2D), no particules, no AI. And of course I expected more objects to be compute based on the number of availlable threads :p
We will release Horsepower early next year. This demo adds LODs and multithreaded animation to the Smoke framework. The Horsepower demo shows a hilly scene with a large number of herding horses. The number of horses is dependent on the number of available threads and compute power. Just like Smoke, we are planning on giving away all the source code.
Keep me up-to-date on your demo. It sounds like an interesting project ^_^
You can have videos of our demo over here http://www.acclib.com/2009/01/load-balancing-23012009.html
Like I said before it's just a technological demo, not a game demo :)
Rgds
VIncent
On a corei7, I can deal with 4x more spheres on 8 threads (compare to 1 thread). Test is here : http://www.acclib.com/2009/01/load-balancing-corei7-27012009.html
Vincent
developers will find these series of articles helpful in reaching greater performance in their games.
We have already presented our first phase of optimization work on Smoke at the Intel Developer Forum in September. Luckily, the presentation was recorded and is already live on
Intel Software Network. Part 1 of the video can be found here: http://software.intel.com/en-us/videos/optimizing-a-video-game-smoke-fanning-the
-flames-to-really-make-it-burn-part-1/ which also has links to the rest of the presentation. The slides can be found here: http://www.intel.com/go/idfsessions
The presentation reviewed the demo code design and then showed a complete performance study, with step-by-step use of Intel tools:
- Benchmark and measure a baseline
- Find common memory and data race bugs with Intel® Parallel Studio
- Drill down into hot spots in the code, and highlight why they're hot with Intel Parallel Studio and Intel® VTuneTM Analyzer
- Find concurrency problems with Intel® Thread Profiler
- Show some speedups made in the code
We are planning to release the updates we made to the Smoke code in the coming weeks, which includes a performance speed up and a port of the code to
Visual Studio 2008. Both an executable and source code will be made available, as usual.
Please let us know if you have any suggestions for making Smoke better!