Module oracle

Module oracle 

Source
Expand description

2026-09-25: The tier’s numerics contract, shared by the GPU microtest (examples/native_fp8_ffn_m16_tc_microtest.rs) and the host simulation in dense_ffn_m16_tc_m32_tests.rs. 2026-09-25: The numerics contract for the tensor-core decode tiers, graded against the scalar GEMV.

Owner: model-layers (dense FFN). Invariants: none beyond the types.

within_m16_tc_budget is the one predicate the GPU microtests (for example examples/native_fp8_ffn_m16_tc_microtest.rs and examples/native_bf16_lm_head_m16_microtest.rs) and the host tests (dense_ffn_m16_tc_m32_tests.rs, ops/dense_gemm_m16_bf16_tests.rs, ops/dense_gemm_m16_bf16_floor_tests.rs) import. An m16n8k16 MMA sums K in a different order from the scalar GEMV, so the contract is a tolerance: an ordinal-ULP budget plus an absolute floor scaled to the reduction (m16_tc_acc_floor).

Structs§

M16TcDiff
2026-09-25: The result of comparing an m x n BF16 block against the scalar reference.
M16TcOutlier
2026-09-25: One element the comparison rejected: where it is, the two values, the ordinal distance and the row RMS the floor was evaluated at.

Constants§

F32_UNIT_ROUNDOFF
2026-09-25: FP32 unit roundoff, 2^-24.
M16_TC_ACC_FLOOR_MARGIN
2026-09-25: Margin over the u * sqrt(k) * row_rms accumulation scale in m16_tc_acc_floor.
M16_TC_MAX_ULP
2026-09-25: Ordinal BF16 ULP budget against the scalar GEMV reference.
M16_TC_SIGN_FLIP_BAND
2026-09-25: A sign change on a reference smaller than this in magnitude is counted in sign_flips and not graded.

Functions§

bf16_ord
2026-09-25: 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
2026-09-25: 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
2026-09-25: 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
2026-09-25: The tier’s numerics contract as one predicate.