AMD Mantle: A Graphics API Tested In Depth

APIs, Abstraction and Mantle: An API Primer

AMD's Mantle API is a polarizing topic in the world of PC gaming. There are many opinions, lots of information, plenty of speculation, and a handful of known facts to sift through. We want to tell the whole story, and we want to do it right. Unfortunately, it's almost impossible to discuss this topic without resorting to industry jargon, so let's start at the very beginning and lay out some definitions, set the stage, identify where we were, and how we got here.

What is an API?

The acronym API stands for application programming interface. The key word here is interface. An API is designed to allow applications to interface, or communicate, with each other.

A great example of this is copy and paste functionality in Windows. When you copy a paragraph of text from your browser to the clipboard, and then paste that text into a word processor, you have applied the power of an API. The developers of your browser included support for the API's request (or call) to copy, while the programmers of the word processor included support for the API's call to paste. Those two programs communicate to each other via the API.

The advantage of an API is that software developers don't have to code specific support for every possible application. If it wasn't for APIs, all of the document editing software in the world would have to contain unique code to interface something like copy and paste functionality with every other document editing software in the world. That model would be impossible to maintain.

The downside? An API is not as efficient as coding specific support for direct communication between software. The price of convenience is increased utilization of hardware and processing resources. 

 OK, what is a graphics API?

Since an API exists to provide a communication interface between applications, a graphics API communicates between an application and a graphics card driver.

The name of the game here is compatibility. Instead of coding a game engine to support multiple paths to interface with specific graphics card drivers, game developers can concentrate on communication with the API instead. The API then calls the graphics driver, which implements its instructions to the graphics card. In this way, graphics APIs can be considered one of the abstraction layers between the OS and hardware.

If the purpose of a graphics API is simplicity and convenience, why is there more than one API?

OpenGL has its roots in SGI's proprietary Iris GL, which was released in the early 1980s. In a surprising move, the company handed it off as an open standard called OpenGL (Open Graphics Library) API. SGI's competitors were given access in exchange for sharing the burden of maintaining and updating the code.

Microsoft even had a seat on the OpenGL Architecture Review Board until 2003, when the company pulled support in favor of its proprietary DirectX API, which is now more prolific. Currently, DirectX is used in Windows and the Xboxes, so it's easy to justify choosing Microsoft's API from the standpoint of a developer who wants to get the most out of their available resources.

Having said that, John Carmack is a famous holdout who we've seen prove that OpenGL can still be used to run high-end PC games (like Rage). In addition, OpenGL is important because it can be used across platforms: Windows, Mac, and Linux. Android, Windows Phone, and the iPhone use OpenGL ES (Open GL for Embedded Systems). As gaming on mobile devices gains prominence, so does OpenGL.

What's wrong with DirectX 11 and OpenGL? Why does the world need another graphics API?

Two standards at odds are bad enough. It seems counter-intuitive to add another. So how do existing APIs fall short of developer expectations?

Both DirectX and OpenGL were created in the previous millennium. It was a time before multi-core CPUs in mainstream devices were possible. Recently, some developers have voiced concerns that they are bloated, prone to instability, and scale poorly (or not at all) on well-threaded platforms. In addition, no API is perfect. Have you ever had to update a graphics driver to get a game to work properly? Every time this happens, the graphics API has failed in its role as an abstraction layer.

On top of this, it was rumored that Microsoft considered halting DirectX development in 2013. In an interview with c't, AMD's Roy Taylor was quoted as saying, "A new DirectX has again and again refreshed the industry, new graphics cards need more processors and more RAM. But there is no DirectX 12 come. That's it. As far as we know, there are no plans for DirectX 12". In addition, a leaked Microsoft email said the cross-platform XNA Game Studio development platform is not in active development, and that DirectX is no longer evolving as a technology. Microsoft later retracted this and claimed it was a miscommunication, but with no published plans for DirectX 12, the developer community was getting antsy.

AMD claims to have been driven to the creation of a new API that would address those issues at the behest of developers disenchanted with the state of DirectX and OpenGL. In addition, because AMD APUs and GPUs drive the Xbox One, PlayStation 4, and many PCs, the company is in a unique position to offer an API that could potentially be leveraged across multiple platforms.

How does Mantle supposedly improve compared to OpenGL and DirectX?

Mantle is associated with the phrases "low-level" and "closer to the metal". But what does that actually mean? In simple terms, the answer is minimalism. It's smaller, simpler, and consequently faster than DirectX 11 and OpenGL. AMD's new API purportedly makes fewer assumptions about how developers want to render a given scene. This puts more control of resources in the developer's hands, instead of the API's, allowing for better optimization.

In this light, Mantle has the potential to be more efficient. In addition, Mantle is able to execute fully-parallel draw submissions in order to divvy up workloads to multiple CPU execution units. If the API is able to effectively utilize more processing resources, slower CPUs with multiple execution units may be less of a bottleneck.

Put simply, AMD claims that Mantle has the potential to increase performance on systems with slower multi-core host processors. Where the CPU is not a bottleneck, Mantle might even lower GPU power consumption.  

AMD claims to be a big supporter of open source. Is Mantle an open source API?

Mantle is not open source, nor does AMD claim that it will ever be open source in the future. The company does say that it will make the Mantle SDK available to anyone by the end of 2014 with no license fee or restrictions once the closed beta program is complete, though.

To clarify, access to the SDK isn't the same as open source. But it does mean that, in theory, Nvidia and Intel could write a Mantle-compatible driver. Realistically, I think this is unlikely. But I'll save my analysis of the situation for our conclusion. The point is, AMD wants to keep control of Mantle to optimize it for the GCN architecture and allow for fast developer adoption of new hardware features, which isn't practical for generic APIs like DirectX and OpenGL.

Alright, I think I have a handle on the basics of Mantle. What now?

Well, we want to put Mantle to the test and see exactly what it can do. While AMD promises that a number of developers are working on Mantle support for upcoming titles like Civilization: Beyond Earth, Star Citizen, and Dragon Age: Inquisition, at the time of writing, there are only three games on the market that currently support AMD's API: Battlefield 4, Thief, and Plants vs. Zombies: Garden Warfare. Since Plants vs. Zombies: Garden Warfare does not have Mantle benchmark functionality available, and it uses the same Frostbite engine that powers Battlefield 4, we'll concentrate on the first two Mantle-enabled titles.

  • damric
    Wow, Don. This is a good read. You must have plagiarized it from some somewhere :D

    Nice, Damric. nice. :)
  • Amdlova
    memory problems... so my 260x with 1gb will sufferrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
  • Memnarchon
    Mantle is not glide. 3DFX had 85% of the GPU share when they had glide so it was easier for developers to use the glide (AMD has 35% right now).
    But Mantle did something really good for gamers. Till now Microsoft with no competition didn't gave too much attention in performance optimising the DirectX. They gave Microsoft a reason to improve DirectX (so they will bring DX12) in the way mantle works. This benefits all the gamers.
    Unfortunately I have a feeling that Microsoft will give DirectX12 only with Windows9 (due to kernel limitations at their pockets).
    If this will be true then Mantle might have more life than most users expected to (since it wil take time for windows 9 to rule the market share)...
  • ZolaIII
    Next Open GL specification is almost redy & will be announced next month in (ironically) Vancouver Canada. Naturally it will be available on all platforms (that want to integrate OGL) & it will be addressing lover overheads. As gaming market is getting more fragmented it's getting natural to develop for api that can run on all platforms.
  • tomfreak
    Is the battlefield 4 tested in multi-player?

    It was tested in single player, as its easier to get consistent results. We're trying to eliminate variables except the graphics engine as much as possible.
  • chaosmassive
    "AMD Mantle: AMD's PhysX "

    please do a research what is Mantle before post
    it seems you don't understand what are you writing about.

    I think the problem may be that you don't understand the context of the answer, which does not equate Mantle with PhysX on a technical level.

    We equate Mantle with PhysX in the sense that it's a value-add that assists in a limited number of games. Its not a universal advantage.
  • abundantcores
    User testing around the Internet shows Intel are at least as fast in Mantle as AMD CPUs.

    Its obvious there is something very wrong with your testing.

    Actually, nobody on the internet has really tested anything but Radeon R9 290s when it comes to Mantle. Instead of assuming it always works in every situation like everyone else, we actually tested it, not only with the 290, but with a wide range of CPUs and GPUs. We did this with feedback from AMD.

    Mantle is not the perfect, slick API that people assume it is. AMD stresses that its considered a beta and is not yet a final product.

    I believe that our test results are quite accurate. The problem is that the API, something the developer considers unfinished at this point, probably still needs work and has room to grow. And I'm sure it will get better over time.

    But pretending it works 100% perfectly doesn't help anyone. That's not even something that AMD would try to say at this time as it has obvious issues. They are working on it. But there is a value to in-depth testing and to sharing the inconsistencies.

    i7 with 4 cores and 8 threads right here

    Using your settings.

    Min 62 FPS
    Max 82 FPS

    here is one with a 4770K @ 4.5Ghz

    Avenged7Fold: 290X @ 1300/1604, 4770K @ 4.5Ghz - Mantle FPS: Min 71.8 / Avr 88.5.

    That ^^^ is actually on the highest possible settings.

    I know a lot of people using i7's with mantle, in Thief and BF4, some with CF 290's, they all report FPS gains with Mantle over DX, especially when in CF. in BF4 averaging 170 FPS with 120 FPS minimums. over 50% higher than they do in DX.

    I don't know where you have gone wrong. but everyone on our forum is utterly confused by your i7 results.
  • ta152h
    As a programmer of 30 years, that's arguably the worst description of an API I have heard.

    An API is a set of commands, with required parameters, a software package presents to another application that wishes to use its services. It's essentially the language to use the services it provides.

    Mantle isn't just an API. It's an abstraction layer that makes it unnecessary for the developer to write directly to the hardware, which is tedious, time-consuming and extremely difficult to do on a large product. The API is what Mantle accepts to tell it what to do, and what the programmer must learn to use it, but it is NOT all Mantle is. It's just how to talk to it.

    A pure API would be something someone demented would write, because it would mean you could issue commands to do nothing. I'm guessing Apple is patenting this technology now.

    I'm sorry you feel that way. I don't agree as I feel it's a useful high-level primer for folks who haven't been programming for 30 years, but you're certainly entitled to your opinion. :)
  • elbert
    On page 4 its clear mantle doesn't work well with Intel's Hyper-Threading but what about Intel's 6 core CPU's? Does mantle give an Intel 6 core a bigger advantage in games that dx? I wouldn't throw mantle under the bus just due to its unoptimized for Hyper-Threading. Please add an Intel's 6 core to these tests.
  • SteelCity1981
    I can see intel supporting mantle in its future gpu hardware. I mean just recently intel asked amd for its mantles api specs. So intel using mantle in the future is much more plausible then Nvidia using mantle.