pub struct HybridKernelPushPull { /* private fields */ }Expand description
Hybrid kernel with both push-side per-step skip and pull-side cone guard.
Push side: set_inputs() marks only steps that depend on changed inputs
as dirty; clean steps are skipped during eval().
Pull side: eval_for_slot() first checks whether the output’s cone of
influence changed at all. If not, the cached value is returned without
entering the eval loop.
Implementations§
Source§impl HybridKernelPushPull
impl HybridKernelPushPull
Sourcepub fn coord_count(&self) -> usize
pub fn coord_count(&self) -> usize
How many inputs are coordinates. (The core’s coord_count
field counts the buffer slots all inputs occupy.)
Sourcepub fn resolve_output(&self, name: &str) -> Option<usize>
pub fn resolve_output(&self, name: &str) -> Option<usize>
The slot of a named output.
Sourcepub fn get_slot(&self, slot: usize) -> u64
pub fn get_slot(&self, slot: usize) -> u64
Read an output by pre-resolved slot index. Panics on
Ref2-colored slots (axiom S2) — use read_vec_*.
Sourcepub fn get(&self, name: &str) -> u64
pub fn get(&self, name: &str) -> u64
Read a named output variate after eval(). Panics on
Ref2-colored outputs (axiom S2) — use read_vec_*.
Sourcepub fn get_value(&self, name: &str) -> Value
pub fn get_value(&self, name: &str) -> Value
The named output as a typed Value, decoded by its port
type: a Ref2 output is copied out through its pair
(compiled_handles.md §4), so the caller never holds a
pointer; a slot that holds None reads as None.
Sourcepub fn pull_output(&mut self, name: &str) -> Value
pub fn pull_output(&mut self, name: &str) -> Value
A named output, its cone run if a write is pending.
Sourcepub fn cursor_schemas(&self) -> &[SourceSchema]
pub fn cursor_schemas(&self) -> &[SourceSchema]
The cursors the program declares, with the partitions the
compiler resolved where its over clause and extent were
constant, as PolydatProgram::cursor_schemas reports them.
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, as narrow_cursor does on
the interpreter: its Ext slot and six scalar projections
are set as externs.
Sourcepub fn read_vec_f32(&self, slot: usize) -> &[f32]
pub fn read_vec_f32(&self, slot: usize) -> &[f32]
Borrow a vec_f32 output’s current contents.
Sourcepub fn read_vec_f64(&self, slot: usize) -> &[f64]
pub fn read_vec_f64(&self, slot: usize) -> &[f64]
Borrow a vec_f64 output’s current contents.
Sourcepub fn read_vec_f16(&self, slot: usize) -> &[f16]
pub fn read_vec_f16(&self, slot: usize) -> &[f16]
Borrow a vec_f16 output’s current contents.
Sourcepub fn read_vec_i8(&self, slot: usize) -> &[i8]
pub fn read_vec_i8(&self, slot: usize) -> &[i8]
Borrow a vec_i8 output’s current contents.
Sourcepub fn read_vec_i16(&self, slot: usize) -> &[i16]
pub fn read_vec_i16(&self, slot: usize) -> &[i16]
Borrow a vec_i16 output’s current contents.
Sourcepub fn read_vec_i32(&self, slot: usize) -> &[i32]
pub fn read_vec_i32(&self, slot: usize) -> &[i32]
Borrow a vec_i32 output’s current contents.
Sourcepub fn read_vec_i64(&self, slot: usize) -> &[i64]
pub fn read_vec_i64(&self, slot: usize) -> &[i64]
Borrow a vec_i64 output’s current contents.
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, as PolydatState::set_input does on the
interpreter. Every kind is written through at once. Every step
downstream of the extern reruns, and the next evaluation runs
whatever the cone guard says.
Sourcepub fn set_input_at(
&mut self,
index: usize,
value: Value,
) -> Result<(), WriteError>
pub fn set_input_at( &mut self, index: usize, value: Value, ) -> Result<(), WriteError>
Self::set_input by input index.
Sourcepub fn eval(&mut self, coords: &[u64])
pub fn eval(&mut self, coords: &[u64])
Evaluate with push-side step skip (no cone guard): a new round.
Sourcepub fn eval_for_slot(&mut self, coords: &[u64], slot: usize) -> u64
pub fn eval_for_slot(&mut self, coords: &[u64], slot: usize) -> u64
Cone guard + push-side skip: the full optimization.
Sourcepub fn engine_counts(&self) -> (usize, usize)
pub fn engine_counts(&self) -> (usize, usize)
The number of native segments and of closure steps in this kernel, in that order: what the per-node engine choice decided.
Sourcepub fn retain_nodes(&mut self, nodes: Vec<Box<dyn PolydatNode>>)
pub fn retain_nodes(&mut self, nodes: Vec<Box<dyn PolydatNode>>)
Store owned nodes to keep JIT-baked pointers valid.
Trait Implementations§
Source§impl Clone for HybridKernelPushPull
impl Clone for HybridKernelPushPull
Source§impl Kernel for HybridKernelPushPull
impl Kernel for HybridKernelPushPull
Source§fn output_names(&self) -> Vec<String>
fn output_names(&self) -> Vec<String>
In declaration order, as the interpreter lists them: the assembler sets them on every compiled kernel.
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 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 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_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 traversals(&self) -> &[Traversal]
fn traversals(&self) -> &[Traversal]
Source§fn plan(&self) -> EnginePlan
fn plan(&self) -> EnginePlan
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 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 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 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 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 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 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§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§impl SlotKernel for HybridKernelPushPull
impl SlotKernel for HybridKernelPushPull
Source§fn resolve_output(&self, name: &str) -> Option<usize>
fn resolve_output(&self, name: &str) -> Option<usize>
Source§fn get_slot(&self, slot: usize) -> u64
fn get_slot(&self, slot: usize) -> u64
u64 in slot, as it stands: no evaluation, no
decoding. Panics on a Ref2 slot (axiom S2), which has no
scalar to read — use the read_vec_* borrows.Source§fn get_value(&self, name: &str) -> Value
fn get_value(&self, name: &str) -> Value
Ref2 output copied
out through its pair so the caller never holds a pointer. Reads
what is there; Kernel::pull
evaluates first.Source§fn eval_for_slot(&mut self, coords: &[u64], slot: usize) -> u64
fn eval_for_slot(&mut self, coords: &[u64], slot: usize) -> u64
slot needs, and return its
raw u64. The whole read in one call and one u64, which is
what a tier benchmark wants: pull_at gives the same value
through a Value it has to construct.Source§fn eval_at(&mut self, coords: &[u64])
fn eval_at(&mut self, coords: &[u64])
Kernel::eval is the
same evaluation over coordinates already written with
set_inputs; this is the form that takes them, which is what a
loop over a coordinate range wants.Source§fn read_vec_f32(&self, slot: usize) -> &[f32]
fn read_vec_f32(&self, slot: usize) -> &[f32]
vec_f32 output’s current contents. The borrow ties to
&self, so holding one across the next evaluation is a compile
error rather than a stale read (axiom S2).Source§fn read_vec_f64(&self, slot: usize) -> &[f64]
fn read_vec_f64(&self, slot: usize) -> &[f64]
vec_f64 output’s current contents.Source§fn read_vec_f16(&self, slot: usize) -> &[f16]
fn read_vec_f16(&self, slot: usize) -> &[f16]
vec_f16 output’s current contents.Source§fn read_vec_i8(&self, slot: usize) -> &[i8]
fn read_vec_i8(&self, slot: usize) -> &[i8]
vec_i8 output’s current contents.Source§fn read_vec_i16(&self, slot: usize) -> &[i16]
fn read_vec_i16(&self, slot: usize) -> &[i16]
vec_i16 output’s current contents.Source§fn read_vec_i32(&self, slot: usize) -> &[i32]
fn read_vec_i32(&self, slot: usize) -> &[i32]
vec_i32 output’s current contents.Source§fn read_vec_i64(&self, slot: usize) -> &[i64]
fn read_vec_i64(&self, slot: usize) -> &[i64]
vec_i64 output’s current contents.Auto Trait Implementations§
impl !Freeze for HybridKernelPushPull
impl !RefUnwindSafe for HybridKernelPushPull
impl !UnwindSafe for HybridKernelPushPull
impl Send for HybridKernelPushPull
impl Sync for HybridKernelPushPull
impl Unpin for HybridKernelPushPull
impl UnsafeUnpin for HybridKernelPushPull
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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