Skip to main content

SlotKernel

Trait SlotKernel 

Source
pub trait SlotKernel: Kernel {
Show 13 methods // Required methods fn resolve_output(&self, name: &str) -> Option<usize>; fn get_slot(&self, slot: usize) -> u64; fn get(&self, name: &str) -> u64; fn get_value(&self, name: &str) -> Value; fn eval_for_slot(&mut self, coords: &[u64], slot: usize) -> u64; fn eval_at(&mut self, coords: &[u64]); fn read_vec_f32(&self, slot: usize) -> &[f32]; fn read_vec_f64(&self, slot: usize) -> &[f64]; fn read_vec_f16(&self, slot: usize) -> &[f16]; fn read_vec_i8(&self, slot: usize) -> &[i8]; fn read_vec_i16(&self, slot: usize) -> &[i16]; fn read_vec_i32(&self, slot: usize) -> &[i32]; fn read_vec_i64(&self, slot: usize) -> &[i64];
}
Expand description

The slot surface of a compiled kernel: the extended API, over and above the Kernel trait every engine answers.

Every compiled engine lays its program out over one flat u64 slot buffer (engines.md §6). That layout is an implementation detail, and this trait is where it is admitted: a slot index instead of an output name, a raw u64 instead of a Value, a borrow into the scratch a by-reference output writes. The interpreter does not implement it and cannot — its buffers are typed Values and it has no slot to name — which is the point: the shape of this trait is the thing the compiled tiers share and the interpreter does not.

This is not the surface for running a program. Driving a kernel is Kernel, on every engine, and a host that never names an engine never sees this trait. Reach for it when the implementation detail is the subject: a differential test asserting on what was laid out, a benchmark measuring a tier without the Value construction and the name lookup a pull pays, a diagnostic reporting on a slot.

It is a subtrait rather than a wider Kernel, so it is opt-in at the import: a caller who does not write use SlotKernel does not have these methods on their kernel at all. And it is reachable without naming a kernel type, through PolydatAssembler::compile_slots, which hands back a Box<dyn SlotKernel> that upcasts to Box<dyn Kernel> wherever the ordinary surface will do.

Required Methods§

Source

fn resolve_output(&self, name: &str) -> Option<usize>

The buffer slot a named output writes, resolved once so a caller reading the same output every cycle pays no lookup.

Source

fn get_slot(&self, slot: usize) -> u64

The raw 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(&self, name: &str) -> u64

Self::get_slot by output name.

Source

fn get_value(&self, name: &str) -> Value

A named output decoded by its port type, a 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

Set the coordinates, evaluate what 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])

Set the coordinates and run every step, the whole program in one call. 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]

Borrow a 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]

Borrow a vec_f64 output’s current contents.

Source

fn read_vec_f16(&self, slot: usize) -> &[f16]

Borrow a vec_f16 output’s current contents.

Source

fn read_vec_i8(&self, slot: usize) -> &[i8]

Borrow a vec_i8 output’s current contents.

Source

fn read_vec_i16(&self, slot: usize) -> &[i16]

Borrow a vec_i16 output’s current contents.

Source

fn read_vec_i32(&self, slot: usize) -> &[i32]

Borrow a vec_i32 output’s current contents.

Source

fn read_vec_i64(&self, slot: usize) -> &[i64]

Borrow a vec_i64 output’s current contents.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§