WebGPU and the New OS

May 2, 2023

The browser is the new operating system.

In 2011, WebGL first let developers render computations directly to the device’s GPU via the browser. OpenGL’s Shading Language (GLSL) isn’t easy to work with, but better abstractions were developed over time (like Three.js).

But WebGL was still very display-driven — designed to enable rich 3D and 2D experiences in the browser. So you weren’t totally confined to a <canvas> element, but most use cases ended there.

Now there’s WebGPU shipping in Chrome, providing a more general interface to the underlying GPU APIs. In addition, WebGPU lets developers use new native accelerations like Apple Metal, Microsoft Direct3D 12, and Vulkan.

This means that GPU acceleration in the browser won’t just be used for drawing on a canvas. Matrix multiplications in Tensorflow.js are already supported with a WebGPU backend. There are a few LLMs that have added support for it as well.

WebGPU makes browsers start to resemble a more traditional operating system.

  • Kernel — In Chrome, the browser engine (Blink) manages process execution, memory, and communication
  • File system — In Chrome, there’s IndexedDB, Cache API, LocalStorage, and File API.
  • Machine executable binary format —  WebAssembly faintly resembles executable and linkable format (ELF) on Linux.
  • Hardware modules — WebGPU now provides a more direct API to the underlying hardware. Existing hardware APIs also access microphones, cameras, and other plugins.