Skip to main content

@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​

Compose operationsConnect named inputs and outputs and reuse the compiled computation on WebGPU.
Keep data on the GPUShare vectors and tables across operations.
Control executionBranch or repeat work using GPU-resident scalar predicates.

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.

TaskImportStart with
Author and execute a reusable WebGPU program/gpu-graphGPUGraph, gpuExpression. Both run() and caller-owned encoding use this entry.
Implement a lowering or encode concrete passes/gpu-graphGPUGraphCompiler, GPUCommandGraph, resource handles and execution plans
Inspect, capture, or tune graph execution/gpu-graph/diagnosticsGPUCommandGraphInspector, GPUBufferCapture, GPUCommandGraphAutotuner, GPUCommandGraphSubmissionPacer
Dispatch a standalone compute or render kernel/gpu-graphKernel, RenderKernel
Use a built-in numerical primitive/gpu-primitivesGPUMatVec and GPUMatMul
Supply storage or convert Arrow data/gpu-data, /arrowGPUData and GPUVector hold chunks. Describe input formats with plain objects.
Run portable operations or build a lazy evaluator recipe/gpu-simple-graphChoose an authoring mode first. The CPU, WebGL and WebGPU backend entries are for explicit backend setup.
Analyze vertices and edges/gpu-graph-algorithmsGraph 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​

  1. Getting started: inputs → operations → selected results → execution.
  2. Inputs, results, and state: types, dimensions, ownership, storage reuse, and caller-owned encoding. For persistent simulations, continue with mutable state.
  3. Expression syntax: arithmetic, functions, casts, components, and typed rows.
  4. Upload and copy and capacity/count results: data movement and GPU-sized selection.
  5. Texture values and fullscreen shader passes: image inputs, operation-owned results, and shared WebGPU effects.
  6. Operation contracts: extend the graph with explicit logical effects and lowerings. Operation naming shows how graph and domain operation definitions compose.
  7. 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​

InterfaceUse it forExecution
GPUGraphNamed inputs/state and operation-defined results, including custom WebGPU operationscompile(device), then run(bindings) or prepare(bindings) and caller-owned encoding
GPUSimpleGraph reusable operationsShared numeric operations; texture copies and shader passes on WebGPUcompile(device), then run({inputs, outputTargets}); texture-only programs also support prepare()
GPUSimpleGraph evaluator recipesLazy uploads and evaluator operations beyond the shared expression subsetnew GPUSimpleGraph(device), then compile() and run()
GPUCommandGraphExplicit compute, render, and copy passes, textures, and advanced schedulingCompile 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.

SubpathCapability
gpu-simple-graphPortable evaluator-backed composition, upload/copy, scoped runs, and output storage
gpu-primitivesStandalone buffer algorithms, including scan, sort, and reduction
gpu-graph-algorithmsGraph topology, analytics, and layouts
gpu-parseEncoded columnar page decoding
gpu-sfmCalibrated two-view structure from motion
gpu-vector-searchSimilarity search and clustering
gpu-dggs, gpu-h3, gpu-a5, gpu-geospatial, gpu-projectSpatial indexing and coordinate processing
gpu-physics, gpu-geometry, gpu-pointcloud, gpu-timeseriesPhysics and domain computations
gpu-data, gpu-dataframe, gpu-sql, gpu-crossfilterTables, queries, and selection
gpu-raster, gpu-volumeRaster and volume processing
gpu-simulation, gpu-effectsGraph-based ocean/fire simulations and FFT bloom
gpu-traceTrace analytics

For image processing, see texture values and execution bindings.