@luma.gl/graph
@luma.gl/graph provides operations, GPU data, and execution infrastructure. Start with
Getting started with graphs for a complete computation and cleanup example.
Feature card​
Compare GPU data and compute support.
Choose an import​
Paths below are relative to @luma.gl/graph. Import from a named entry point.
These are the imports used for each task in this guide.
| Task | Import | Start with |
|---|---|---|
| Author and execute a reusable WebGPU program | /gpu-graph | GPUGraph, gpuExpression. Both run() and caller-owned encoding use this entry. |
| Implement a lowering or encode concrete passes | /gpu-graph | GPUGraphCompiler, GPUCommandGraph, resource handles and execution plans |
| Inspect, capture, or tune graph execution | /gpu-graph/diagnostics | GPUCommandGraphInspector, GPUBufferCapture, GPUCommandGraphAutotuner, GPUCommandGraphSubmissionPacer |
| Dispatch a standalone compute or render kernel | /gpu-graph | Kernel, RenderKernel |
| Use a built-in numerical primitive | /gpu-primitives | GPUMatVec and GPUMatMul |
| Supply storage or convert Arrow data | /gpu-data, /arrow | GPUData and GPUVector hold chunks. Describe input formats with plain objects. |
| Run portable operations or build a lazy evaluator recipe | /gpu-simple-graph | Choose an authoring mode first. The CPU, WebGL and WebGPU backend entries are for explicit backend setup. |
| Analyze vertices and edges | /gpu-graph-algorithms | Graph topology and analytics. Other domain entries are listed below. |
Benchmark drivers use the owning library’s /benchmarks entry. Import flow and fluid simulations from /gpu-simulation and path or polygon preparation from /gpu-models.
The /_internal/* paths support implementation sharing within the repository.
Learn in this order​
- Getting started: inputs → operations → selected results → execution.
- Inputs, results, and state: types, dimensions, ownership, storage reuse, and caller-owned encoding. For persistent simulations, continue with mutable state.
- Expression syntax: arithmetic, functions, casts, components, and typed rows.
- Upload and copy and capacity/count results: data movement and GPU-sized selection.
- Texture values and fullscreen shader passes: image inputs, operation-owned results, and shared WebGPU effects.
- Operation contracts: extend the graph with explicit logical effects and lowerings. Operation naming shows how graph and domain operation definitions compose.
- Command-graph concepts: scheduling and physical resources when implementing a lowering or diagnosing execution.
Read CPU and GPU data flow for residency, transfer diagrams, Arrow/GeoArrow adapters, and layer preparation.
Choose an interface​
| Interface | Use it for | Execution |
|---|---|---|
GPUGraph | Named inputs/state and operation-defined results, including custom WebGPU operations | compile(device), then run(bindings) or prepare(bindings) and caller-owned encoding |
GPUSimpleGraph reusable operations | Shared numeric operations; texture copies and shader passes on WebGPU | compile(device), then run({inputs, outputTargets}); texture-only programs also support prepare() |
GPUSimpleGraph evaluator recipes | Lazy uploads and evaluator operations beyond the shared expression subset | new GPUSimpleGraph(device), then compile() and run() |
GPUCommandGraph | Explicit compute, render, and copy passes, textures, and advanced scheduling | Compile fixed resource descriptors, encode into a caller-owned encoder, submit explicitly |
These are related layers, not interchangeable APIs. Full GPUGraph execution currently requires
WebGPU. SimpleGraph supports prepared texture-copy/shader-pass programs on WebGPU; numeric
evaluator programs use asynchronous run(). It does not support full-graph custom lowerings or
mutable state. Its evaluator recipes also have different result ownership; see its
mode comparison.
How the layers fit​
GPUGraph describes logical operations. Reusable compilation checks their contracts and builds
expression kernels. Preparing an invocation resolves dimensions and lowers operations through
GPUGraphCompiler into a GPUCommandGraph. The command graph schedules concrete passes,
tracks hazards, and plans compatible transient reuse. Encoding appends those commands; the
application or run() submits them.
Applications normally use graph.compile(device). The lower-level GPUGraphCompiler.compile()
returns command-graph declarations for advanced composition and requires concrete vector
sizes. See the GPUGraph reference and
command-graph reference.
Data and processing modules​
GPU data primitives live in @luma.gl/graph/gpu-data. A GPUData owns or borrows one buffer;
a GPUVector describes an ordered sequence of chunks. Engine renderers consume these shared
types. Logical graph declarations describe values; they do not own the input buffers.
Optional processing modules use explicit subpaths. Their individual references identify whether they provide semantic operations, command-graph contributors, or higher-level workflows; sharing the graph package does not imply every algorithm accepts the reusable expression interface.
| Subpath | Capability |
|---|---|
gpu-simple-graph | Portable evaluator-backed composition, upload/copy, scoped runs, and output storage |
gpu-primitives | Standalone buffer algorithms, including scan, sort, and reduction |
gpu-graph-algorithms | Graph topology, analytics, and layouts |
gpu-parse | Encoded columnar page decoding |
gpu-sfm | Calibrated two-view structure from motion |
gpu-vector-search | Similarity search and clustering |
gpu-dggs, gpu-h3, gpu-a5, gpu-geospatial, gpu-project | Spatial indexing and coordinate processing |
gpu-physics, gpu-geometry, gpu-pointcloud, gpu-timeseries | Physics and domain computations |
gpu-data, gpu-dataframe, gpu-sql, gpu-crossfilter | Tables, queries, and selection |
gpu-raster, gpu-volume | Raster and volume processing |
gpu-simulation, gpu-effects | Graph-based ocean/fire simulations and FFT bloom |
gpu-trace | Trace analytics |
For image processing, see texture values and execution bindings.