Ask HN: Will there ever be a vendor agnostic GPU interface?
We moved from almost write once run anywhere OpenGL to vendor-dependent Vulkan / D3D12 / Metal / WebGPU, which is kinda impossible to support all without heavy abstraction layers and shader transpilers. Is there any possibility that we'll have easy cross platform in graphics realm in the future?
102 comments
[ 4.2 ms ] story [ 171 ms ] threadBut while companies are able to differentiate their products feature wise (or even if they can't, but strongly believe they can), the incentives are set against it, so it's not likely to happen, the GPU vendors will push for vendor-specific aspects.
I don't think the current state could be described as a "race".
NVIDIA makes good stuff and great drivers but charges a fortune (+$1500 for a high end GPU?!) AMD has made space heaters that happen to have video-out ports and their cards are useless for compute work because so many projects support CUDA and nothing else. Their current lineup cheats benchmarks by overclocking the cards and thermally throttling shortly after the time it takes to run a typical benchmark.
Edit: since I'm now being 'corrected': look at the TDP for same-generation, same-product-tier NVIDIA and AMD cards. AMD's cards have always used more power for similar performance.
People think certain GPUs "run hot" because
- they buy the cheapest GPU they can which means the heatsink and fans are terrible
- they don't adjust the stock fan curve (most GPUs these days don't even turn on the fans until they hit 60c and only max out the fans when the GPU die temperature is very hot because people care mostly about noise
- they don't have a well-ventilated case (note I said well-ventilated, not "stuffed with fans)
Buy a properly ventilated case, a mid-or-high-tier card from a reputable manufacturer, and adjust the fan curve. Find the temperature the card sits at during light desktop use and set the fans to kick in slightly above that. Then force the fans to run at full speed and benchmark, seeing what the die temperature maxxes out at. Set the fan curve to 100% at slightly below that temp.
They even have a name for it: "GPU Boost"
Every vendor makes multiple tiers of a particular GPU and you generally get what you pay for, though with diminishing returns for someone who isn't looking to overclock to the edge and get a few extra FPS. Good vendors starting a tier or two above their budget tier tend to produce cards with thermal solutions that are fairly quiet at stock speeds/voltages when gaming in a properly ventilated case in a comfortably cool room.
On 1xxx series cards for example, MSI's Gaming X line come with an absolutely massive heatsink. I had an MSI 1060 Gaming X that was overclocked and fully loaded the fans weren't noticeable, much less loud, and I had a terribly ventilated case.
My current card is a 1070 ti, from a reputable manufacturer and it's a mid-tier card. I have a pretty aggressive fan curve on it because I want longevity (capacitor lifetime drops appreciably with temperature.) Even then, I almost never notice the fans, but I have upgraded to one of the most well-ventilated $100-ish cases.
Stay well clear of single fan GPUs if you intend to do any gaming or compute work beyond "very occasionally." The fan noise will drive you nuts and the card will quickly thermally throttle.
If you care about your GPU lasting, lower the fan shutoff point to be more like 35-40c instead of the usual 60c, or just set them to run at the minimum speed all the time. Fans are easy to replace; caps aren't...and a quality card, the fans should be nearly silent at minimum speed.
There are even some games where the "GPU load" is 30 % but the card is running at 150 % power and destroying its VRMs :)
Benchmarks disagree with that assertion:
https://www.techpowerup.com/review/nvidia-geforce-rtx-3080-t...
RTX 3000 series has consistently worse perf/watt than their AMDs RX 6000 series peers
> Samsung has much higher power usage than TSMC from what I've heard.
Is possible, but weather or not Nvideas bad power efficiency comes from that or architectural decisions in their design can't really be said.
"Enough" maybe for 1080p gaming, but 4k remains still heavy for the top tier GPUs even without raytracing; there are plenty of titles where 3080ti will not hit steady 60 fps on 4k, nevermind about 120 or 144 fps.
That remains to be seen. The idea is that RT once fully adopted should be a lot easier for Graphics Designer while giving higher image quality. At the expense of GPU Compute.
Considering AAA Games are getting more expensive every year and Graphics Asset are by far the largest cost centre. I say on paper this seems like a very good trade off.
I dont know if 3D Models from Camera would shift the cost down. But I would really like to see some innovation in Graphics Modelling to bring the cost down by a few order of magnitude.
(Vulkan performance on the Pi 4 just got a big performance boost, btw.)
It seems the only gotcha is that Apple is being difficult and not supporting Vulkan on MacOS, but MoltenVK is "within a handful of tests" of Vulkan 1.0 conformity.
I wonder now whether the Vulkan API is an adequate interface to securely expose GPU capabilities to multiple VMs, i.e. without those VMs being able to see other VMs' memory. If not, what would need to happen to get there?
The best chance to build a standard on top of all this change is to not view this as a "GPU abstraction" but rather a collection of compute engines. At this layer, the place where this happens will be compiler toolchain. IMO (as ex-NVIDIA compiler guy) the best effort happening right now is MLIR [1]. I don't know if dialec is the right abstraction but thats where things are at right now. The best example is is IREE [2] which is written at Google for mapping a lot of of the sophisticated translation inference on mobile for acceleration across GPU, neural engines, etc.
[1] https://mlir.llvm.org
[2] https://google.github.io/iree/
Ambitious project ;)
[1] https://github.com/eholk/harlan
[1] As an example, Raspberry Pi 4 was recently qualified as Vulkan 1.1 conformant, even though the GPU lacks features required to pass as an OpenGL 3.0 GPU.
[1] https://www.reddit.com/r/gamedev/comments/xddlp/describe_wha...
Vulkan: Standardized by a standards body (Khronos). In an ideal world we would all be using this.
D3D12: Microsoft likes Direct3D and has the market power to be able to push its own API. However, the situation on Windows isn't as bad as on macOS/iOS because drivers generally support Vulkan as well.
Metal: This mostly exists because Apple refuses to support anything Khronos related, for not-particularly-compelling reasons. It does have the excuse that it was being developed before Vulkan, but in 2021 its existence is not particularly well-motivated.
WebGPU: As an API, WebGPU in some form has to exist because Vulkan is not safe (in the memory-safe sense). For untrusted content on the Web, you need a somewhat higher-level API than Vulkan that automatically inserts barriers, more like Metal (though Metal is not particularly principled about this and is unsafe in some ways as well). That being said, Web Shading Language is just Apple playing politics again regarding Khronos, as the rest of the committee wanted to use SPIR-V. There's no compelling reason why Web Shading Language needs to exist.
A standard target would multiply the size of this "market" many times over, generating additional demand for implementations throughout multiple industries. Balkanization has always been a debilitating tax on everyone, not excepting "market leaders" scrapping over the artificially reduced pie. Everyone made way more money after FORTRAN than before.
Strangely, the fact never prevents it being trotted out again, every time.
So, the "innovation" argument is always trotted out, against copious evidence. But MBAs always fall for it, and we get things like DirectX, CUDA, and Metal that invariably end up acting to stall innovation, instead.
Next on the pipeline, mesh shaders.
Additionally why OpenCL only cared about anything beyond C after getting punched to the ground via C++ first alongside polyglot PTX.
Khronos innovates so much that the graduation ceremony of using their APIs is to create a self built SDK, hunting for libraries and graphic debugging tools from each card vendor.
Afterwards one is worthy to wore the ring of portable 3D mighty league.
But I also don't think it's the end of the world, either. Google's Tint can translate between SPIR-V/GLSL/etc -> WGSL and vice-versa pretty well.
If that's what it takes for Apple to be on board with WebGPU and we get an extension later to load SPIR-V (or some other WGSL binary form) later for optimization I'm cool with that.
I guess with compression probably being quite good, as well, there isn't much point of a SPIRV extension for download times or processing times?
DirectX and Metal are great with high level bindings, and much more productive shading languages, instead of "C way" that Khronos keeps pushing for.
The DirectX shading language (HLSL) and the metal shading language (MSL) could both compile down to SPIR-V, other than the occasional missing feature that's not standardized yet.
https://kvark.github.io/spirv/2021/05/01/spirv-horrors.html
If you follow Apple's logic, this is totally wrong. Everything has to be integrated in order to achieve the best possible experience, and public APIs would be a bottleneck that make things inflexible for the company that tries to exploit the technology.
[1] https://cad-comic.com/comic/doing-business/
I'm pretty sure it basically doesn't. WebGPU is supporting WGSL whose #1 goal is to be "trivially convertible to SPIR-V" (https://www.w3.org/TR/WGSL/#goals). In other words, it's text SPIR-V.
This is not true, Mantle was first. AMD donated the code to khronos and it became/was developed in public. Half way through Apple announced it would do its own thing and beat Vulkan to v1.0.0.
Apple might have had a v1 before Vulkan but they're still dicks for not helping build a unified standard around AMDs generous once a generation offer.
At this time a GPU manufacturer will conform to whatever workloads will run on the device, instead of creating a shared API and letting someone else choose how to use it.
Even if you just compare CUDA and OpenCL which makes use of the GPU in non-graphics workloads. In theory this was a chance to create a universal interface but in practise it turns out what you can make more money if your special sauce is better than the sauce of others, even if it's not better in all scenarios.
It seems the true agnostic interface will be on engine level where a compute library or graphics engine will be running on top of a bunch of non-agnostic interfaces and the real interface you'll be working with is the interface of the engine.
It's the one API that Mozilla, Google, Microsoft, Apple, and Intel can all agree on. Nvidia and AMD are silent, but it's on top of Metal/DirectX/Vulkan behind the scenes so they don't really need to care.
Today, Vulkan with MoltenVK (for Apple devices) has more _features_, but even that is not super clear-cut. For example, mesh shaders are supported on AMD cards in DirectX 12 but not Vulkan.
It's not just Apple who continues to push their own API, either. DirectX 13 is likely coming soon, and from what I understand Vulkan gets "ported" features after they land in DirectX.
If you want bleeding edge features, you're going to need to use the native API: Vulkan on Linux, DirectX on Windows, and Metal on Apple.
But if you just want the common denominator? WebGPU native isn't a bad choice IMO. And it being a cleaner API than Vulkan may mean you need less abstraction on top to work with it.
[0] https://devlog.hexops.com/2021/mach-engine-the-future-of-gra...
How long before this API is ubiquitous though? For maximum compatibility today, wouldn't something like OpenGL ES / WebGL make the most sense?
Eventually WebGPU will get there too, but it will take time.
Sony cares about GNM and their custom shader language PSSL[1]. Seems unlikely they'll support Vulkan anytime soon either.
Arguably, it is more likely WebGPU will continue to have a reasonable translation to these platform's native APIs compared to Vulkan, given that WebGPU is the common denominator between Vulkan/Metal/DirectX.
That's not to speak of the market pressures having a large swath of browser-based games written with WebGPU would have in encouraging Nintendo/Sony to care about these.
[0] https://blogs.nvidia.com/blog/2016/10/20/nintendo-switch/
[1] https://en.wikipedia.org/wiki/PlayStation_4_system_software#...
It's entirely possible that wgpu or Dawn could implement backends for those platforms.
If you look at WebGL implementations, the heroic amounts of driver bug workarounds found through trial and error over the years and feature compromises due to said bugs, it's hard to believe anything will match and replace it for a long time.
The key is getting the major game engines to support these standards which is what my startup is working on.
We’re currently focusing on bringing WebGPU + WebXR + improved WASM support so real-time 3D apps and games can be deployed to end users wherever they are, no walled gardens required. It’s also the path to the metaverse, which needs to be built on open standards and protocols in order to be truly accessible to all, and not vendor-locked by an entity that seeks to own it all like Meta (FB).
If you’re interested in hearing more or want to leverage our platform that’s approaching general availability we’re building at Wonder Interactive, you can join our Discord here:
https://discord.gg/3t8bj5R
One size fits all doesn't work for customized hardware, as OpenGL amply demonstrated, which is why it's going away. OpenGL started dying the day NVidia introduced the GeForce series with the T&L engine. That was followed by shaders, antialiasing, anisotropic filtering and now raytracing and DLSS, not to mention innovations on the compute side and GSync/Freesync implementations. Any kind of standard acts as a bottleneck for new hardware. It's too slow to adapt to new features because it requires review and ratification, and then of course, an abstraction layer is needed to support hardware missing those features. This adds complexity. Standardized APIs are a dead-end, just like standardized CPU ISAs are a dead-end. They are trying to solve the same problem in a wrong-headed fashion.
Apple's hardware is completely different from NVidia. It makes sense to have a completely different API to fully leverage the silicon.
Not really, OpenGL had/has many problems but having a standardized interface isn't one of them (I mean one problem is the inconsistency between which extensions are available and many extensions being (or at least starting of as) somewhat Vendor specific in practice...)
Sure for technological advancement we will have vendor specific code and you could say we want it.
BUT most applications do not need it. Even many games don't need it. Weather most applications and any non-"AAA"-style games they often want a easy way to have reasonable well working graphics which also continue to work. Sure with such a hypothetical API the "standardized" way will be updated with new features and APIs from time to time and maybe some old features will be deprecated and emulated instead of having native hardware support but due to improvements in hardware software written "back-then" would still work. WebGPU seems to go in the right direction but Apple is messing it up again, but then "works in the Web everywhere but Apple" is something I'm already getting used to.
> It's too slow to adapt to new features because it
Most software just wants a frequently updated stable core set of feature which get adapted after they had been available in non standardized APIs for a while.
> standardized CPU ISAs
Except that ALL ISAs today are standarized, sure with extensions but the part most people use is standardized with each ISA. Weather that's ARM, x86, RISC-V, etc. Standards are what compiler makers and operating system designers rely on when it comes to designing the "generic", "general purpose parts" of their software. I mean hardly anyone would be using e.g. RISC-V if there wouldn't be a standard about how the most "core" instructions are handled.
> It makes sense to have a completely different
For native state of the art highly customized applications, yes. For the rest. No. It's just pain and a lot of additional development cost, and companies hate cost.
A good analogy for this is the language and mind relationship. The mind shapes the language just as much as the language shapes the mind.
Also contrary to common beliefs, OpenGL is "portable" not portable, as the spaghetti code of vendor extensions, GPU driver workarounds, differences between GL and GL ES, shading language compilers, lead to multiple common paths hardly different from using multiple 3D APIs.
https://news.ycombinator.com/item?id=23079200
I dont know who is "We". But I dont see the industry "moved" from write once run anywhere to vendor-dependent at all because it never happened in the first place. I mean even OpenGL you have vendor specific extensions.
Partly because all these API designed happened at a time when GPU hardware was moving so fast and constantly changing.
I think in terms of basic functions WebGPU is the closest we are going to get.