Skip to main content

Module graph_ops

Module graph_ops 

Source
Expand description

Native compute-graph op-node kernels — WGSL templates emitted directly from a graph node (not delegated to a legacy BuiltinKernel emitter, since these op-classes have no legacy standalone kernel). Each carries an exact CPU oracle and a GPU differential certify, exactly like the rest of the forge.

Phase 2 lands the LLM-normalization building blocks: reduce (RMSNorm variance / softmax max+denominator) and broadcast (scale/bias fanout). They are lowered from OpNode::Reduce / OpNode::Broadcast by the WGSL graph lowerer. See [docs/plans/dag-ir-forge.md].

Modules§

broadcast
Native Broadcast op-node — tile a vector across a larger output by index remap (out[i] = input[i % in_len]). This is RMSNorm/bias scale-fanout: a per-feature vector scale[d] expanded across tokens so out[t*d + j] = scale[j]. No arithmetic, one invocation per output element.
elementwise
Native Elementwise op-node — per-element maps, the LLM activation/arithmetic kit.
executor
Multi-node graph executor — the keystone that runs a whole [ComputeGraph] on the GPU with intermediates kept device-side, plus a topologically-composed CPU oracle. This is what unblocks softmax, RMSNorm, the SwiGLU-FFN block, and the full LLM decode DAG. See [docs/plans/dag-ir-forge.md] §7–§9.
gather_dequant
Native GatherDequant op-node — on-the-fly ternary weight dequant producing an f32 tensor that a downstream MatMul consumes (the {GatherDequant → MatMul} split, plan §2 / P4b). This is the LLM weight-decompression primitive: BitNet-style 2-bit ternary codes unpacked to {0, +1, −1} and scaled per row.
neighbor
Native Neighbor op-node — spatial proximity queries (Frnn/Knn/Range): the SPH / N-body cutoff and the ANN/kNN candidate-generation primitive (plan §2/§6, P7).
p64_bridge
p64 → forge bridge: read a transcoded model’s role-tagged weights out of a p64 volume as f32, laid out for the forge decode-layer graph.
reduce
Native Reduce op-node — the first compute-graph node the WGSL backend emits from scratch (Phase 1’s gemm/gemv/fft delegate to legacy emitters; there is no legacy standalone reduce, so this is a real graph-template lowering).
scatter
Native ScatterAccum op-node — scatter src[p] into output[idx[p]] with an associative accumulate (plan §2 / P7): the SPH density/force deposit and N-body short-range gather.
slice
Native Slice op-node — extract a contiguous sub-range input[offset .. offset+len].
stencil
Native Stencil op-node — local neighbourhood maps over a 1-D grid (plan §2 / P7). The seed kind is the Laplacian out[i] = in[i-1] − 2·in[i] + in[i+1] with zero (Dirichlet) boundaries — the discrete Poisson operator under fluid pressure-solve / diffusion, and the Reduce-free half of a stencil sweep.
vision
Vision op-node kernels (V3b): Pool2D, Resize2D, Conv2D — WGSL + CPU oracles.