Module oracle

Module oracle 

Source
Expand description

The tier’s NUMERICS CONTRACT — the one comparison the GPU oracle (examples/native_fp8_ffn_m16_tc_microtest.rs) and the host simulation both evaluate, so a receipt and a unit test cannot be grading different things. The numerics contract for the tensor-core decode tiers (w8a16_gemm_m16, #927; dense_gemm_m16_bf16, #927/#928) — ONE comparison, evaluated by the GPU oracles (examples/native_fp8_ffn_m16_tc_microtest.rs, examples/native_bf16_lm_head_m16_microtest.rs) and by the host simulations (dense_ffn_m16_tc_m32_tests.rs, ops/dense_gemm_m16_bf16_tests.rs, ops/dense_gemm_m16_bf16_floor_tests.rs), so a receipt and a unit test cannot drift into grading different things.

The kernel REASSOCIATES the K reduction relative to the scalar GEMV (an m16n8k16 MMA reduces 16 K-products in the tensor core’s own order before they reach the FP32 accumulator), so the contract is a tolerance and always was. What changed in round 6 is WHICH tolerance; what changed in round 9 is how the tolerance’s absolute half is SCALED — see m16_tc_acc_floor.

Structs§

M16TcDiff
The result of comparing an m x n BF16 block against the scalar reference.
M16TcOutlier
One element the comparison rejected, with everything needed to say WHERE it is and WHY it failed.

Constants§

F32_UNIT_ROUNDOFF
FP32 unit roundoff, 2^-24. Every rounding the accumulator performs is a multiple of this times the magnitude being rounded, so it is the only constant in m16_tc_acc_floor that is not a judgement call.
M16_TC_ACC_FLOOR_MARGIN
Margin over the u * sqrt(K) accumulation scale that m16_tc_acc_floor admits.
M16_TC_MAX_ULP
BF16 ordinal-ULP budget this tier is held to, against the scalar GEMV. Unchanged since #927.
M16_TC_SIGN_FLIP_BAND
Magnitude below which a SIGN change carries no information: one ULP across zero is a full sign flip, so those are counted separately rather than graded. Unchanged from #927.

Functions§

bf16_ord
BF16 bits -> a monotone integer, so |ord(a) - ord(b)| is the ULP distance and +0/-0 are the same point.
compare_m16_tc_block
Compare an m x n BF16 block against the scalar reference under the tier’s contract. Both slices are m * n little-endian BF16 elements; k is the reduction depth the kernel ran.
m16_tc_acc_floor
Absolute error below which an ordinal-ULP budget says nothing, for one output of a length-k FP32 reduction whose row has RMS row_rms.
within_m16_tc_budget
The tier’s numerics contract, as ONE predicate every oracle and host simulation evaluates, so they cannot drift.