pub struct PolydatAssembler { /* private fields */ }Expand description
Builder for assembling a Polydat Kernel programmatically.
Implementations§
Source§impl PolydatAssembler
impl PolydatAssembler
Sourcepub fn new(input_names: Vec<String>) -> Self
pub fn new(input_names: Vec<String>) -> Self
Create a new assembler with the given coordinate names.
Sourcepub fn set_cursor_schemas(&mut self, schemas: Vec<SourceSchema>)
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.
Sourcepub fn cursor_schemas(&self) -> &[SourceSchema]
pub fn cursor_schemas(&self) -> &[SourceSchema]
The cursors the program declares.
Sourcepub fn set_strict_wires(&mut self, strict_types: bool, strict_values: bool)
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.
Sourcepub fn set_strict(&mut self, strict: bool)
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.
Sourcepub fn set_jit_mode(&mut self, mode: JitMode)
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.
Sourcepub fn set_context(&mut self, source: &str, context: &str)
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.
Sourcepub fn add_node(
&mut self,
name: impl Into<String>,
node: Box<dyn PolydatNode>,
inputs: Vec<WireRef>,
) -> &mut Self
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.
Sourcepub fn set_output_modifier(&mut self, name: &str, modifier: BindingModifier)
pub fn set_output_modifier(&mut self, name: &str, modifier: BindingModifier)
Set the binding modifier for a named output.
Sourcepub fn mark_const_output(&mut self, name: &str)
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.
Sourcepub fn add_output(
&mut self,
name: impl Into<String>,
wire: WireRef,
) -> &mut Self
pub fn add_output( &mut self, name: impl Into<String>, wire: WireRef, ) -> &mut Self
Designate a wire as a named output variate.
Sourcepub fn add_input(
&mut self,
name: impl Into<String>,
default: Value,
port_type: PortType,
kind: InputKind,
) -> &mut Self
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.
Sourcepub fn set_input_type(&mut self, name: &str, port_type: PortType)
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.
Sourcepub fn input_names(&self) -> Vec<&str>
pub fn input_names(&self) -> Vec<&str>
Return the names of all inputs (coordinates + captures).
Sourcepub fn node_output_type(&self, name: &str) -> Option<PortType>
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.
Sourcepub fn output_names(&self) -> Vec<&str>
pub fn output_names(&self) -> Vec<&str>
Return the names of declared outputs.
Sourcepub fn output_type(&self, name: &str) -> Option<PortType>
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.
Sourcepub fn input_type(&self, name: &str) -> Option<PortType>
pub fn input_type(&self, name: &str) -> Option<PortType>
Look up the port type of a graph input by name.
Sourcepub fn wire_type(&self, wire: &WireRef) -> Option<PortType>
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).
Sourcepub fn compile(self) -> Result<PolydatKernel, AssemblyError>
pub fn compile(self) -> Result<PolydatKernel, AssemblyError>
Validate, resolve, and produce a Phase 1 runtime kernel.
Sourcepub fn compile_with_log(
self,
log: Option<&mut CompileEventLog>,
) -> Result<PolydatKernel, AssemblyError>
pub fn compile_with_log( self, log: Option<&mut CompileEventLog>, ) -> Result<PolydatKernel, AssemblyError>
Compile with diagnostic event logging.
Sourcepub fn try_compile(self) -> Result<CompiledKernelPushPull, Box<PolydatKernel>>
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.
Sourcepub fn try_compile_raw(self) -> Result<CompiledKernelRaw, Box<PolydatKernel>>
pub fn try_compile_raw(self) -> Result<CompiledKernelRaw, Box<PolydatKernel>>
Phase 2 compilation without provenance caching.
Sourcepub fn try_compile_push(self) -> Result<CompiledKernelPush, Box<PolydatKernel>>
pub fn try_compile_push(self) -> Result<CompiledKernelPush, Box<PolydatKernel>>
Phase 2 compilation with push-side provenance only (no cone guard).
Sourcepub fn try_compile_pull(self) -> Result<CompiledKernelPull, Box<PolydatKernel>>
pub fn try_compile_pull(self) -> Result<CompiledKernelPull, Box<PolydatKernel>>
Phase 2 compilation with pull-side cone guard only (no per-node skip).
Sourcepub fn try_compile_jit(self) -> Result<HybridKernelPushPull, String>
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.
Sourcepub fn try_compile_jit_raw(self) -> Result<HybridKernelRaw, String>
pub fn try_compile_jit_raw(self) -> Result<HybridKernelRaw, String>
P3, raw: every evaluation runs every step.
Sourcepub fn try_compile_jit_push(self) -> Result<HybridKernelPushPull, String>
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.
Sourcepub fn try_compile_jit_pull(self) -> Result<HybridKernelPull, String>
pub fn try_compile_jit_pull(self) -> Result<HybridKernelPull, String>
P3, pull: the cone guard alone.
Sourcepub fn try_compile_tier1_simd_ordinal(
self,
driving_input: &str,
output: &str,
) -> Result<Tier1SimdExecutor, Tier1SimdError>
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
impl PolydatAssembler
Sourcepub fn compile_with(
self,
engine: Engine,
) -> Result<Box<dyn Kernel>, KernelError>
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.
Sourcepub fn compile_kernel(self) -> Result<Box<dyn Kernel>, KernelError>
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.
Sourcepub fn compile_engine_with_log(
self,
engine: Engine,
log: Option<&mut CompileEventLog>,
) -> Result<Box<dyn Kernel>, KernelError>
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§
impl !RefUnwindSafe for PolydatAssembler
impl !UnwindSafe for PolydatAssembler
impl Freeze for PolydatAssembler
impl Send for PolydatAssembler
impl Sync for PolydatAssembler
impl Unpin for PolydatAssembler
impl UnsafeUnpin for PolydatAssembler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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