Skip to main content

Crate rusty_erasure_accel

Crate rusty_erasure_accel 

Source
Expand description

rusty_erasure-accel — the workspace’s ONLY unsafe crate: hand-written SIMD twins of the scalar kernels in rusty_erasure-core.

The named reason these exist (codec-vectorize-kernel step 0): the GF(2^8) multiply here is either the PSHUFB/TBL/swizzle nibble-table algorithm or a GF2P8AFFINEQB affine transform — different algorithms from the scalar per-byte lookup, in the polynomial/table class the compiler cannot derive. Auto-vectorization is structurally unavailable; hand-written kernels are the only route.

Per-arch inventory (the per-arch-parity non-negotiable):

  • x86 — SSSE3/AVX2 nibble + AVX2-GFNI affine (runtime-dispatched)
  • aarch64 — NEON TBL nibble (baseline, no dispatch needed)
  • wasm — SIMD128 swizzle nibble (compile-time +simd128)

Discipline: every kernel set is exposed only through checked constructors; every unsafe block carries a // SAFETY: invariant and the safe wrappers re-assert slice lengths; the scalar set in core stays the permanent oracle (*_matches_scalar gates every set); every set counts its source bytes into ACCEL_CENSUS_BYTES — the reach census is always on.

Modules§

aarch64
aarch64 NEON kernels: the PSHUFB nibble technique via vqtbl1q_u8 (TBL), 16 bytes per step, 4-row fused encode — the per-arch mirror the codec-vectorize-kernel non-negotiable demands.
wasm
wasm32 SIMD128 kernels: the nibble technique via u8x16_swizzle — PSHUFB’s twin (out-of-range lane indices select zero; ours are always 0..=15). 16 bytes per step, 4-row fused encode.
x86
x86-64 kernels: PSHUFB nibble-table GF(2^8) multiply, SSSE3 (16 B/step) and AVX2 (32 B/step), with up-to-4-row fusion on encode (one walk of the source data feeds four parity accumulators — ISA-L’s cache-bandwidth play).

Statics§

ACCEL_CENSUS_BYTES
Census counter shared by every accel kernel set: source bytes processed. One relaxed add per call, never per element.

Functions§

kernels
The best kernel set for the running CPU on THIS architecture, or None when no SIMD set applies — callers fall back to Kernels::scalar().
kernels_nibble
The best kernel set consuming ISA-L NIBBLE-format tables (the compat layer’s requirement — its callers hand it ec_init_tables-format tables by contract, and GFNI’s affine tables must never be mixed in).
raid_kernels
The best RAID kernel pair (xor_gen, pq_gen) for this architecture, or None when only the scalar core applies. Byte-identical to rusty_erasure_core::raid on every arch (oracle-tested).

Type Aliases§

RaidKernels
The (xor_gen, pq_gen) function pair a RAID dispatch returns.