Make the SLALN2/DLALN2 residual test robust to fused multiply-add #1396
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 219 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.323
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1396"
general
weight: 0.35
martin-frbg
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 = CAA - WRD1cancels 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, EPSCNORM )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, ulpnorm(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+).