Expand description
Core types for Polydat nodes: values, ports, metadata, and the evaluation trait.
The Polydat type system has three layers:
-
Runtime values (
Value) — the enum that flows through the DAG at evaluation time. Every interpreter buffer slot holds aValue; compiled kernels carry the same values as typedu64slots. -
Port types (
PortType) — compile-time type tags on node input/output ports. The assembler validates that wiring connects compatible types and auto-inserts adapters when not. -
Slot types (
SlotType) — distinguishes wire inputs (cycle-time values) from constant parameters (baked at construction). The DSL compiler uses these to decide whether a literal in a function call is a wire promotion or a const arg.
The PolydatNode trait is what every node function implements.
A node declares its port metadata via NodeMeta and evaluates
via eval(&[Value], &mut [Value]).
Structs§
- Bits128
- Two-limb carrier for 128-bit integers inside
Value. - Compiled
Slot Kit - A slot-compiled node’s closure plus its scratch declaration
(one
ScratchElemper vector-producing output, in port order). Returned byPolydatNode::compiled_slot. - Fusion
Subgraph - Borrowed view of the subgraph a fusion node replaced. Local
wiring convention:
WireSource::Input(i)refers to the fusion node’s i-th input wire in the OUTER graph;NodeOutput(j, p)refers to memberj’s portp. - Node
Meta - Metadata describing a node’s interface: its input slots and output ports.
- Node
State - Node-defined state held by a kernel state (
ScratchElem::State): what a node keeps between its evaluations in one state, typed by the node and never shared between states. Empty until the node first fills it; a clone is empty, since a clone of a state is a new state (compiled_handles.md §3). - Port
- Descriptor for a single input or output port on a node.
- Simd
Variant - Semantic contract for a scalar node’s explicitly registered SIMD variant.
- Slice
Arc - Arc-managed typed slice. Holds a borrow into a parent Arc’d
owner — typically either an owned backing buffer (
Arc<[T]>) or a long-lived resource like an mmap’d dataset. Cloning is oneArc::clone(atomic increment, zero allocations); the owner is type-erased asArc<dyn Any + Send + Sync>so the sameSliceArc<T>shape covers both modes.
Enums§
- Commutativity
- Declares which inputs of a node are interchangeable.
- Compile
Level - The maximum compilation level a node supports.
- Const
Value - A concrete constant value stored in node metadata.
- JitType
- JIT-compatible primitive carriers.
- Lifecycle
- The lifecycle of a port’s value.
- Port
Type - Compile-time type tag for a port on a Polydat node.
- Purity
- Per-node purity classification per
runtime_model.md’s D2 axiom andcomposition_substrate.md’s T1+T2 axioms. - RegLanes
- Lane-typing view tag for
Value::Reg128— which interpretation a 128-bit register word currently carries (type_system_alignment.md §8.4 layer 2).Rawis the algorithm-defined buffer-state view (heterogeneous lane roles); the typed views are homogeneous[T; N]readings. All views are free bitcasts of one another. - Scratch
Buf - One kernel-owned scratch buffer. A
Ref2output port’s(ptr, len)buffer slots view its scratch — the kernel owns the allocation, so the pointer is valid exactly as long as the producing step doesn’t rerun (and a rerun rewrites the slots before any consumer reads them). No Arc traffic, no allocation after warmup: a string or byte string is rewritten in place, a value is replaced. - Scratch
Elem - Element type of one kernel-owned scratch buffer
(type_system_alignment.md §8.4 layer 3). One entry per
Ref2-colored output port of a slot-compiled node: a typed vector, a string, a byte string, or a value held by reference. - Side
Channel Sink - Where a
Purity::SideChannelnode writes its observable side effects. Hosts reasoning about side-channel determinism (D2) pattern-match on this to know what observable surface to expect. - Slot
- A single logical input to a node: either a runtime wire or an
assembly-time constant. The positional order in
NodeMeta.slotsmatches the function call syntax in the DSL. - Slot
Color - Slot color of a
PortTypein compiled kernel buffers — axiom S1: static, total, three-valued.Imm*slots carry immediate data only (never addresses);Ref2pairs carry a(ptr, len)reference to storage with a proven owner: the step’s own scratch, an extern’s stored value, an interned constant, or a boundary value alive for the call. They are engine-internal per axiom S2. - Slot
Type - The type discriminant for a slot: wire or typed constant.
- Value
- A typed value on a wire: what a node reads and produces on the interpreter, and what a host sets and pulls on every engine.
- Value
Ref - A borrowed view of a
Value(SRD 115 §6.1): what a compiled helper or closure sees for an argument it does not own. A scalar is carried by value, a string or byte string by reference into the arena or the interner, a JSON value by reference into the value table, and any other variant by reference to theValueitself. The P1 nodes build the same view from theirValueinputs, so one body serves both tiers without copying a string argument to inspect it. - Wire
Cost - Cost class for an input wire, indicating how expensive it is to change the value on this port.
Traits§
- Polydat
Node - Runtime evaluation interface for a Polydat node.
- Reflected
Value - Trait for adapter-contributed value types.
- Slot
Shape - What a port type means to a compiled buffer: its slot color, the
width that follows from it, and the scratch element a by-reference
producer owns. The type itself is the grammar’s
(
polydat_grammar::PortType); these are the runtime’s reading of it, and every layout, codegen, and guard decision derives from them.
Functions§
- compile_
level_ of - Determine the compile level of a node (works on trait objects).
Type Aliases§
- Compiled
Slot Op - Compiled closure for a node with typed-slice ports (§8.4
layer 3). Same calling shape as
CompiledU64Opplus the step’s scratch buffers: slice inputs arrive as(ptr, len)slot pairs ininputs; vector outputs are written into scratch and their(ptr, len)intooutputs. - Compiled
U64Op - A compiled u64-only evaluation step.