Intermediate Graphics Library, a cross-platform GPU abstraction library by Meta
github.com
github.com
Meta releases Intermediate Graphics Library - https://news.ycombinator.com/item?id=36635526 - July 2023 (209 comments)
Other options would be bgfx, or sokol_gfx, or WebGPU, or Vulkan+moltenVK, or even full game engines: Unreal or Unity or Godot.
DXVK implements D3D 9 and 11 on top of Vulkan, it’s an essential software in SteamDeck and Wine. There’re rumors modern Windows GPU drivers for Intel Ark GPUs are using that thing as well, for the implementation of D3D.
MoltenVK implements Vulkan on top of Metal, MoltenGL implements GLES 2.0 on top of Metal.
---
Intermediate Graphics Library (IGL) is a cross-platform library that commands the GPU. It encapsulates common GPU functionality with a low-level cross-platform interface. IGL is designed to support multiple backends implemented on top of various graphics APIs (e.g. OpenGL, Metal and Vulkan) with a common interface.
There are a lot of good options for abstracting GPU API's; each making different trade-offs. We designed IGL around the following priorities:
- Low-level, forward-looking API. IGL embraces modern abstractions (command buffers, state containers, bindless, etc) and is designed to give more control than OpenGL's state machine API. As a result, IGL can have leaner backends for modern API's (e.g. Metal, Vulkan).
- Minimal overhead for C++. IGL supports new or existing native rendering code without overhead of language interop or the need for other language runtimes.
- Reach + scale in production. IGL has been globally battle-tested for broad device reliability (especially the long-tail of Android devices as well as Quest 2/3/Pro compatibility for OpenGL/Vulkan) and performance-tuned on our apps.
Can anyone explain?
The last thing they want is for some Quest innovation to be hamstrung waiting for a standard body to approve support for some new feature or for a third-party open source maintainer to incorporate some fix/addition/compatibility PR.
Owning a project like this, if they can get developers to use it, is a huge business security asset and competitive advantage for them. That's why this exists and why it's being promoted.
Whether developers see it as worth using instead of other options is a different question. Meta would probably say the answer to "why" for developers is: "to make sure your project gets the most out of the Quest products (as well as other Android platforms), now and in the future"
But then the question just becomes "Why not use wgpu?" instead.
CUDA, OpenCL, Vulkan, Metal, PyTorch, TensorFlow, I don't understand. They all build on CUDA and AMD / Intel / CPUs are treated as 2nd-class citizens, right?
PyTorch and TensorFlow are training and inference libraries. In theory, PyTorch at least (probably also TF) is properly abstracted and can work with all APIs. In practice CUDA gets the most testing and has all the operator fusion kernels you need for good performance, so everyone trains on CUDA. Inference is less resource-intensive than training, and there's a lot of vendors that provide inference-only hardware (e.g. "Edge TPUs") that's better supported, so on the inference end there's more variety in API usage.
You can of course train and inference on CPU but that means terrible performance.
They don’t support D3D, GL or Vulkan, yet both manufacturers still call these things “a GPU”.
Depending on the scope of the feature and the investment the manufacturer wants to make, that's going to be through their driver, through some opaque handle-passing API in the HAL, or through a whole SDK. This not only lets them show off their new functionality in a way that they wouldn't be able to do otherwise, but gives them an opportunity to "lock in" customers (as NVidia did quite effectively with CUDA).
Between crypto, ML, and the already-immense gaming industry, a huge amount of money has gone into "graphics" hardware over the last 10+ years and it's led to lots of novel innovations. And since those innovations weren't anticipated by existing HAL's like DirectX and OpenGL, there's a lot of these new manufacturer-specific tools as well as numerous attempts to fight "lock in" by wrangling them into new repurposable abstractions.
It's just a cyclical process. It'll gradually pass as innovations in this sector plateau again, but that still looks to be some ways out.
Graphics interfaces: Vulcan, Metal ( and older OpenGL, D3D) Non-graphics GPU Compute interfaces: CUDA/(and RocM etc.) Computational Frameworks: Pytorch/Tensorflow/etc.
The graphics interfaces are somewhat distinct from the ML/compute stuff, but as they use the same kind of underlying hardware to do work it's not that simple.
The frameworks are trying to abstract computations from the underlying hardware, e.g. you can run your tensorflow/pytorch code against CPU only, etc. In practice though for "serious" work NVIDIA gpus are the likely target.
The GPU interfaces are trying to do the same thing, roughly, but NVIDIA is far ahead in terms of hardware and dev support, so mostly that is what is deployed.