Let's talk Compilers...

Creating the perfect compiler is one of the more difficult problems in computing. Compiler optimization and scheduling is an NP-complete problem (think chess) so we can't "solve" it. And compounding the issue is that the best compiled code comes from a compiler that is written specifically for a certain processor and knows it inside and out. If we were to use a standard compiler to produce standard x86 code, our program will run much slower than if we tell our compiler we have a P4 with SSE2 and all the goodies that go along with it. I know this all seems pretty obvious, but allow me to illustrate a little.

Since I've always been interested in 3D graphics, back in 1998 I decided to write a 3D engine with a friend of mine for a project in our C++ class. It only did software rendering, but we implemented a software z-buffer and did back face culling with flat shading. Back then, my dad had a top of the line PII 300, and I acquired an AMD K6 200. Using a regular Borland C++ compiler with no real optimizations turned on, our little software 3D engine ran faster on my K6 than it did on my dad's PII. Honestly, I have no idea why that happened. But the point is that the standard output of the compiler ran faster on my slower platform while both systems were producing the same output. Now, if I had had a compiler from Intel optimized for the PII that knew what it was doing (or if I had hand coded the program in assembly for the PII), my code could have run insanely faster on my dad's box.

So, there are some really important points here. Intel and AMD processors were built around the same ISA (Instruction Set Architecture) and had a great deal in common back in 1998. Yet, performance varied in favor of the underpowered machine for my test. When you look at ATI and NVIDIA, their GPUs are completely and totally different. Sure, they both have to be able to run OpenGL and DirectX9, but this just means they are able to map OGL or DX9 function calls (via their drivers) to specific hardware routines (or even multiple hardware operations if necessary). It just so happens that the default Microsoft compiler generates code that runs faster on ATI's hardware than on NVIDIA's.

The solution NVIDIA has is to sit down with developers and help handcode stuff to run better on their hardware. Obviously this is an inelegant solution, and it has caused quite a few problems (*cough* Valve *cough*). The goal NVIDIA has is to eliminate this extended development effort via their compiler technology.

Obviously, if NVIDIA starts "optimizing" their compiler to the point where their hardware is doing things not intended by the developer, we have a problem. I think its very necessary to keep an eye on this, but its helpful to remember that such things are not advantageous to NVIDIA. Over at Beyond3d, there is a comparison of the different compiler (DX9 HLSL and NV Cg) options for NVIDIAs shaders.

We didn't have time to delve into comparisons with the reference rasterizer for this article, but our visual inspections confirm Beyond3d's findings. Since going from the game code to the screen is what this is all about, as long as image quality remains pristine, we think using the Cg compiler makes perfect sense. It is important to know that the Cg compiler doesn't improve performance (except for a marginal gain while using AA), and does a lot over the 45.xx dets for image quality.

Tomb Raider: Angel of Darkness Back to the game...
Comments Locked

117 Comments

View All Comments

  • Anonymous User - Wednesday, October 8, 2003 - link

    #41, maybe you and your wife should start a website, you could benchmark ATI cards exclusively. That way ATI would always wind up on top. Admittedly, I'm an ATI junkie (I own a Radeon 8500 and plan to buy a 9600XT ASAP), but enough is enough. (By the way, what's up with the bread/butter analogy? You seem very fond of it.) Seriously, though, either of these cards are really fast and aside from IQ differences, you couldn't tell a difference. A little question for anyone who would know, though: How much does IQ drop going from PS2.0 to PS1.4? I have Halo and I'm wondering how much better it would look on a DX9 card instead of DX8.1.
  • Anonymous User - Wednesday, October 8, 2003 - link

    if you look at the gunmetal screenshots, that is my only beef with ATI, the scenes are not rendering completely or properly it has happened to me in a lot of games, black areas.
  • Anonymous User - Wednesday, October 8, 2003 - link

    The article does seem somewhat comprehensive that is true, but: a)other sites reviewing the software did not come to the same conclusions, mainly problems with trilinear and AF again.... b)I have yet to see a review that claims to be unbiased have this much opinion sprinkled all over, mainly pro nVidia which relies on IQ comparison which i refer to in a c)the drivers are beta and not whql so who knows what we'll get as consumers d)the hardware is not yet anounced formally by nVidia e)it seems the choice of what to show on graphs is very subjective,TRAOD shows percentage drops with PS 2.0 but what are the framerates?
    I do hope this review is correct because it means nvidia are back but due to the above stated qualms I have I can't trust this review.
  • Anonymous User - Wednesday, October 8, 2003 - link

    The article is extremely comprehensive, as one would expect from Anandtech. Some issues of note:

    1. It was pointed out that the 5900 and the 5950, in many areas, performed almost identically. This doesn't pose well for nVidia.
    2. I'm bothered by the tremendous frame rate difference between ATi and nVidia in some of the titles. It leads me to believe there's something underlying going on, and it's not just a simple card/driver issue.
    3. It's nice to see the IQ back to where it should be, as visual quality should never be compromised for performance, unless the user makes the adjustments to do so.
    4. I will admit it sort of seems that there is some bias towards ATi, but it's not flamingly apparent. Again, it is just my perception, and doesn't necessarily mean that there is.
    5. The most accurate remark made in this review is simply that we are not in the world of DX9 games...yet. To that end, DX9 performance is not nearly as important as it will be. When it is, I think things will step up a few notches.
  • Anonymous User - Wednesday, October 8, 2003 - link

    Nicely detailed article, and I appreciate the additional games for benchmarking. Any chance we could seee the use of a flight/combat sim program like IL-2 or Mechwarrior?
  • Anonymous User - Wednesday, October 8, 2003 - link

    I don't know why everyone is believing the IQ results (or even trying to use Photoshop to check the differences). These pics are JPG's! They're already manipulated by the compression logic, and who's to say these pics are true?
  • Anonymous User - Wednesday, October 8, 2003 - link

    Loooooong time reader, new poster.

    Excellent work Anand and Co. I found the article very informative, and although certain folks don't enjoy reading your "opinions" on some of the benchmarks, I thought they were very appropriate. It will be interesting to see how the official driver releases function under the latest and greatest DX9 and OpenGL games...

    Thanks for all your hard work and effort!

    Mike
  • Anonymous User - Wednesday, October 8, 2003 - link

    #78

    The shots has not been taken in the same frame.

    Gunmetal, contrary to Aquamark don't have such option....that's why so many screenshots are taken at the beginning of a scene or a dead spot.
  • Anonymous User - Wednesday, October 8, 2003 - link

    #67

    I seriously suggest that you upgrade everything else in your machine, reinstal drivers, game and defrag.

    Mine runs perfectly at 1280*1024 with the max AF and displays between 40-60fps all the way using the cg_draw command and that's GAMEPLAY framerates .... with sound, AI and all the whistles. I see no need for AA at that resolution thou (not a nice IQ/performance trade there)....at 1024 it does wonders thou.
  • capodeloscapos - Wednesday, October 8, 2003 - link

    Why nobody said anything about IQ in GUN METAL???
    Only NvIdia 52.14 shows the fire in Mech's Gun.
    What happened there???

Log in

Don't have an account? Sign up now