
Eskiu GPU: compute, rendering,
3D models and ML over WebGPU
Eskiu GPU is the Eskiu language's package for the GPU. It is built on wgpu-native, so one API runs on Metal, Vulkan and DirectX 12, with shaders in WGSL. It loads glTF, GLB and OBJ models and draws them with physically based shading and animation, and it runs transformer inference and training on the GPU.
import <io>;
import <gpu>;
string twice = "@group(0) @binding(0) var<storage, read_write> v: array<f32>;\n"
"@compute @workgroup_size(64)\n"
"fn main(@builtin(global_invocation_id) id: vec3<u32>) { v[id.x] = v[id.x] * 2.0; }\n";
Result<int, string> run() {
float[256] data;
for (i in 0..256) data[i] = (float)i;
Gpu gpu = gpu_open()?;
defer gpu.release();
GpuBuffer v = gpu.storage(&data, sizeof(data))?;
defer v.release();
GpuKernel k = gpu.kernel(twice, "main")?;
defer k.release();
k.bind(0, &v);
k.dispatch(4, 1, 1)?;
v.read(&data, sizeof(data))?;
printf("%.1f\n", (double)data[255]);
return Ok<int, string>(0);
}v0.1.0, MIT licensed, early release. Part of the Eskiu project.
What the package covers
Everything from a single compute dispatch to an animated glTF model in a window, with the idiomatic layer on top and the raw WebGPU C API underneath.
Compute
Storage buffers, WGSL kernels and dispatches, with results read straight back into Eskiu memory.
Rendering
Textures, samplers, depth buffers, vertex, index and uniform buffers, render pipelines and passes, to an offscreen texture or a window opened over SDL3.
3D models
Loads glTF 2.0 (.gltf and .glb) and Wavefront OBJ with MTL materials, and draws either with physically based shading, normal maps, alpha modes, skinning and animation.
Machine learning
Transformer inference from GGUF, safetensors or llama2.c files, with quantized Q4_0 and Q8_0 kernels, and network training with automatic differentiation and Adam.
Images in pure Eskiu
PNG and JPEG (baseline and progressive) decoding written in Eskiu itself, with sRGB and mipmapped textures.
Errors as Result, and the whole API underneath
Every call that can fail returns a Result with the WebGPU validation message, and a WGSL error comes with its line and column. Drop down to all of webgpu.h through <gpu/raw> whenever you need to.
3D models, the format of AR and VR
glTF and GLB are how 3D content moves between tools, the Editor and ViroReact apps. Eskiu GPU loads them, with their materials, skins and animations, and draws them with glTF's metallic-roughness model.


Gltf data = model_load("helmet.glb")?; // or a .gltf, or an .obj
defer data.free();
GpuModel model = gpu.model(&data, surface.format)?;
defer model.release();
// every frame
data.animate(0, seconds);
model.update(mat4_identity());
GpuCamera cam = model.camera(aspect);
GpuPass pass = gpu.pass(frame.view, GpuColor{0.1, 0.1, 0.1, 1.0}, &depth);
model.draw(&pass, &cam);
pass.end()?;Not supported yet: morph targets, image-based lighting and shadows, Draco and meshopt compression, and KTX2 textures.
Machine learning on the GPU
The Llama 2 example records the forward pass once and replays it as one compute pass per token, with matrix-vector products in f32, f16, Q8_0 and Q4_0. Its outputs match llama2.c byte for byte, and llama.cpp and Hugging Face transformers token for token, on the prompts tested.
| Model | Eskiu GPU | Reference |
|---|---|---|
| stories110M (llama2.c, f16) | 350 tokens/s | llama2.c on the CPU: 22 tokens/s |
| TinyLlama 1.1B Q4_0 (GGUF) | 178 tokens/s | llama.cpp (Metal): 260 tokens/s |
| Llama 2 7B Q4_0 (GGUF) | 45 tokens/s | llama.cpp (Metal): 58 tokens/s |
Apple M4 Pro, greedy decoding. Figures from the repository README.
NnGraph g = gpu.nn_graph(100)?;
NnVar x = g.input(784);
NnVar labels = g.labels();
NnVar h = g.relu(g.bias(g.matmul(x, g.param(784, 128, 0.05)), g.param(1, 128, 0.0)));
NnVar logits = g.bias(g.matmul(h, g.param(128, 10, 0.125)), g.param(1, 10, 0.0));
NnVar loss = g.cross_entropy(logits, labels);
g.backward(loss)?; // records the gradients of every operation
g.adam(0.001); // and the optimizer stepThe MNIST example trains a two-layer network to 97% test accuracy in three epochs, about 0.4 s each, and saves weights as safetensors that PyTorch loads with the same accuracy.
Where it runs
The WebGPU modules run on desktop today. The plain Eskiu modules already run everywhere Eskiu does, and phone and browser support for the GPU modules is planned.
Get started
The package needs wgpu-native 29, and SDL3 for windows. On macOS,brew install wgpu-native sdl3 covers both. Then add it to an Eskiu package (Eskiu 0.12 or newer).
Add the package
Then build with eskiuc build -L/opt/homebrew/lib, pointing -L at the directory that holds libwgpu_native. On Linux and Windows, wgpu-native comes from its release archives.
Learn more
- GitHub →Source, module reference, tests and issues. v0.1.0, MIT.
- Examples →A triangle, a textured cube, a glTF and OBJ viewer, Llama 2 and MNIST.
- The Eskiu language →The systems language behind ReactVision's AR engine.
Frequently asked questions
What is Eskiu GPU?
How does it relate to ReactVision?
Which 3D model formats does it load?
Does it run on iOS, Android or the web?
How fast is the machine learning?
How do I install it?
Follow the work
Eskiu GPU is early and moving fast. Star the repository, try the examples, and bring questions and bug reports to the team.