pub struct PolydatKernel {
pub constants_folded: usize,
/* private fields */
}Expand description
A compiled Polydat Kernel: an Arc<PolydatProgram> plus one PolydatState.
§Invariants
- Scope coordinates are always populated. After construction
scope_coordsreflects this kernel’s place in the comprehension chain: leaf-first list ofsuper::ScopeCoordfrom the kernel’s own scope up through every enclosing comprehension. Root-scope kernels (no parent) start with their own coords (or empty).Self::materialize_wiring_from_outerre-computes the path so post-bind it includes the outer’s chain. Consumers (presentation layer, inspector, scope-aware diagnostics) callSelf::scope_coordinateswithout needing to walk the scope tree themselves. See the scope model design document (docs/design/scope_model.md).
Fields§
§constants_folded: usizeNumber of init-time constants folded during compilation.
Implementations§
Source§impl PolydatKernel
impl PolydatKernel
Sourcepub fn over(program: Arc<PolydatProgram>) -> Self
pub fn over(program: Arc<PolydatProgram>) -> Self
A fresh kernel over a shared, already compiled program: the host side of one program, many states.
Sourcepub fn traverse(&mut self, index: usize) -> Result<TraversalStream, String>
pub fn traverse(&mut self, index: usize) -> Result<TraversalStream, String>
Open the traversal at index among this program’s top-level
for statements, evaluated against this kernel’s current values.
Comprehension sources that reference this kernel’s wires see the values currently set on it. Cascade externs are snapshotted from this kernel now and bound into every activation.
Source§impl PolydatKernel
impl PolydatKernel
Sourcepub fn mark_inherited_outputs<I>(&mut self, names: I)where
I: IntoIterator<Item = String>,
pub fn mark_inherited_outputs<I>(&mut self, names: I)where
I: IntoIterator<Item = String>,
Mark a set of output names as inherited (cascade-only)
on the program. Must be called immediately after
construction, before the Arc<PolydatProgram> is shared.
Panics if the Arc has other references.
Sourcepub fn program(&self) -> &Arc<PolydatProgram> ⓘ
pub fn program(&self) -> &Arc<PolydatProgram> ⓘ
The shared immutable program.
Sourcepub fn commit_write_throughs(&mut self) -> Result<(), String>
pub fn commit_write_throughs(&mut self) -> Result<(), String>
Per-cycle commit (subcontext_construction.md §5). Pulls each write- through’s synthetic source output and stores its value through the corresponding cell-bound input slot for the declared export name. Reads of that name in the parent or in sibling kernels share the same cell and observe the write on the next read.
TYPE-STABLE (scope_model.md §6.1): a cell keeps
ONE type for life. Each pending value passes a typed
boundary —
matching types pass, a catalog adapter heals (e.g. the lossless
U64→F64 widening), and an UNHEALABLE mismatch (narrowing, kind
change) is an Err at THIS write site naming the cell, its
declared type, the incoming type, and the producing binding —
never a silent type flip that a compile-time-typed bridge trips
over tiers later. Explicit narrowing is the author’s job via
trunc_u64(...) / round_u64(...).
No-op when the kernel carries no write-throughs.
Sourcepub fn set_cursor_schemas(&mut self, schemas: Vec<SourceSchema>)
pub fn set_cursor_schemas(&mut self, schemas: Vec<SourceSchema>)
Set source schemas on the program (called by the compiler).
Sourcepub fn set_ast(&mut self, ast: Arc<PolydatFile>)
pub fn set_ast(&mut self, ast: Arc<PolydatFile>)
Attach the parsed AST as live program metadata. Called by every DSL compile entry point immediately after the assembler produces the kernel, while the program Arc is still uniquely owned. The subscope synthesizer queries this to integrate parent bindings’ matter into child scopes.
Sourcepub fn set_traversals(
&mut self,
traversals: Vec<Traversal>,
producers: Vec<Producer>,
)
pub fn set_traversals( &mut self, traversals: Vec<Traversal>, producers: Vec<Producer>, )
Attach compiled traversals and producers (for_traversal.md). Called by the DSL compiler while the program Arc is still uniquely owned.
Sourcepub fn state(&mut self) -> &mut PolydatState
pub fn state(&mut self) -> &mut PolydatState
The per-fiber mutable evaluation state.
Sourcepub fn state_ref(&self) -> &PolydatState
pub fn state_ref(&self) -> &PolydatState
Read-only access to the kernel’s evaluation state. Used by callers (e.g. the scope-init pass) that need to inspect pulled values without consuming the kernel.
Sourcepub fn set_inputs(&mut self, coords: &[u64])
pub fn set_inputs(&mut self, coords: &[u64])
Convenience: set coordinate inputs on the owned state.
Sourcepub fn set_input(&mut self, name: &str, value: Value) -> Result<(), WriteError>
pub fn set_input(&mut self, name: &str, value: Value) -> Result<(), WriteError>
Set an extern by name on the owned state. The compiled kernels offer the same call, so a host drives every engine alike.
Sourcepub fn set_input_at(
&mut self,
idx: usize,
value: Value,
) -> Result<(), WriteError>
pub fn set_input_at( &mut self, idx: usize, value: Value, ) -> Result<(), WriteError>
Self::set_input by input index, as find_input numbers them.
The one write rule of every engine: the value satisfies the
declared type or is None, and a coordinate is not written here.
Sourcepub fn set_cursor(
&mut self,
name: &str,
partition: &Partition,
) -> Result<(), WriteError>
pub fn set_cursor( &mut self, name: &str, partition: &Partition, ) -> Result<(), WriteError>
Narrow a cursor to one partition: its Ext slot and six scalar
projections are set, as cursor_partition::narrow_cursor does.
The compiled kernels offer the same call. The partitions a
cursor’s over clause denotes are in program().cursor_schemas()
when the compiler could resolve them, or from
cursor_partition::cursor_over_partitions otherwise.
Sourcepub fn get_input(&self, name: &str) -> Option<Value>
pub fn get_input(&self, name: &str) -> Option<Value>
Read an input value by name. Cell-aware: cell-bound slots return the cell’s current value.
Sourcepub fn pull_ref(&mut self, output_name: &str) -> &Value
pub fn pull_ref(&mut self, output_name: &str) -> &Value
Evaluate output_name’s cone and borrow the result, which is
the one thing this reader has over
Kernel::pull: no clone. The value lives
in the kernel’s own buffer, so the borrow ties to &mut self
and ends at the next write.
Named pull_ref and not pull deliberately. An inherent pull
here would shadow the trait’s, which returns an owned Value,
and the same expression would mean different things depending on
whether the caller held a PolydatKernel or a Box<dyn Kernel>
— silently, since both sides answer as_u64 and the rest.
Sourcepub fn pull_ref_at(&mut self, output_idx: usize) -> &Value
pub fn pull_ref_at(&mut self, output_idx: usize) -> &Value
Self::pull_ref by the output’s index rather than its name,
skipping the name resolution. Pair with
PolydatProgram::output_index resolved once at bind time so a
per-cycle reader pays no name hash on the hot path.
Sourcepub fn propagate_inputs_into(&self, child: &mut PolydatKernel)
pub fn propagate_inputs_into(&self, child: &mut PolydatKernel)
Copy self’s currently-set input-slot values into child’s
input slots by name.
Companion to the internal materialize_wiring_from_outer
pass that runs as part of build_subscope. That pass
walks the parent’s outputs; this method walks the parent’s
inputs — so cascade-extern’d names that the parent
inherited from its parent reach child too, rather than
stopping at the parent and silently leaving child’s
matching slot at its default.
Value::None inputs are skipped (no point overwriting a
child’s possibly-set default with absence). Inputs whose
name has no matching slot on child are skipped silently
— they’re not the child’s concern.
This is the kernel-chain operation that lets cascade-extern
propagate transitively across multi-level scope chains. Each
scope builder calls it after build_subscope finishes.
Sourcepub fn input_names(&self) -> Vec<String>
pub fn input_names(&self) -> Vec<String>
Return the names of the inputs.
Sourcepub fn output_names(&self) -> Vec<&str>
pub fn output_names(&self) -> Vec<&str>
Return the names of all available output variates.
Sourcepub fn get_constant(&self, name: &str) -> Option<&Value>
pub fn get_constant(&self, name: &str) -> Option<&Value>
Read the value of a named output that was folded to a constant.
Underlying primitive — prefer Self::lookup for
scope-aware name resolution. This method only succeeds for
constant-folded outputs whose buffer is populated; it
returns None for auto-passthrough outputs (where the
value lives in the input slot) and for cycle-dependent
outputs that haven’t been pulled.
A const captured at initialization answers from its slot, which
initialization writes, so its value is there before anything
pulls its output.
Sourcepub fn find_l2f_violations(&self) -> Vec<String>
pub fn find_l2f_violations(&self) -> Vec<String>
Find every const output whose initialization left the
buffer as Value::None. The L2.f sub-axiom in
composition_substrate.md describes this case: an
intermediate-layer const X := <expr> whose RHS yields
None falls through silently to the outer scope’s X via
the conditional-shadow semantics in none_semantics.md.
This method is the substrate’s “did silent fall-through
occur” query — strict-mode callers (per L2.f’s
strict-mode hardening note) use it to escalate the
silent fall-through to a hard error.
Returns the const-output names whose buffers are
Value::None after the scope-init pull. Empty Vec
means every const materialised to a defined value.
Polydat itself does not implement the strict-mode
policy — it provides this query and the caller decides
whether to surface a diagnostic.
Call only after materialize_wiring_from_outer has run
(i.e., after the kernel is fully constructed and
scope-init pulls have completed). Calling before
scope-init returns a misleading result.
Sourcepub fn lookup(&self, name: &str) -> Option<Value>
pub fn lookup(&self, name: &str) -> Option<Value>
Look up a name in this kernel’s scope.
The canonical scope-aware read (scope_model.md §5): own-scope folded outputs shadow inherited extern values, with auto-passthrough outputs falling through to the input slot transparently.
Resolution order:
- Folded output buffer (compile-time constants).
- Cell-aware input read (covers extern values bound via
materialize_wiring_from_outer, auto-passthrough outputs frominput ...: u64/extern, andshared-cell-backed slots — the cell is queried on every read so reads pick up writes from sibling kernels intrinsically).
Returns None when the name doesn’t resolve in either
tier or when the resolved value is Value::None (unset).
Returns Value (owned, not borrowed) because shared-cell
reads acquire a Mutex and clone out — there’s no
long-lived borrow into the cell. For non-shared slots
the clone is cheap (Value’s Clone is Arc-based for
vectors, primitive copy otherwise).
This is the single read API for scope-aware name lookup and is cell-aware by default — callers don’t need to know whether a name is shared or not.
Sourcepub fn cell_scope_snapshot(&self) -> PolydatKernel
pub fn cell_scope_snapshot(&self) -> PolydatKernel
Public form of Self::snapshot_with_cells: a fresh kernel
mirroring this one’s program and full shared-cell view (own
input-slot cells + transit cells, Arc-shared — the snapshot
reads/writes the SAME cells as self). For holding a scope’s
cell cascade past the point where the kernel itself is consumed
(e.g. an executor keeping a phase-activation scope view alive
for later build_subscope binds, after OpBuilder has taken
the activation kernel by value). Non-cell state is fresh — this
is a SCOPE view, not a value snapshot.
Sourcepub fn advance_broadcasts(&mut self)
pub fn advance_broadcasts(&mut self)
Advance this kernel’s broadcast
state: pull every output that has an attached
broadcast cell, forcing the eval cone to recompute
against current inputs and writing the fresh value
through the cell. Descendant kernels with input slots
cell-attached to these outputs then observe the
current value on their next read_input without any
per-fiber-write coordination.
Intended to run once per cycle on each per-fiber outer kernel whose outputs are visible to inner scopes. The alternative — validity-bit + auto-pull-on-stale-read — would put the trigger fully inside the Polydat engine (so inner reads transparently fetch fresh values), but requires the engine to track upstream dependencies across the cell boundary. This eager-broadcast form is simpler and lives entirely within the kernel’s own surface: callers ask the kernel to advance its broadcasts; the kernel does the pulls; cells receive the values.
Sourcepub fn replace_transit_cells(&mut self, cells: Vec<SharedCellEntry>)
pub fn replace_transit_cells(&mut self, cells: Vec<SharedCellEntry>)
Carry cells forward for this kernel’s descendants, replacing
what it carried. The binder writes what the parent had and this
kernel holds no slot for; the compiled engines keep the same
list in their extern table.
Every shared cell visible at this kernel’s scope —
own input slots’ attached cells unioned with the
transit cells inherited from ancestors. The typed
ScopeKernel::shared_cells_in_scope delegates here.
Used by materialize_wiring_from_outer to compute the parent’s
full visible cell set and propagate it to the child.
Public for the typed surface; semantics are the same
as the typed accessor.
Sourcepub fn for_iteration(
canonical: &Arc<PolydatKernel>,
parent: &Arc<PolydatKernel>,
bindings: &[(String, Value)],
) -> Arc<PolydatKernel> ⓘ
pub fn for_iteration( canonical: &Arc<PolydatKernel>, parent: &Arc<PolydatKernel>, bindings: &[(String, Value)], ) -> Arc<PolydatKernel> ⓘ
Construct a per-iteration kernel: clone canonical’s
program, bind it to parent’s scope, and pre-load every
(var, value) binding into the corresponding input slot.
§Cache-and-rehydrate pattern
for_iteration is the public entry point for the
cache-and-rehydrate pattern a host builds on:
compile a scope’s program once, then hydrate many
per-instance kernels from it — one per iteration tuple,
per fiber, per scenario-tree visit. The program is
immutable substance (the Arc<PolydatProgram>); each
hydrated kernel carries its own state (the input slot
values for this iteration).
The pattern’s three load-bearing properties:
- Compile cost amortizes. Polydat source → typed program
is paid once per canonical scope, not per iteration
or per fiber. The compiled
Arc<PolydatProgram>is shared via clone (cheap — refcount bump). - Each hydrated kernel is independent. Per-fiber
state means no synchronization between fibers running
the same iteration in parallel. Each
for_iterationcall produces a fresh kernel with its own input slots, output cells, and write-through bindings. - Parent-chain wiring is uniform. Every hydrated
kernel runs through the parent’s
materialize_subscope(and downstreammaterialize_wiring_from_outer) so cell propagation, shared-cell attach, and the read invariant (wire_materialization.md) are byte-identical to any other parent → child path.
§When to use this
- Per-iteration kernel construction in scope
walkers and pre-map walkers. The runtime dispatcher
uses it before descending into a comprehension
iteration’s children; the pre-map walker uses it so
nested
for_eachclauses with outer-iter-var interpolation (vec_{profile}) resolve at pre-map time.
§Why one entry point
Owning the recipe here ensures both consumers (runtime
dispatcher + pre-map walker) produce identical kernels
for identical inputs, rather than each site composing
from_program → materialize_wiring_from_outer →
set_input on its own and drifting.
§See also
Self::from_program(internal) — the build-fresh-state primitivefor_iterationcomposes with parent-chain wiring.Self::propagate_inputs_into— the kernel-chain operation that extends cascade-extern values into a subkernel (called once afterfor_iterationfrom each scope walker so multi-level cascades reach the grandchild).
Sourcepub fn scope_coordinates(&self) -> &[ScopeCoord]
pub fn scope_coordinates(&self) -> &[ScopeCoord]
The leaf-first scope coordinate path — see the
scope model design document (docs/design/scope_model.md) for the formal
definition. Always reflects the current binding state:
after Self::materialize_wiring_from_outer the path includes the
outer kernel’s full chain; for root scopes the path is
just this kernel’s own coords (or empty).
Sourcepub fn extend_scope_coordinates(&mut self, outer: &[ScopeCoord])
pub fn extend_scope_coordinates(&mut self, outer: &[ScopeCoord])
Refresh this kernel’s own coordinates and append outer’s
path, giving [own] ++ outer. What the binder does once the
child’s inputs are in, so the own-coord snapshot sees them.
Sourcepub fn scope_values(&self) -> Vec<(String, Value)>
pub fn scope_values(&self) -> Vec<(String, Value)>
Extract the scope values that were set via materialize_wiring_from_outer.
Returns [(name, value)] for inputs that are not at their
default. Used by OpBuilder to inject the same values into
every fiber’s state, including per-op-template kernels
whose input layout differs from this kernel’s. The name-
keyed shape is the cross-kernel-safe contract: an index
captured against this kernel’s layout is meaningless when
applied to a kernel synthesised from a different source
(different extern declaration order, lazy-cascade omissions,
etc.). Naming the binding makes the cross-scope write
unambiguous — a missing name on the target program is a
no-op rather than a silently mis-routed write.
A const’s slot is left out: only initialization writes it, and each kernel the values are written into initializes its own consts from them.
Sourcepub fn into_program(self) -> Arc<PolydatProgram> ⓘ
pub fn into_program(self) -> Arc<PolydatProgram> ⓘ
Extract the program for concurrent use.
Source§impl PolydatKernel
impl PolydatKernel
Sourcepub fn build_subscope(
&self,
matter: PolydatMatter<'_>,
) -> Result<Box<dyn Kernel>, ContractViolation>
pub fn build_subscope( &self, matter: PolydatMatter<'_>, ) -> Result<Box<dyn Kernel>, ContractViolation>
PolydatMatter::build_under this kernel: the child runs on
the interpreter, this kernel’s engine.
Trait Implementations§
Source§impl Construction for PolydatKernel
impl Construction for PolydatKernel
Source§type Error = ContractViolation
type Error = ContractViolation
Source§fn root(matter: PolydatMatter<'_>) -> Result<Self, Self::Error>
fn root(matter: PolydatMatter<'_>) -> Result<Self, Self::Error>
Source§fn subscope(
&self,
matter: PolydatMatter<'_>,
) -> Result<Box<dyn Kernel>, Self::Error>
fn subscope( &self, matter: PolydatMatter<'_>, ) -> Result<Box<dyn Kernel>, Self::Error>
self from
Polydat matter. The parent supervises: cell cascade, Rule 2
rewrites, scope-coordinate threading, init-binding
contract checks all flow from self into the child, which
runs on self’s engine
(super::subcontext::PolydatMatter::build_under).Source§impl Dataflow for PolydatKernel
impl Dataflow for PolydatKernel
Source§fn get_wire_idx(&self, idx: usize) -> Value
fn get_wire_idx(&self, idx: usize) -> Value
idx. Out-of-range
behaviour returns the slot’s default Value::None (the
read path is non-fallible; type information is structural
and reads cannot fail typewise).Source§impl Debug for PolydatKernel
impl Debug for PolydatKernel
Source§impl Kernel for PolydatKernel
impl Kernel for PolydatKernel
Source§fn eval(&mut self)
fn eval(&mut self)
Every output is pulled, so what a side channel observes is what it observes on a compiled kernel’s run.
Source§fn set_inputs(&mut self, coords: &[u64])
fn set_inputs(&mut self, coords: &[u64])
Source§fn set_input(&mut self, name: &str, value: Value) -> Result<(), WriteError>
fn set_input(&mut self, name: &str, value: Value) -> Result<(), WriteError>
None, which clears the extern; a value of
another type is refused at the write, never healed. A coordinate
is set with Self::set_inputs, not here. An unknown name is
an error naming the known ones.Source§fn set_cursor(
&mut self,
name: &str,
partition: &Partition,
) -> Result<(), WriteError>
fn set_cursor( &mut self, name: &str, partition: &Partition, ) -> Result<(), WriteError>
Ext slot and its six
scalar projections are set.Source§fn pull(&mut self, name: &str) -> Value
fn pull(&mut self, name: &str) -> Value
None reads as None.Source§fn input_names(&self) -> Vec<String>
fn input_names(&self) -> Vec<String>
Source§fn output_names(&self) -> Vec<String>
fn output_names(&self) -> Vec<String>
Source§fn output_type(&self, name: &str) -> Option<PortType>
fn output_type(&self, name: &str) -> Option<PortType>
Source§fn cursor_schemas(&self) -> &[SourceSchema]
fn cursor_schemas(&self) -> &[SourceSchema]
Source§fn input_value(&self, name: &str) -> Option<Value>
fn input_value(&self, name: &str) -> Option<Value>
None for a name that is not an input.Source§fn input_index(&self, name: &str) -> Option<usize>
fn input_index(&self, name: &str) -> Option<usize>
Self::input_names, the
coordinates first: what Self::set_input_at takes.Source§fn set_input_at(&mut self, index: usize, value: Value) -> Result<(), WriteError>
fn set_input_at(&mut self, index: usize, value: Value) -> Result<(), WriteError>
Self::set_input by index, for a host that binds the same
inputs every cycle: the name is resolved once, with
Self::input_index, and no lookup runs per write.Source§fn output_index(&self, name: &str) -> Option<usize>
fn output_index(&self, name: &str) -> Option<usize>
Self::output_names: what
Self::pull_at takes.Source§fn const_inits(&self) -> &[ConstInit]
fn const_inits(&self) -> &[ConstInit]
const bindings this kernel initializes, in the order
Self::init evaluates them: a const that reads another comes
after it.Source§fn init_input_at(
&mut self,
index: usize,
value: Value,
) -> Result<(), WriteError>
fn init_input_at( &mut self, index: usize, value: Value, ) -> Result<(), WriteError>
Self::set_input_at except that a const’s slot is accepted,
which is how Self::init stores each const’s value.Source§fn pull_at(&mut self, index: usize) -> Value
fn pull_at(&mut self, index: usize) -> Value
Self::pull by index, for a host that reads the same outputs
every cycle: the name is resolved once, with
Self::output_index, and no lookup runs per pull.Source§fn traversals(&self) -> &[Traversal]
fn traversals(&self) -> &[Traversal]
Source§fn plan(&self) -> EnginePlan
fn plan(&self) -> EnginePlan
Source§fn traverse(&mut self, index: usize) -> Result<TraversalStream, String>
fn traverse(&mut self, index: usize) -> Result<TraversalStream, String>
index against this kernel’s current
values (for_traversal.md §3.6): the comprehension’s sources see
the wires they reference as this kernel holds them now, and the
cascaded wires are snapshotted into every activation. Every
engine opens traversals (engines.md §3.6).Source§fn invalidate_all(&mut self)
fn invalidate_all(&mut self)
polydat binary does when
every input is fixed.shared bindings are bound to (scope
model §6): one register per binding, which every kernel holding
the cell reads and writes.Source§fn output_cell(&self, name: &str) -> Option<SharedCell>
fn output_cell(&self, name: &str) -> Option<SharedCell>
Source§fn output_modifier(&self, name: &str) -> BindingModifier
fn output_modifier(&self, name: &str) -> BindingModifier
const,
shared, final, or none. A binder reads it to decide how a
descendant takes the output: a const is effectively fixed for
the scope’s life and is value-copied, where a computed output is
bound to its broadcast cell (scope_model.md §4). Read moreSource§fn cells_in_scope(&self) -> Vec<SharedCellEntry>
fn cells_in_scope(&self) -> Vec<SharedCellEntry>
shared slots hold, plus the ones it carries forward
for a descendant without holding a slot for them itself. The
second kind is why an ancestral shared reaches a grandchild
whose parent’s program never names it. Read moreSource§fn set_transit_cells(&mut self, cells: Vec<SharedCellEntry>)
fn set_transit_cells(&mut self, cells: Vec<SharedCellEntry>)
cells forward for this kernel’s descendants. The binder
writes what the parent had and this kernel holds no slot for.Source§fn scope_coordinates(&self) -> &[ScopeCoord]
fn scope_coordinates(&self) -> &[ScopeCoord]
Source§fn extend_scope_coordinates(&mut self, outer: &[ScopeCoord])
fn extend_scope_coordinates(&mut self, outer: &[ScopeCoord])
outer to this kernel’s own scope-coordinate path, which
the binder does once the child’s inputs are in. A no-op on an
engine that keeps no path.Source§fn input_port_type(&self, name: &str) -> Option<PortType>
fn input_port_type(&self, name: &str) -> Option<PortType>
Source§fn bind_input_cell(&mut self, name: &str, cell: SharedCell) -> bool
fn bind_input_cell(&mut self, name: &str, cell: SharedCell) -> bool
cell, whether or not the slot was
built as a shared register, and answer whether it was bound. Read moreshared binding name to cell, so this kernel and
every other holder of the cell read and write one register:
a write on any of them is what the others read next, and a
dependent output is recomputed. A name that is not a shared
binding is an error naming the ones that are.Source§fn into_program(self: Box<Self>) -> Arc<dyn KernelProgram> ⓘ
fn into_program(self: Box<Self>) -> Arc<dyn KernelProgram> ⓘ
KernelProgram::create_kernel. Read moreSource§fn ledger(&self) -> &Arc<CompileLedger> ⓘ
fn ledger(&self) -> &Arc<CompileLedger> ⓘ
Source§fn resources(&self) -> &ResourceScope
fn resources(&self) -> &ResourceScope
ResourceAccessor
that every node of the tree looks resources up through. A host
that did not hand one to the compile
(CompileOptions::resources) installs its accessor here, once;
kernels created from or forked off this one, subscopes built
under it, and its traversal bodies share the scope.Source§fn canonical_hash(&self) -> [u8; 32]
fn canonical_hash(&self) -> [u8; 32]
Source§fn coord_count(&self) -> usize
fn coord_count(&self) -> usize
input_names, and set_inputs writes them.Source§fn input_value_at(&self, index: usize) -> Option<Value>
fn input_value_at(&self, index: usize) -> Option<Value>
index holds now: a coordinate’s pending or
current value, an extern’s current value. None past the end.Source§fn input_default_at(&self, index: usize) -> Option<Value>
fn input_default_at(&self, index: usize) -> Option<Value>
index starts with: an extern’s declared
default, U64(0) for a coordinate. None past the end.Source§fn input_is_cell_bound(&self, index: usize) -> bool
fn input_is_cell_bound(&self, index: usize) -> bool
index is bound to a shared cell, so that its
value is the cell’s and a reset leaves it alone.Source§fn reset_inputs(&mut self)
fn reset_inputs(&mut self)
Source§fn fork(&self) -> Box<dyn Kernel>
fn fork(&self) -> Box<dyn Kernel>
Source§fn publish_broadcasts(&mut self)
fn publish_broadcasts(&mut self)
Source§fn commit_write_throughs(&mut self) -> Result<(), String>
fn commit_write_throughs(&mut self) -> Result<(), String>
__write_<name> output and write it through the cell of the
shared binding it exports to. No-op for a kernel without them.Source§fn program_id(&self) -> ProgramId
fn program_id(&self) -> ProgramId
Source§fn input_type_origin(&self, name: &str) -> Option<TypeOrigin>
fn input_type_origin(&self, name: &str) -> Option<TypeOrigin>
name’s type was established: written by the author,
or inferred by the compiler and so open to
CompileOptions::input_variance (input_variance.md §3). A host
that compiles many scopes at Info reports each open input once
from here rather than from every compile’s log.Source§fn as_interpreter(&self) -> Option<&PolydatKernel>
fn as_interpreter(&self) -> Option<&PolydatKernel>
Source§fn as_interpreter_mut(&mut self) -> Option<&mut PolydatKernel>
fn as_interpreter_mut(&mut self) -> Option<&mut PolydatKernel>
Self::as_interpreter, mutably.Source§fn init(&mut self) -> Result<(), KernelError>
fn init(&mut self) -> Result<(), KernelError>
const binding once, in
dependency order, and store its value for the rest of the
kernel’s life. Read moreSource§fn traverse_all(&mut self) -> Result<Vec<TraversalStream>, String>
fn traverse_all(&mut self) -> Result<Vec<TraversalStream>, String>
Source§fn instance_hash(&self, ancestors: &[&dyn Kernel]) -> [u8; 32]
fn instance_hash(&self, ancestors: &[&dyn Kernel]) -> [u8; 32]
ancestors,
innermost first (scope_model.md §8.2): what
PolydatProgram::instance_hash
gives for the same programs, whichever engines the kernels are on.Source§fn is_equivalent_to(&self, other: &dyn Kernel) -> bool
fn is_equivalent_to(&self, other: &dyn Kernel) -> bool
other runs the same program (scope_model.md §8.3): their
canonical hashes are equal, whichever engines the two are on.Source§fn is_subset_of(&self, parent: &dyn Kernel) -> bool
fn is_subset_of(&self, parent: &dyn Kernel) -> bool
parent’s does not
already supply (scope_model.md §8.3): it is equivalent to
parent, or it outputs nothing but its own inputs and every
input it declares parent declares too. The answer
PolydatProgram::is_subset_of
gives for the same programs, on any engines.Source§impl Lookup for PolydatKernel
impl Lookup for PolydatKernel
Source§impl Metadata for PolydatKernel
impl Metadata for PolydatKernel
Source§fn find_input(&self, name: &str) -> Option<usize>
fn find_input(&self, name: &str) -> Option<usize>
Source§fn input_names(&self) -> Vec<String>
fn input_names(&self) -> Vec<String>
Source§fn output_names(&self) -> Vec<String>
fn output_names(&self) -> Vec<String>
Source§fn coord_count(&self) -> usize
fn coord_count(&self) -> usize
Source§fn input_port_type(&self, name: &str) -> Option<PortType>
fn input_port_type(&self, name: &str) -> Option<PortType>
Source§fn input_port_type_by_idx(&self, idx: usize) -> Option<PortType>
fn input_port_type_by_idx(&self, idx: usize) -> Option<PortType>
input_port_type,
which looks up the slot’s type without first reverse-resolving
an index to a name.Source§fn output_port_type(&self, name: &str) -> Option<PortType>
fn output_port_type(&self, name: &str) -> Option<PortType>
input_port_type. Used by
the binder verification path
(crate::binder::verify_against_kernel) to look up wire
types for type-checking adapter binding shapes.Auto Trait Implementations§
impl !Freeze for PolydatKernel
impl !RefUnwindSafe for PolydatKernel
impl !UnwindSafe for PolydatKernel
impl Send for PolydatKernel
impl Sync for PolydatKernel
impl Unpin for PolydatKernel
impl UnsafeUnpin for PolydatKernel
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