Skip to main content

Kernels

Struct Kernels 

Source
pub struct Kernels {
    pub init: fn(coeffs: &[u8]) -> Vec<u8>,
    pub table_bytes: usize,
    pub encode: EncodeFn,
    pub mad: fn(tbl: &[u8], src: &[u8], dest: &mut [u8]),
    pub update: UpdateFn,
    pub name: &'static str,
    pub census: &'static AtomicU64,
}
Expand description

A pluggable kernel set. The choice is made ONCE, at coder construction or the facade surface (never inside a loop — the dispatch-placement law), and core stays free of all detection machinery: this crate only ever provides Kernels::scalar; SIMD sets come from rusty_erasure-accel via the facade.

Contract for implementations: the CALLER has validated everything — data slices all equal length, out slices all equal that length, gftbls.len() == out.len() * data.len() * 32. Implementations must be exact (byte-identical to the scalar set) and must add the source bytes they process to their census counter.

Fields§

§init: fn(coeffs: &[u8]) -> Vec<u8>

Expand a row-major coefficient block into THIS set’s table format. Table formats are kernel-private (nibble 32 B/coeff for the scalar/PSHUFB sets, affine 8 B/coeff for GFNI): tables built by one set’s init are meaningful only to that set’s encode/mad — mixing formats produces wrong parity at plausible speed (learned from ISA-L’s own dispatched-init-vs-avx2-encode mismatch, LEDGER M4).

§table_bytes: usize

Bytes per expanded coefficient in this set’s format.

§encode: EncodeFn

Full encode: out[l] = XOR_j (c[l][j] · data[j]) for every output row, gftbls row-major from this set’s init.

§mad: fn(tbl: &[u8], src: &[u8], dest: &mut [u8])

dest ^= c · src for one expanded table (table_bytes long, from this set’s init).

§update: UpdateFn

Fused incremental update: fold source vec_i into EVERY output row in one pass over the source (outs[l] ^= c[l][vec_i] · src), tables for row l at (l*k + vec_i) * table_bytes in gftbls. One source read instead of outs.len() — the brick that fixed S7’s shape.

§name: &'static str

Kernel-set name, for reporting.

§census: &'static AtomicU64

The census counter this set accumulates into.

Implementations§

Source§

impl Kernels

Source

pub const fn scalar() -> Self

The scalar set — the permanent oracle and the fallback on every CPU.

Trait Implementations§

Source§

impl Clone for Kernels

Source§

fn clone(&self) -> Kernels

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Kernels

Source§

impl Debug for Kernels

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, <T as TryFrom<U>>::Error>

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.