r/GraphicsProgramming • u/jrkirby • Mar 07 '15
"Zero Driver Overhead" misleading?
So one of the buzzwords that's been flying around for some time is "Zero Driver Overhead." People are trying to use OpenGL and now now Vulkan and approach having zero time spent in the driver.
But isn't this goal a bit misleading, perhaps? Just because you can use openGL in a way that it spends no time in the driver, doesn't actually mean that you did graphics more efficiently. It could be (and I'm pretty sure it is in some cases) that you're just doing in client code a bunch of things that were previously done in the driver. So your program does the same thing, and doesn't even run much faster, it just spends more time in client code, and less time in the driver.
This doesn't sound like a particularly good thing. Thoughts?
7
u/Lord_Naikon Mar 07 '15
In OpenGL for instance there's a whole bunch of state validation going on in the driver that could be avoided. "AZDO" techniques mostly try to amortize the cost of validation over a large number of frames and/or render "calls" in an effort to reduce time spent on the CPU and increase GPU utilization by preventing starvation.
Vulkan seems to ditch validation all together (it's an option now), which directly decreases time spent on the CPU. In addition, Vulkan allows multiple threads to create render state independently of one another, making it much easier to scale.
At least that is my understanding of it. Obviously I haven't been able to experiment with Vulkan yet!
1
u/BillDStrong Mar 13 '15
I would point out that Khronos has been very clear that Vulkan is "stateless." While you will have state in your engine, the driver is agnostic to what that is.
3
u/specialpatrol Mar 07 '15
I was initally going to say 'no' but having thought about it maybe you are right to a degree. Obvioulsy "zero" driver overhead is balls cos there has to be some. Yes you are doing in client code what the driver was previously doing. But it's now your responsibilty as to how to go about it whereas before the driver was a blackbox doing it's thing outside of your control.
3
u/__Cyber_Dildonics__ Mar 08 '15
I think you misunderstand what is happening. In old school openGL you would do a C function call for every vertex you wanted to draw. Graphics cards got faster and eventually they were able to draw a triangle so fast that just calling 9 functions was too slow and caused too much latency.
The evolution of this is that vertex buffers were put to the card so that one function call in C could draw tens of thousands of polygons.
Now we are at the point where even function calls that do lots of work like this are not enough, with on major reason being that in openGL they must all go in one thread - the thread that created the openGL context.
What these new APIs do is batch lots of calls, so one function in C can do lots of draw calls. This is what is meant by 0 driver overhead. Nothing is actually zero overhead, but APIs like this reduce the cpu load to something very small.
2
Mar 08 '15
So your program does the same thing, and doesn't even run much faster, it just spends more time in client code, and less time in the driver.
Even if it were exactly the same work done in a different place there are still a number of advantages. It performs more predictably across driver revisions, venders, and platforms. It's able to be optimized in the context of your game rather than being a black box giving you no control. It's not encumbered by handling for features from three API revisions ago that you don't use or care about.
But aside from this, the AZDO techniques are more about handling graphics data in the way the card wishes to consume it rather than in the way an API designed 30 years ago wants you to present it. Removing as much of this indirection as possible is a very good thing.
1
u/BillDStrong Mar 13 '15
The biggest problem that the big game engine developers have been complaining about has been the fact they were already doing those thing anyway. After all, most of these engines were also targeting consoles, and they didn't have DX or OpenGL, so the engines already did all that work.
And, not all of the overhead needs to be there. For example, in OpenGL, all drivers are effectively in developer mode, with costly error checking going on in most of the draw calls, and all of the compute units.
By having a layer of correctness testing that gets turned off in production, this cuts out a lot of overhead from the driver.
My speculation is this is the where part of that first big speed boost comes from, even on unoptimized drivers.
15
u/nexuapex Mar 07 '15 edited Mar 07 '15
There's a bunch of things that "Zero Driver Overhead" could mean:
If you take all the CPU code that you put in the driver and put it in your program instead, then it won't be any faster, but it will be more controllable by you. Driver writers have to optimize for every single program, while you only have optimize for yours. If the code is in your program instead of in an opaque driver with no symbols, you have a chance of optimizing the things that your program takes advantage of. (But if you do a bad job, you can end up with the same or worse performance, which I think is what you're talking about.)
Another possible meaning is that driver overhead arises from an API that doesn't map closely to the hardware, meaning that the driver has to do a bunch of work to translate your API calls to something that the hardware understands. You can reduce the total amount of CPU work just by changing the API to be a more natural fit for the hardware (although you also have to make the appropriate changes in your program to match the new API). The total complexity is reduced, not migrated from driver to program.
And finally, there's the AZDO OpenGL model, which is largely about stripping out the driver APIs totally. Persistent mapped buffers let you write to memory without any driver code getting in the way: "zero" overhead instead of "minimal" overhead.