Documentation
¶
Overview ¶
Command batchcompute is a WASI container that computes on the GPU through the batched command stream (wasi_webgpu_batch) and checks every element it reads back.
GOOS=wasip1 GOARCH=wasm go build -o batchcompute.wasm ./examples/batchcompute wctr run --gpu [--gpu-memory=SIZE] IMAGE [MODE]
It records a compute shader that writes known values into a storage buffer, copies the buffer to a MAP_READ buffer and reads it back in the same submit: one crossing into the host. MODE:
(none) 1 MiB and 4 KiB read-backs, every element checked; exit 0
refusals frames the host must refuse (an out-of-range write, a read
outside the window, a malformed frame, an oversized frame,
an allocation past the GPU memory quota); prints one line
each; exit 0 when every one is refused as expected
shaders WGSL the GPU refuses (a reserved word, a syntax error) must fail with
errno InvalidShader and the compiler's message; a valid source is the
control; exit 0 when every case is as expected
unbounded what the host refuses for its loop budget: errno 13 (the host's bind
group 3 in WGSL, a 4-group layout, a SetBindGroup of 3) and errno 15 (a
loop beside every storage buffer the device allows, a loop in a module
with a vertex entry, an auto layout); a bounded loop is the control
render draws through the stream: WriteTexture a 4x4 r8uint source, an
indexed quad (vertex and index buffers, DrawIndexed, explicit
layouts) into a 64x64 r8uint target, read back by a compute
pass; every pixel checked against the CPU; one submit
quota allocates 64 MiB buffers through the remote device until
the guest-side quota refuses
bench N N interleaved rounds of the per-submit round trip at 4 KiB
and 1 MiB, read-only and compute+copy+read; prints medians
Exit 2 (printing "no GPU") when the container has no GPU: no --gpu, no WebGPU where it runs, or only a software adapter.
Click to show internal directories.
Click to hide internal directories.