GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — BLAS: Account for subnormal rounding in NRM2 tests by rmlarsen · Pull Request #1423 · Reference-LAPACK/lapack Conversation
|
SNRM != ZNRM |
32% of draws, an ordinary one-subnormal-ulp disagreement |
| rejected by the current comparison | 1229, i.e. 6.1e-5 per draw |
| rejected by the comparison in this PR | 0, largest ratio 0.385 against THRESH = 10 |
So this is neither ARM-specific nor flush-to-zero; it is a rare lottery any platform can lose. It does gate CI: #1371's LAPACK_Test_Summary parses the .out files, and #1382's own rerun failed it with failing to pass the threshold: 10.
Fix. Use max(reference, SAFMIN) in the error denominator for all four real and complex norm tests. This is bit-identical to the current comparison for every normal result and supplies an absolute tolerance of order SAFMIN*ULP near underflow. It also replaces the overly permissive zero-reference branch: ZNRM == 0 happens only when the whole vector is exactly zero, in which case the SNRM == ZNRM fast path already claims it, so that branch was reachable only from a broken implementation. NaN and infinity checks remain in place.
Coverage. Add a fixed subnormal value and an unrandomized tail alongside every existing randomized case. The value has to sit in a narrow window: deep enough that one subnormal ulp is a relative error above THRESH*N*ULP, and shallow enough that SQRT(N)*x and NRM2(N,x,0) still round differently. Of 2*SAFMIN/k for k = 2, ..., 200000, only 13 values in double and 9 in single satisfy both, so the constants are commented rather than left bare, and a named parameter selects the unrandomized case instead of keying it to the end of the value list. The new cases fail the old comparison with test ratios of 2.4E+02 to 2.7E+03 in all four precisions and both index widths; the complex norm tests now run 2714 checks instead of 2314, and the real ones 2715 instead of 2315. No production BLAS or LAPACK routine changes.
Validation on an AMD Ryzen Threadripper PRO 7965WX 24-Cores (x86-64, Linux) with GNU Fortran 15.2.0:
-fopenmp -frecursive -fcheck=all, -O3 -march=native, and -O0 -g -fcheck=all, using both the default and _64 APIs. Output summaries were checked for numerical failures, since executable exit status alone does not detect them; LAPACK_Test_Summary is what turns them into a CI failure.git diff --check passes. Added fixed-form source lines fit within 72 columns.Under a flush-to-zero build the new value itself flushes, so the deterministic case degenerates into the existing zero case and tests nothing rather than failing; -ffast-math shows only the pre-existing flush-to-zero failures, at twice the count because the new row duplicates the zero row.
ARM64/GNU 15.2 and other compiler configurations remain for upstream CI.
Related: #1382
Checklist
Sorry, something went wrong.
There was an error while loading. Please reload this page.
172c6c4 to
0b0f51b
Compare
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## master #1423 +/- ## ======================================= Coverage 70.65% 70.66% ======================================= Files 6243 6243 Lines 501410 501422 +12 Branches 23516 23516 ======================================= + Hits 354296 354312 +16 + Misses 146251 146247 -4 Partials 863 863
Continue to review full report in Codecov by Harness.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
0b0f51b to
c8c40ed
Compare
|
@rmlarsen None of my business, but this is almost certainly a real improvement and justifies a nudge. It might help to rebase against latest |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Floor the reference magnitude at SAFMIN when forming the NRM2 test ratio. Subnormal results incur absolute rounding error of order SAFMIN*ULP, which a purely relative tolerance can reject. Apply the comparison to all four precisions and tighten the zero-reference case. Add a fixed subnormal value and an unrandomized tail alongside every existing randomized case. The value has to sit in a narrow window: deep enough that one subnormal ulp is a relative error above THRESH*N*ULP, and shallow enough that the reference and NRM2 still round differently. The chosen values fail the old comparison with test ratios of 3.2E+02 to 2.7E+03 against THRESH = 10, in all four precisions and both index APIs. A named parameter selects the unrandomized case so that it does not follow the end of the value list. The complex norm tests now run 2714 checks instead of 2314, and the real ones 2715 instead of 2315. No production BLAS or LAPACK routine changes. Validated on all eight Level 1 executables in Release static, Release shared with OpenMP and -fcheck=all, -O3 -march=native, and -O0 -g -fcheck=all; 200 repetitions per precision; 8E+07 focused subnormal draws whose largest test ratio is 0.385; and mutations that confirm flushed subnormal norms and 1% perturbed normal norms still fail.
c8c40ed to
dbdfdfa
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.