Building for the browser
The same program that runs natively compiles to a self-contained WebGPU bundle:
miri build --target web-gpu program.mi -o bundle/
The bundle contains:
<name>.json— the manifest: compiled WGSL kernels, buffer layouts, frame passes, per-frame input layout, canvas size, and WGSL↔Miri source maps.miri-gpu.js— the embeddable runtime.mount(canvas, manifest)boots the program on any WebGPU-capable browser, wiringframe.*inputs to real pointer events and presenting the paint buffer without a CPU round-trip.index.html— a thin local-dev harness.miri-gpu-headless.js— a Node/Deno headless runner for CI.- a native host binary of the same program, for running outside the browser.
Every demo in the GPU Playground is such a bundle, and the source shown next to each canvas is the verbatim program — a compiler test asserts the displayed code compiles to byte-identical kernels.