Reference

flowG's kernel is small: 22 universal primitives and 11 wire kinds: a closed, fixed vocabulary for every programming pattern. This reference documents the FunctionGraph IR that realizes them; the Lux/compute projection extends the 22 with tensor and aggregate nodes (TensorLiteral, StructCreate, …) and an Custom(op) extension point for kernels.

For the embedding API (the Rust flowg crate), see docs.rs/flowg.

Core types

TypeWhat it is
FunctionGraphThe IR. A DAG of nodes and wires with a name, an output node, and a return type. ProgramGraph bundles functions, an entry point, and per-function effect-allow declarations.
GraphNodeThe node kinds: Param, Literal, TensorLiteral, Apply{op}, Select, WhileLoop, Call, Match, CodeBlock, plus capability and concurrency nodes.
OpKindThe operation an Apply performs: arithmetic / comparison / logic primitives, plus Custom(String): the open extension point every kernel hooks (matmul, ssm_scan, rms_norm, …).
WireKindEdge semantics: Move (default), Borrow, MutBorrow, Copy, Channel, Shared, Weak, Stream, Error, Lazy, Feedback. Ownership, generalized.
TensorLiteralDataA shaped, typed constant. Weights stay out of band in a safetensors sidecar and are reattached by name.
CapabilityRefA gated call: capability id + version + slot + method + effects. No ambient authority; effects are checked at dispatch.

Targets

The same graph dispatches across targets through OpDispatch, addressed by (op, dtype, layout, target):

TargetBacking
CPUreference kernels + BLAS (Accelerate / OpenBLAS / MKL)
Apple SiliconMetal / MPS fused kernels
NVIDIACUDA (cuBLAS)
Portable GPUWGPU (Vulkan / Metal / DX12) and the browser (WASM + WebGPU)
AMXApple matrix coprocessor

Uncovered ops fall through to the CPU reference path, so a graph always runs.

Energy receipts

Every dispatch carries an EnergyEstimate { picojoules, measured }. Placement prefers measured calibration (IOReport on Apple Silicon, NVML on NVIDIA, RAPL on x86_64 Linux) over the analytical prior. A run can emit a per-op receipt, see the energy-receipt example.

Emitters

flowG can lower the same graph to source for other ecosystems (WGSL, WASM, ONNX, StableHLO, MLIR-linalg, Triton) and to its own .fg binary format. See the wgsl-codegen example.

See also