Monday, August 27, 2007

Dual Core? Definitely

Austin hinted on the X-Plane news list that X-Plane will in the future use a second core to load scenery much more smoothly than it does in the past. Each time we take a whack at the scenery load code, we reduce the load time by a significant multiple, so we're still not at truly no-pause flying, but we will be getting a lot closer in the future.

A few years ago when people asked "should I get a dual CPU machine" (this was before dual-core chips were ubiquitous) I hesitated to say yes. This is on longer the case - dual core is definitely the way you want to go.

The price performance curve is such that dual core chips are definitely in the sweet spot. In the past a true dual CPU machine costed big bucks, but now unless you buy the absolute cheapest machine, you're going to get a dual core chip. I never recommend buying the absolute cheapest hardware -- usually to get those last few dollars of price savings, the machine (or GPU) has been stripped down of major features, so you're losing tons of performance for really marginal savings in dollars.

X-Plane's usage of the second core has gone up too, already in 860 and the second core will be even more important in version 9.

Our usage of the second core isn't about trying to raise X-Plane's system requirements, it's about not leaving "money on the table". We need to make X-Plane run efficiently as possible on as many combinations of hardware as possible. This means giving you the best flight sim experience you can get whether you have an older single-core machine with a low-end graphics card or a new dual-core chip with the latest huge graphics card and four tons of VRAM.

The important thing here is: usage of dual core chips requires code changes. We have to write new code in X-Plane to teach it how to safely run some work on one core and other work on another. This is all about efficiency - if you have a dual-core chip there is nothing efficient about leaving one core doing nothing! We'd be leaving half the computing power of the chip idle.

So if you don't have a dual-core chip, the sim will still run (just as it does now). But whereas the gap between single and dual-core chips is smaller now (because the dual-core users have half a chip idle a lot of the time), the gap will become larger as we utilize the second core more fully and dual-core users get to really take advantage of all of that computing power.

6 comments:

Anonymous said...

Nice to read that the version 9 is on the pipe ;-)

Jilles said...

what about quad core? Or eight cores? Are you going to be able to make use of more horsepower as it comes available over the next few years, or will this a more dramatic rearchitecting (I imagine so).

Benjamin Supnik said...

More than 2 cores...depends on the part of the sim. So far a lot of our efforts to go to dual-core have not scaled to more than 2 (although some do). There are a few reasons limiting us:

- Sometimes we are taking one task and splitting it in half via recording. Further splits mean more code, if the task has no natural parallelization.

- Sometimes a given task needs to be run by itself and is simply not done on the main CPU.

On the other hand, if enough things "run in the background" we could find ourselves needing more than 2 cores.

At this point I don't think quad-core is worth the money based on the sim's utilization, but I don't think I'm qualified to predict industry trends. We're going to focus on configurations that are common, so if quad core remains "exotic", I think we'll put our efforts into other kinds of acceleration.

(Remember, this is a zero sum game - time spent working on quad-core optimization is time taken away from performance tuning for all systems and performance tuning around the GPU, which is also developing new features that we can be using.)

Sam H said...

I remember, back in the olde dayes of version 6, running two concurrent instances of X-Plane on my dual CPU PII-350 at full speed. They both used the same mouse, etc, which made controlling anything almost impossible. But it was FUN!

Christer Hellholm said...

Couldn't the extra cores (quad or opt core) be used to share the OpenGL render (the new tracable OpenGL) work with the GPU, so we can fly in a more dynamic (true light and shadows effects - and skip night textures) and realistic world (waves in water and inverse kinematics [e.g. flexible wings])?

Benjamin Supnik said...

Christer, I'm not sure what you mean by "the new tracable OpenGL". Generally speaking, the new cores cannot be used to subdivide the main task of rendering the scene because it has sequential dependencies...that is, the ground _has_ to be drawn before the buildings (for example) to get correct rendering.

(More specifically, any time we use translucency or polygon offset, we introduce a dependency in the order that things are rendered. Since both of these techniques are used heavily, the order in which x-plane scenes are drawn is quite important.)

I think the second core could be more useful for moving computational and loading tasks from the main thread than from subdividing rendering.

(Remember also that if there is a single access point to the GPU, e.g. a single PCIe bus, rendering from two threads may reveal bottlenecks.)