Skip to main content

verify_kernel_channels

Function verify_kernel_channels 

Source
pub fn verify_kernel_channels<const K: usize>(
    tower: &Tower4<K>,
    claims: &KernelChannels<K>,
    rel_tol: f64,
) -> Result<(), String>
Expand description

Channel-by-channel audit of a hand-written kernel against the single-expression tower truth. Returns Err naming the first channel, index, claimed and true values on disagreement — designed as the body of the per-family CI oracle tests (#932 deployment step 2).

Tolerance is PER ENTRY, mixed absolute/relative: each comparison uses |claim − truth| ≤ atol + rel_tol · max(|claim|, |truth|). The absolute floor atol = rel_tol lets exact-zero entries of structurally sparse towers pass without demanding bit-equality, while a tiny cross-block entry dropped next to a huge one is still caught (it is NOT measured against the largest entry of the whole channel — there is no per-channel magnitude floor). Genuine sign flips (#736) and dropped channels are loud.

Non-finite handling is strict: a NaN on either side always fails; an infinity passes only when both sides are the SAME signed infinity.