Repository navigation
test: FuzzOps MatMul oracle as a stated error bound - #138
Merged
Merged
Conversation
The GEMM sums in its own order and fuses multiply-add, so it is not bit-equal to the naive float64 loop the fuzz oracle used (1 ulp apart on amd64, run 46298156668: At[3 1] 2.6035494484318307e+23 vs 2.603549448431831e+23). MatMul now owes |C_ij - exact_ij| <= gamma_k * sum|a_ik||b_kj| with exact_ij summed in math/big; At vs Copy stay bit-equal, elementwise ops unchanged. Commits the crash input as a regression seed. Refs #137 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FuzzOps compared MatMul bit-for-bit with a naive float64 triple loop. The GEMM sums in its own order and fuses multiply-add, so the two differ by rounding only (nightly fuzz run 46298156668, amd64:
At[3 1] = 2.6035494484318307e+23, oracle2.603549448431831e+23, 1 ulp). MatMul is not wrong.The test now asserts the stated inner-product bound, with the exact value summed in math/big:
The bound holds for any summation order and for FMA (go-blas docs/design.md Decision 4). A dot product with a non-finite operand keeps the oracle's value; one whose magnitude sum exceeds MaxFloat64 is not bounded (intermediate overflow is order-dependent).
AtvsCopyand every elementwise op stay bit-exact. The crash input3f595a556cba79cbis committed as a regression seed. A temporary 1e-10 relative perturbation of the MatMul output tripped the new check, then was reverted.SumAxis and CumSum keep the exact oracle: no failure has been seen there.
Test-only. Refs #137
🤖 Generated with Claude Code