AMD's Mantle API: how it works and why PC developers will adopt it | PCGamesN

AMD's Mantle API: how it works and why PC developers will adopt it

A red and black AMD Radeon video card against a white field.

Since the fall, we’ve heard some eyebrow-raising claims about Mantle, AMD’s new API (application programming interface). The numbers being tossed around in terms of performance-gain seem almost hard to believe, with Battlefield 4 running up to 45% faster via Mantle over DirectX.

It seems too good to be true, so we talked with AMD’s Robert Hallock. He explained how AMD have been able to achieve these kind of results with their API, and why he thinks it has such a strong case for being adopted as a standard. If he’s right, Mantle could spell huge changes for how games are made, and what kind of performance PC gamers can expect from their own machines.

Right now, when you are playing a modern PC game, DirectX is working behind the scenes to coordinate your game and the PC hardware running it, especially your graphics card and CPU.

“When you put an object on the screen for the player, that is a draw call,” Hallock explains. “That GPU talks to the CPU and says, ‘Hey, this thing has to go on screen.’ Current APIs are very limited in the number of calls they can make per frame. Each frame requires several thousand draw calls. Now, in a best case scenario, today’s APIs get you three to five thousand draw calls. That’s how many objects appear on screen.

“Mantle kicks that limit up to 80 thousand or 90 thousand. That is an absolutely massive increase in the number of objects the GPU can handle. Of course, when you increase that limit, that doesn’t mean devs are going to put more objects on screen. But they can improve the performance of draw calls that they are making.”

There are two major factors behind that increase. The first is that DirectX (and OpenGL) have their roots in an era when multi-core processors weren’t even on anyone’s radar. As a result, Hallock says, they don’t have the best approach to multithreading. Though there’s more performance to be had, “there’s a point where the [current] APIs are unable to satisfy the requests.” Mantle was built with the modern hardware environment in mind.

The second factor is Mantle’s own programming language. “[These performance gains] are a result of the the lower API overhead. At a fundamental level, Mantle’s code is executed in a language that’s much similar to the way our GPU architectures natively speak. Every architecture has its own native dialect of graphics core architecture.”

Hallock continues, “Reducing that overhead improves performance, allows you to do more, eliminates hardware downtime. We could alleviate or address those instances and allow the GPU to work faster and more efficiently.”

While Mantle offers tremendous gains in theory, they don’t mean anything unless it gets adopted by developers who have many, many years of history, experience, and fluency in DirectX. Hallock understands this, and knows Mantle is not a guaranteed success by any means.

A Battlefield 4 screenshot.

“No doubt that adoption is Mantle’s biggest hurdle. Our biggest hope is that Mantle becomes adopted as an industry standard, or the fact that it exists and presents an observably better model — that provides inspiration for new products. So either we become the standard and benefit the industry, or something like Mantle becomes the standard, and either way, PC gamers benefit,” he says.

But he thinks AMD have a good case for being adopted. For one thing, Mantle was built partially in response to developer needs and requests. DICE in particular, Hallock says, wanted to have an API for PC development that was as efficient as the stuff they were working with on consoles.

Because if you think about it, it’s kind of amazing that consoles work at all, isn’t it? As a collection of hardware components, the Xbox 360 was never all that impressive and it should have been obsolete years ago. Yet it was able to keep running the same games as a PC (albeit with increasingly dubious performance as the years went on).

“They have a fixed hardware platform, so you have one set of hardware that can be found on every model of that console,” Hallock points out. “That lets a game developer, like Mantle, to go very close to the GPU and write code that is very close to what the GPU is expecting. So you can extract a lot of performance out of the console because of that environment. And that is something you couldn’t do on PCs until Mantle because every PC is different.”

Now here’s something Hallock didn’t get into, but is almost certainly going to be a major factor behind adoption of Mantle: AMD’s hardware is already inside both the major next-gen consoles. That fixed hardware environment on PS4 and Xbox One is an AMD environment, so it’s not hard to see how suddenly working with an AMD API could suddenly be very appealing.

Hallock admitted, “The clever thing about Mantle is that it’s very similar to the types of code these game developers are already creating for consoles, so the process of porting is quite simple for them.”

That’s crucial, because we all saw with the PS3 and cell processing what happens when developers have to work with an unfamiliar and unusual architecture. DirectX isn’t just familiar, it was also designed to speak a language close to what programmers already knew and used. Mantle will have to become a similarly comfortable environment to succeed, and since it is speaking a language closer to what the GPU uses, it may not be as easy as DirectX is. Those problems go away, however, if developers are working with Mantle so much that they become fluent in it.

The nice thing about Mantle is it doesn’t rip-up their current work. Hallock explains, “We’ve designed Mantle to be compatible with DirectX Hight Level Shader Language. So that DirectX code that people are already writing is already compatible with Mantle. I would never dare claim that DirectX is going away. It’s not something that we hope to replace. It’s an important, powerful, great API.”

Mantle is still making its way to market as AMD continue developing it and opening it to developers. But people running AMD cards can get a taste of what Mantle can do later this month, when Battlefield 4 updates with Mantle support. It will be an interesting first test of what Mantle can really offer players.

“I see two big things going for Mantle, “Hallocks says. “If anything else, these two things will drive adoption. One, game developers really, really like Mantle. All the game developers currently using Mantle have come to us have come to us to request it. They are excited about using it. And point number two is that gamers will see the performance benefits and really, really want to get their hands on it. And that addresses both sides of the game development continuum. ‘Push-in’ from the game developers and ‘pull-out’ from the consumer side.”

Sign in to Commentlogin to comment
ThePoark avatarShriven avatarViper_IXI avatarprimal avatargrndzro avatarWindows 98® avatar+1
ThePoark Avatar
4 Years ago

So, is Mantle proprietary AMD tech that won't be open to nVidia users? What is AMD's angle? Are they really trying to benefit the industry, or just trying to pigeonhole people into buying AMD cards? I don't know that segmenting the PC gaming community, further than it already is, is best for the industry. (I'm not being crass; I'm genuinely wondering how open and compatible this tech will be for third-parties.)

Viper_IXI Avatar
4 Years ago

While I am not sure if there has been any new revelations on this front, when Mantle was announced it was reported that it was open. Nvidia and Intel can support the API if they choose to. The API itself is still an abstraction, there is no technical reason Nvidia can't support it, it just depends on AMD allowing them to and rumor is they are allowing it. Honestly if Mantle truly does provide the performance increase AMD claims, Nvidia wont have much choice. They will have to support it to remain competitive.

primal Avatar
4 Years ago

it is open to everyone but because it only supports AMD's GCN architecture atm it doesnt work on anything else. I would imagine if nvidia started using it theyd adopt it for there Maxwell architecture and beyond. So nvidia would need to add its own code for the maxwell architecture to get the most out of it. It would make sense for them to add kepler architecture to

grndzro Avatar
4 Years ago

Mantle is a low level API, not a bare metal API. The magic dosent happen at such a low level that NV or Intel can't tie into it fairly easily. Of course Mantle will have bits that take advantage of AMD's hardware such as hUMA.

Nvidia need to make their own drivers to tie into the Mantle API and take advantage of it. NV can gain the same low level access and freedom from IPC and dedicated GPU threads. Hell NV could do whatever they want with it. NV cards have cuda cores that can be divied up the same way as AMD's compute cores.

NV is the only company at fault if they don't jump on the Mantle bandwagon. If I was in charge of NV I would have traded tech for AMD's help in making mantle for NV ASAP instead of sitting on the fence while AMD gains a huge lead in mantle.

If AMD get a few more engines and developers NV is really going to be in panic mode since it has put in zero work in adopting Mantle. I can only hope deep in NV skunkworks it has some people writing a mantle driver.

Windows 98® Avatar
4 Years ago

I'm sure someone has already told you, but mantle is open source. No idea can use it if they want

tonez82 Avatar
4 Years ago

Do you not realize that Nvidia's PhysX is proprietary? Nvidia pays game developers to use their proprietary extensions. If anything it seems like Nvidia is trying to hurt the industry. Why don't you know this? Are you really a gamer or just an ignorant lamer?

I'll go with your lame

Shriven Avatar
4 Years ago

I dont trust AMD. This is DirectX 2.

tonez82 Avatar
4 Years ago

Good, keep overspending on Intel & Nvidia parts.... they love ignorant shoppers!!!