Sponsored Feature: Finding the Next Challenge in Visual Computing
September 29, 2010
[In this Intel-sponsored feature, Intel veteran and former Insomniac staffer Orion Granatir starts his 'Core Insight For Core Developers' column by examining the optimization of games for multi-core processors.]
Is programming for multi-core a punishment or a reward? Arguably, it's a bit of both. But with the release of DirectX 11, the work of multithreaded rendering can now be divided into multiple tasks using deferred contexts. The takeaway: it's now a lot easier for game developers to optimize their game applications for multi-core processors.
Five years ago, a new wave of consoles brought the inception of High Definition (HD) content to the videogame industry. Some companies excelled in this era, others did not. Never the less, the industry is now HD.
As evidenced by console manufacturers developing new input controls to extend the life of this generation of consoles, the industry is looking for the next challenge. With the release of DirectX 11, the increasing capabilities of processor graphics, and a new surge of mobile devices, there certainly is plenty to explore.
This is my first column in a series to be published over the coming months. The goals are simple; I will explore the latest and greatest activities in visual computing.
Areas of discussion include threading, processors graphics, DX11, CPU/GPU offload, game engine design, hybrid rendering, and topics suggested by the readers. Please keep me honest by posting comments or sending emails.
Let's get started.
Some think programming for multi-core is a punishment reserved for the eighth ring of hell (I just beat EA's Dante's Inferno, so it's on my mind). But you don't need to fight your way through purgatory to reach multi-core heaven. If you keep two concepts in mind, things get easier:
- Use data decomposition – A game can't scale just by dividing subsystems onto separate threads (sometimes referred to as "functional decomposition"). It has to divide data intelligently to run across multiple cores. The ever-insightful Mike Acton has a great article on this very subject over at Insomniac Games' R&D page.
- Use tasks, not threads directly – To scale on an arbitrary number of cores and be truly cross-platform, work should be divided into tasks. A task is a unit of work (for example a function pointer and data) that can run without (or with very limited) synchronization. These units of work are processed by a thread pool which is scaled appropriately to the available parallelism in the hardware.
By utilizing tasking and data decomposition together, it is possible to take advantage of multi-core for all subsystems. Prior to DX11, rendering was still the locked gateway to heaven. With DX11, it's now possible to divide the work of rendering into multiple tasks using deferred contexts.
Jérôme Muffat-Méridol recently delivered a presentation about DX11 multithreaded rendering at GDC Europe 2010 which detailed methods for doing this. Jérôme lovingly refers to this project as Nulstein.
In previous versions of Nulstein, Jérôme also explored the requirements of building a task scheduler from scratch, but the focus for GDC Europe was multithreaded DX11.
Nulstein 2.0 Game Engine Demo - DX11 Deferred Context
It's interesting to note that DX11's multithreaded goodness can run on DX10 hardware. DX11 supports "feature level," which allows the latest API to be used on a wide range of hardware (provided the application is running on Vista/Win7) by emulating any missing behavior in software.
To learn more, check out the Nulstein demo, articles and presentations.
There is a growing uptake of task-based architectures in game engine design. Mark Randel's implementation of physics and AI in Terminal Reality's Infernal Engine is nothing short of amazing. The fellows over at BitSquid are building a new game engine written with solid support for multi-core.
Furthermore, the Civ5 team at Firaxis is getting great performance out of a task-based approach (check out their GDC 2010 presentation: "Firaxis' Civilization V: A Case Study in Scalable Game Performance").
When I first joined Intel threading seemed so difficult, but it's actually fairly straightforward. I don't want to let you down, so please let me know if there is some challenge with threading you'd like me to address in future columns.
At the recent Intel Developers Forum, Intel announced the 2nd Generation Intel Core processors (codenamed "Sandy Bridge"). This generation of CPUs really ushers in the era of processor graphics. In the next column, we will explore Sandy Bridge and what makes processor graphics so exciting.