Skip to main content

PolydatAssembler

Struct PolydatAssembler 

Source
pub struct PolydatAssembler { /* private fields */ }
Expand description

Builder for assembling a Polydat Kernel programmatically.

Implementations§

Source§

impl PolydatAssembler

Source

pub fn new(input_names: Vec<String>) -> Self

Create a new assembler with the given coordinate names.

Source

pub fn set_cursor_schemas(&mut self, schemas: Vec<SourceSchema>)

Record the cursors the program declares, with the partitions the compiler resolved for each. Every kernel built from this assembler reports them through cursor_schemas and narrows one through set_cursor.

Source

pub fn cursor_schemas(&self) -> &[SourceSchema]

The cursors the program declares.

Source

pub fn set_strict_wires(&mut self, strict_types: bool, strict_values: bool)

Enable strict-wire-mode auto-insertion of value/type assertion nodes (SRD 15 §“Strict Wire Mode”). Off by default — the caller (compiler / DSL pragma extractor) opts in.

Source

pub fn set_strict(&mut self, strict: bool)

Strict mode, on every engine this assembler builds for: an implicit type coercion, a config wire fed from a cycle-time source, a nondeterministic node no volatile output acknowledges, and a binding nothing reads are errors. Off by default; the DSL sets it from its strict option.

Source

pub fn set_jit_mode(&mut self, mode: JitMode)

Override the engine-mix mode for this compile (SRD-105). Unset assemblers defer to the process default.

Source

pub fn set_context(&mut self, source: &str, context: &str)

Set the source text and diagnostic context for this assembler. Called by the DSL compiler to attach the original Polydat source.

Source

pub fn add_node( &mut self, name: impl Into<String>, node: Box<dyn PolydatNode>, inputs: Vec<WireRef>, ) -> &mut Self

Add a node to the assembler with the given name and input wiring.

Source

pub fn set_output_modifier(&mut self, name: &str, modifier: BindingModifier)

Set the binding modifier for a named output.

Source

pub fn mark_const_output(&mut self, name: &str)

Mark an output as declared with the const keyword. Compile- time and scope-activation checks (SRD 11 §“Init Binding Contract”) read this set to enforce const-like-constraint semantics on the binding.

Source

pub fn add_output( &mut self, name: impl Into<String>, wire: WireRef, ) -> &mut Self

Designate a wire as a named output variate.

Source

pub fn add_input( &mut self, name: impl Into<String>, default: Value, port_type: PortType, kind: InputKind, ) -> &mut Self

Declare an additional named input.

Added after coordinate inputs. Nodes wire to it via WireRef::input(name) — same as coordinate inputs. kind controls the lifecycle classification used by the init-binding contract (see evaluation_model.md §“Effectively-Const Nodes”): IterationExtern for slots populated by materialize_wiring_from_outer, ExternalWrite for slots written by capture extraction.

Source

pub fn set_input_type(&mut self, name: &str, port_type: PortType)

Override a declared input’s port type. new seeds every input_names entry with PortType::U64; this applies the type from an input <name>: <type> declaration. No-op if the input isn’t present.

Source

pub fn input_names(&self) -> Vec<&str>

Return the names of all inputs (coordinates + captures).

Source

pub fn node_output_type(&self, name: &str) -> Option<PortType>

Query the output port type of a named node (first output). Returns None if the node is not found or has no output ports; callers surface the absence as a loud diagnostic rather than silently substituting a default.

Source

pub fn output_names(&self) -> Vec<&str>

Return the names of declared outputs.

Source

pub fn output_type(&self, name: &str) -> Option<PortType>

Look up the output port type of a named node.

Returns the first output port’s PortType if the node exists.

Source

pub fn input_type(&self, name: &str) -> Option<PortType>

Look up the port type of a graph input by name.

Source

pub fn wire_type(&self, wire: &WireRef) -> Option<PortType>

Look up the produced port type of a WireRef. Returns None if the wire’s source isn’t yet known to the assembler (e.g. it points to a not-yet-added node — a bug in the binding compiler if it happens).

Source

pub fn compile(self) -> Result<PolydatKernel, AssemblyError>

Validate, resolve, and produce a Phase 1 runtime kernel.

Source

pub fn compile_with_log( self, log: Option<&mut CompileEventLog>, ) -> Result<PolydatKernel, AssemblyError>

Compile with diagnostic event logging.

Source

pub fn try_compile(self) -> Result<CompiledKernelPushPull, Box<PolydatKernel>>

Validate, resolve, and attempt Phase 2 compilation.

Returns Ok(CompiledKernelPushPull) if all nodes are u64-only and provide compiled_u64(). Falls back to Err(Box<PolydatKernel>) (a working Phase 1 kernel; boxed so the happy-path Result stays small) if any node cannot be compiled.

Source

pub fn try_compile_raw(self) -> Result<CompiledKernelRaw, Box<PolydatKernel>>

Phase 2 compilation without provenance caching.

Source

pub fn try_compile_push(self) -> Result<CompiledKernelPush, Box<PolydatKernel>>

Phase 2 compilation with push-side provenance only (no cone guard).

Source

pub fn try_compile_pull(self) -> Result<CompiledKernelPull, Box<PolydatKernel>>

Phase 2 compilation with pull-side cone guard only (no per-node skip).

Source

pub fn try_compile_jit(self) -> Result<HybridKernelPushPull, String>

P3, push+pull: native code for every node that has a lowering and the node’s closure elsewhere, over one slot buffer (engine parity, step 7). Accepts every program the closure tier accepts; compile_hybrid builds the same kernel.

Source

pub fn try_compile_jit_raw(self) -> Result<HybridKernelRaw, String>

P3, raw: every evaluation runs every step.

Source

pub fn try_compile_jit_push(self) -> Result<HybridKernelPushPull, String>

P3, push: per-step skipping. The P3 kernel’s push form is its push+pull form, since its cone guard costs nothing a push-only host would notice.

Source

pub fn try_compile_jit_pull(self) -> Result<HybridKernelPull, String>

P3, pull: the cone guard alone.

Source

pub fn try_compile_tier1_simd_ordinal( self, driving_input: &str, output: &str, ) -> Result<Tier1SimdExecutor, Tier1SimdError>

Compile the conservative perfect-ordinal Tier-1 SIMD execution plan.

Ordinary compile() semantics are unchanged. This explicit surface retains the selected scalar DAG as a fallback and synthesizes a second, register-typed DAG for one named output and driving cursor input.

Source§

impl PolydatAssembler

Source

pub fn compile_with( self, engine: Engine, ) -> Result<Box<dyn Kernel>, KernelError>

Build a kernel on engine: the interpreter, the closure tier, the hybrid kernel, or pure native code, with the provenance mode the engine names. Every engine accepts every program the interpreter accepts, or refuses it with a reason naming the node or construct (KernelError::Refused). The older constructors (compile, try_compile*, compile_hybrid, try_compile_jit*) remain as aliases of this one for their engine.

Source

pub fn compile_kernel(self) -> Result<Box<dyn Kernel>, KernelError>

Self::compile_with on Engine::default: compiled code, with the JIT where the build has it.

Source

pub fn compile_engine_with_log( self, engine: Engine, log: Option<&mut CompileEventLog>, ) -> Result<Box<dyn Kernel>, KernelError>

Self::compile_with with the compile event log, which receives the assembly events for every engine.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more