Skip to content

GPU Spatial Primitives

A small toolbox of composable, interpretable GPU primitives for analysing point clouds and shapes — cells, transcripts, boundaries — on TypeGPU / WebGPU.

This toolbox grew out of a WebGPU wavelet codec and has two complementary sides:

Image-signal front

Data as a regular grid of samples — the DWT transform pair, convolution, reductions. The classic image-analysis primitives.

Discrete-cell front

Data as irregular points and shapes — neighbour search, density, hotspots, fuzzy graphs. Spatial-biology-style analysis, but the maths is generic.

The bridge between them is rasterising a point cloud into a grid (a density splat), after which the image primitives apply unchanged. The shared idea running through both is windowing: a smooth, overlapping kernel in place of a hard threshold.

Composable

Each primitive takes plain arrays in and returns plain arrays out. Chain them: points → splat → window → z-score is a hotspot map.

Interpretable

Every output has a meaning you can state in a sentence — clustered vs dispersed, hot spot vs cold spot, connection strength — not a black box.

Validated

Every primitive has a CPU golden and a GPU test asserting bit-exact (integer) or bounded-error (float) agreement.

Translatable

Dependency-light raw WebGPU where it counts, so the render/compute kernels port to deck.gl / MDV / SpatialData.js later rather than locking in.

Together these aren’t just engineering taste — they’re what make the toolbox FAIR: a self-describing op catalogue you can find, an open WebGPU runtime and open formats you can access, plain-array contracts that interoperate, and declarative graphs that record their own provenance so results are reusable.