Expand description
memra-validate — shared validation-protocol core (Phase D extraction, ARCHITECTURE-H100.md §5).
Pure host logic, zero engine/CUDA dependency: the pieces every gate bin and bench duplicated (kernel_check, gdn_bench, fa_sanitize, dtype_gpu_check5, the N=5 bench protocol). CPU kernel references stay with their kernels; THIS crate owns the protocol: deterministic test vectors, error measures, tolerance banding, N-rep medians, and the ALL-GREEN tally contract.
Extraction law: moved code is verbatim (bit-identical vectors and measures) — the
pr generator here is the kernel_check/dtype_gpu_check5 variant; fa_sanitize’s
16-bit variant intentionally stays local to it (different distribution = different
test vectors = a silent gate change).
Structs§
- Gate
Tally - ALL-GREEN tally: gates print per-case lines and exit nonzero on any failure.
checkreturns the condition so call sites keep their inline{ ... "FAIL" }style or use it directly.
Functions§
- maxdiff
- Max absolute elementwise difference (the universal gate measure).
- median
- Median of N runs (the repo’s N=5 protocol; N is the caller’s law, this is the math). Sorts a copy; even N takes the lower-middle (matches the existing bench bins).
- pr
- Deterministic unit-interval-ish test vector generator (Knuth multiplicative hash →
[-1, 1)). Verbatim the kernel_check/dtype_gpu_check5
pr— gate vectors must never drift across crates or sessions. - rel_of
- Relative error of
dagainst the max-|value| scale ofreference(floored to avoid zero-division on all-zero references) — the kernel_check GEMM-band convention. - run_
n_ median - Run
fN times, return (median, all runs). The N=5-medians protocol runner.