Repository navigation
Make the SLALN2/DLALN2 residual test robust to fused multiply-add - #1396
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The PR includes a new coverage-instrumentation document that appears out of scope for the stated SLALN2/DLALN2 residual-test fix and should be removed or split/clarified before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the SLALN2/DLALN2 testing residual normalization in the [sd]get31 eigen-test drivers to avoid residual blow-ups when C = ca*A - w*D is formed with different fused multiply-add behavior across compilation units, matching the intent of issue #598.
Changes:
- Adjust residual scaling for the 1x1 real-
wcases inSGET31/DGET31to use a non-cancelling denominator based on|ca*A| + |wr*D1|. - Adjust residual scaling for the 1x1 complex-
wcases inSGET31/DGET31to use|ca*A| + |wr*D1| + |wi*D1|, and useMAX(SMIN, EPS*CNORM)whenINFO /= 0. - Add
PR_DESCRIPTION_coverage.md, which documents Codecov/CMake coverage instrumentation changes (appears unrelated to the PR’s stated scope).
File summaries
| File | Description |
|---|---|
| TESTING/EIG/sget31.f | Scales 1x1 residual denominators by term magnitudes (CNORM) instead of ` |
| TESTING/EIG/dget31.f | Double-precision counterpart of the same CNORM-based residual scaling changes. |
| PR_DESCRIPTION_coverage.md | New documentation about coverage instrumentation; does not align with the PR’s described purpose. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
4db0fc1 to
7725cbd
Compare
❌ 4 Tests Failed:
View the top 3 failed test(s) by shortest run time
View the full list of 75 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Fixes #598.
Problem
The macOS nagfor CI jobs (static and shared) report in
sec.out:Test case 60625 is the complex 1x1 system with
CA = sqrt(SMLNUM),A = sqrt(BIGNUM),WR = D1 = 1, soC = CA*A - WR*D1cancels almostcompletely.
SLALN2computes it with a fused multiply-add (-3.42E-08,the exact product minus one), whereas nagfor at
-O2and above evaluatesthe products in
SGET31's residual expression separately (-5.96E-08).The test then divides the resulting residual by
EPS * |C| * |X|, i.e. bythe size of the cancelled difference, and the ratio explodes. This is the
same case David Hough reported in #598 in 2014; which compilers hit it just
depends on where they happen to fuse.
Changes
[sd]get31.f: for the two 1x1 systems (real and complexw), scale theresidual by the size of the terms that form
C,instead of by
|C|itself, and useMAX( SMIN, EPS*CNORM )in theperturbed (
INFO /= 0) branch. This is the rounding-error bound of formingC, and it matches the perturbation bound documented inSLALN2("a small multiple of
max( SMIN, ulp*norm(ca A - w D) )"). Thedenominators only grow, and only where cancellation occurs, so no
compiler can regress. The 2x2 blocks are unchanged: their row norms are
dominated by the off-diagonal entries, which cannot cancel.
Verification
Standalone driver over
[sd]get31 + [sd]laln2: nagfor-O0..-O4,gfortran 14/16
-O3with and without-ffp-contract=off, flang-O0/-O3now all give
RMAX = 1.77(before:0.622E+07with nagfor-O2+).