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: usizeBytes per expanded coefficient in this set’s format.
encode: EncodeFnFull 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: UpdateFnFused 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 strKernel-set name, for reporting.
census: &'static AtomicU64The census counter this set accumulates into.