Examples

Working examples demonstrating Gridwise primitives in the browser. All examples run WebGPU compute on the GPU and display results in the page. Open any example in a WebGPU-capable browser (Chrome or Edge 113+, or Safari 18+).

Standalone Examples

These examples run with fixed parameters and require no configuration. They demonstrate a single primitive end-to-end: device setup, buffer allocation, GPU execution, and result validation.

Scan / Reduce

Runs exclusive scan, inclusive scan, and reduce over random input arrays using the add, min, and max binary operations. Output is plotted against a CPU-computed reference.

Open Example Source

Sort

Sorts an array of random keys on the GPU using the OneSweep radix sort. Demonstrates keysonly and key-value sorting in both ascending and descending directions across u32, i32, and f32 types. Results are validated against a CPU reference.

Open Example Source

Reduce

Computes a sum-reduction over 224 i32 values, producing a single output. The page walks through the essential API calls with inline code excerpts and validates the GPU result against a CPU reference.

Open Example Source

Configurable Examples

These examples expose a configuration pane so you can interactively choose the primitive, datatype, binary operation, and input length before running.

Scan / Reduce with Configuration Pane

Interactive scan and reduce demonstration. Set the scan type (exclusive, inclusive, or reduce), datatype, binary operation, and input length in the pane, then click Start to run on the GPU and validate the output.

Open Example Source

Regression Testing

Gridwise Regression Tests

Runs a correctness suite covering scan, reduce, and sort across multiple datatypes, binary operations, input sizes, and sort directions. Each test reports pass or fail individually. A second suite of large tests (1M–3M elements) can be triggered separately via a button once the main suite completes.

Open Example Source