Thursday, April 05, 2007

CPU or GPU

If your X-Plane is framerate low, or you want to increase your rendering quality, you might think "time for a new graphcis card But is it?

Some rendering settings actually tax the CPU more than the GPU (graphics card). Here's a simple rule of thumb: if you increase the setting (and restart X-Plane) and your frame-rate does not go down, a new graphics card isn't going to make it go up!

For example, if you have one of those new-fangled GeForce 8800s, you may have noticed that when you turn on FSAA the framerate doesn't dip at all. That's because the 8800 is insanely overpowered for X-Plane (at normal monitor resolutions) and has plenty of extra capacity that will be sitting idle on an older PC. When you turn up FSAA, you are simply wasting less of the card's excess capacity. It goes without saying that if there were a card faster than the 8800, it wouldn't improve your fps any more than the 8800, it would simply be even more bored.

Here's a rough guide to which features tax the CPU vs GPU:

CPU-Intensive
  • World Level of Detail
  • Number of Objects
  • Draw Cars On Roads
  • Draw Birds (not that expensive for modern machines)
  • Draw Hi Detail World
  • World Field Of View (wider view means more CPU work!)
GPU-Intensive
  • Texture Resolution (requires more VRAM)
  • Screen Resolution
  • Full Screen Anti-Aliasing (FSAA)
  • Anisotropic Filtering (most cards can do at least 4x)
  • Draw Hi-Res Planet Textures From Orbit
  • Cloud Shadows and Reflections (not that expensive)
  • Draw Hi Detailed World

A few specific framerate-optimization warnings:
  • FSAA is equivalent to a higher screen resolution - that is, running at 2048x2048 and no FSA is similar to running at 1024x1024 and 4x FSAA. Both of these tax the video card with virtually no CPU increase. This is probably the only setting that can be helped only with a video-card upgrade.
  • Texture resolution: do not worry if the total size of all textures loaded is larger than the VRAM of your card. To find out if more VRAM would help, measure frame-rate with your normal settings, with texture resolution down a notch, and with anisotropic filtering down a notch. If turning texture resolution down increases fps more than turning down anisotropic filtering, more VRAM may help. Machines with faster graphics busses (like PCIe x16) will be less sensitive to VRAM.
  • Most Important: do not ever turn "World Detail Distance" beyond the default setting - you will simply destroy your fps and chew up your CPU for no benefit. I strongly recommend trying "low" for this setting - if you like a lot of objects, this setting can make a big difference in performance.
  • The number of objects is virtually always a factor of how fast your CPU is, not your GPU -- that is, most GPUs can draw about a gajillion objects if the CPU could only get through them fast enough. If you are unhappy with the number of objects you can draw, do not expect a new graphics card to help - it probably won't.
  • Cars on roads hurt fps on machines that don't have the fastest CPU.
  • Draw Hi detail World is doubly dangerous - it uses both the CPU and GPU. Quite literally this is where we stash "luxurious" options. Everything this checkbox does chews up framerate. (If these options didn't, we'd leave them on all the time!) So you should not use this option if you aren't happy with fps, if you don't have a fast CPU, or if your graphics card isn't that modern. (HINT: if your nVidia card has "FX" in the title, don't use this!)
Start with the default settings and experiment - turn a setting up one notch, then restart, then turn it down and try another. Different machines will be faster for some things and slower for others.

EDIT: one user correctly determined (by observing CPU utilization relative to settings) that puff-style 3-d clouds bottleneck the GPU, not the CPU! This was not what I expected - when Austin originally wrote that code, our measurement indicating that sorting the puffs from far to near taxed the CPU a lot, making this CPU-intesive. At the time the old Rage 128s would also get bogged down by filling in translucent puffs as you flew right into the thick of the cloud.

Times have changed and neither the sorting nor the alpha-drawing is even remotely expensive on a modern machine. So I was surprised to see the CPU not being used. After some investigation, it turns out that while the CPU and GPU have gotten a lot faster over time, the communciations channel between them has not. The result is that they both do their jobs really quickly, and as a result clog up the communications channel...the CPU simply can't talk to the GPU fast enough to get the clouds out.

This is a great find by this user, as this is something that didn't matter on old machines, but can be optimized in the future for new ones.

14 comments:

Alejandro Garcia said...

nks Ben, very easy and well explained. Maybe you'll do this but, can you talk about RAM?

Benjamin Supnik said...

Sure, but what is the question exactly? :-)

Alejandro Garcia said...

well, not any specific question, but in spanish forums (more in x-plane.es)people ask about a guide like yours (about cpu and 3D card) but for RAM. Something like what needs more ram and what less.

Cheers
Alejandro

Anonymous said...

How does cloud generation figure in the list, I find this very gpu expensive ?

Benjamin Supnik said...

2-d clouds (cirrus, etc.) are cheap for the CPU and GPU.

3-d clouds (broken, etc.) are usually more CPU-taxing but don't affect any GPU that meets X-Plane 8's system requirements.

(They used to tax the Rage 128, but it doesn't meet minimum requirements.)

Anonymous said...

If 3D clouds don't affect a modern GPU (X1600), why does my CPU usage go from 100% to 60% (out of a potential 200%) when I enable them? Something must be holding my CPU back when I enable 3D clouds. I'm using a dual core intel iMac with 1.5GB of RAM.

Benjamin Supnik said...

Short answer is -- I have no idea. Please email me three screenshots in this config (that limits CPU use to 60%):

- Rendering settings
- Weather settings
- Screenshot of flying like this, with the data output for fps on screen, as well as lat/lon/altitude and camera location.

please send all as uncompressed original pngs.

Anonymous said...

Mine is like a bug report, but will probably contrast more on influence of larger memory on overall experience.

I am running a quad core Mac Pro. I presume, you won't question Apple's stupidity (money-hunger, if I may) of shipping only 1 GB memory with a 4CPU system. Anyway, I have recently bought 2GB more and now I have 3GB of memory. In 1GB days, I was not able to:
1. Complete a long flight
2. Load a situation movie and make a QuickTime movie
3. Position aircraft to another airport (which is usually on another continent)

I suspected memory, because right before X-Plane gets stuck, I hear disk is spinning and VM usage peaks (X-Plane approaches well around 1 GB, entire system is closer to 10GB marks). It's bluntly funny to see X-Plane to get stuck, if you enable too many options (or, if you overestimate your PC's CPU-GPU power). After making Apple happier by buying extra 2GB memory, my Mac can afford more visual options.

I would love to learn, on a quad core Mac Pro (Intel) with 1GB and NVIDIA 7300GT (256MB), why X-Plane gets stuck. I am familiar with FreeBSD (and Windows, of course), but not with Mac OS X. Therefore, I have absolutely no idea what kind of features (API) does Mac OS X have that enables applications to handle out-of-memory conditions (well, assuming it's an out of memory, but may not be). X-Plane runs, I can see it makes syscalls and it's swapping, it's even calling some OpenGL functions. Nothing but a kill (force quit) helps.

I can enable many more CPU-intensive options, but this breeds another question; is X-Plane ready (i.e. designed with parallelism in mind)? You see, we have 4 core CPUs, we can make hundred core CPU, but this doesn't make any sense to most of software we use today, because payload is not designed to fit on to multi-core system! The first example I can think of right now is Microsoft Flight Simulator X. It might be designed concurrency in mind, but it just wasn't good enough because it didn't go any faster with my 4 CPU computer. Hopefully, they are fixing this.

Since X-Plane is the only simulator on Mac OS X, which is today shipped with at least 4 CPUs, it'd benefit a lot by implementing parallelism.

Regards,
Ismail

Benjamin Supnik said...

Hi Ismail,

Please email me directly...X-Plane should not require more than a gig of RAM under normal circumstances.

(Please use the bug report page to report bugs, not my blog!)

Parallelism: X-plane already utilizes multiple cores to some extent - the amount of benefit will increase over time as we continue to refactor code to take advantage of parallelism.

Clearly the market is moving toward multi-core in a big way. On the other hand, the gap between an entry system and a high-end game system is also widening, so while it is good to utilize multiple cores, I think our assumptions about the minimum number of cores must be very conservative.

This kind of refactoring will take time...changing an application to be threaded is a major redesign.

Mario. said...

The statement about "FSAA is equivalent to a higher screen resolution - that is, running at 2048x2048 and no FSA is similar to running at 1024x1024 and 4x FSAA." is not true these days! The FSAA many GPU companies do consist from 80% of trickery and 20% of real work. These days the AA stuff is not what it used to be.

In conclusion, comparing different resolutions as the means of determining GPU utilisation makes more sense. The compared resolutions need to be of similar size, like 1 and 1.5 MPix, comparing resolutions which are far too different is not a good idea, since every graphic card suffers a drastic penalty from extreme resolution at some point. Some GPUs go to their knees at 1920x1200, some at 2560x1600, so compare the drop in performance in similar class of resolution. If it does drop by the same amount of % the resolution increased, then it is fully utilised. If it does no drop at all, the GPU is waiting underutilised. "RivaTuner" utility can be used with any GPU to display the 3D framerate.

Mario.

Benjamin Supnik said...

Mario, this is 100% true...for what it's worth, most of what I post on the blog about GPU performance is going to be a gross simplification of what is really going on. But in the case of FSAA vs. resolution you're right...cards now do a lot of opportunistic shortcuts to deliver something roughly equivalent to huge FSAA without the large penalties.

(In the case of large resolutions, frame buffer access doesn't necessarily scale as well as shadero perations. Running at a huge resolution has to, by definition, result in more frame buffer access, but FSAA trickery can optimize some of this away.)

Jeffg54 said...

I am getting a message in v9 that my rendering settings are too high.
I would like them to be even higher. My pc has a Q6600 quad core with 8 gigs of ram. My video card is a xfx geforce 9600gt with 512 megs of vram.
The settings page shows at my current settings I am using 353 megs of vram. I am set at 20miles visibility. CPU usage is between 35 and 53% and ram is at 29% usage.
Frame rate is set at 19. I am also getting a sparkle on buildings at a distance.
What CPU do I need to use for the higher settings? I am using Vista 64 bit.
Jeff

Benjamin Supnik said...

jeffg54 - I don't know...see also my other posts regarding us NOT targeting the highest settings to a specific CPU. Also this blog is not a support forum.

You're probably drawing too many objects in the distance. Start with low settings and work your way up to see what's hitting fps. Discuss with other people on x-plane.org who have similar hw.

Anonymous said...

shame on me for buying a 4870x2.
but crysis runs great, and thats all i really cared about at the time.
im using a fresh install of x-plane 9, updated to 9.22.
i am also using multiple ati catalyst versions, including 9.2, 9.3 and 9.4.
with crossfire enabled (catalyst A.I.), i get a crash on the loading screen and the following error:
Unhandled exception: EXCEPTION_ACCESS_VIOLATION (C0000005)
Flags=0, Address = 0x695384e5
0) 0x695384e5 (atioglxx.dll + 5276901)

with crossfire disabled, the sim boots fine.

just wondering if you've heard of this phenomenon, or had any suggestions.