← Back to Pull requests

Make the SLALN2/DLALN2 residual test robust to fused multiply-add #1396

Closed
unknown closed this pull request without merging on Sep 09, 2026 11:23 UTC
View on GitHub
unknown unknown commented on Sep 08, 2026 17:57 UTC
Author

Fixes #598.

Problem

The macOS nagfor CI jobs (static and shared) report in sec.out:

Error in SLALN2: RMAX =   0.622E+07
LMAX =    60625 NINFO=       0   71553 KNT=  230400

Test case 60625 is the complex 1x1 system with CA = sqrt(SMLNUM),
A = sqrt(BIGNUM), WR = D1 = 1, so C = CAA - WRD1 cancels almost
completely. SLALN2 computes it with a fused multiply-add (-3.42E-08,
the exact product minus one), whereas nagfor at -O2 and above evaluates
the products in SGET31's residual expression separately (-5.96E-08).
The test then divides the resulting residual by EPS |C| |X|, i.e. by
the 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 complex w), scale the
residual by the size of the terms that form C,

CNORM = |CA*A(1,1)| + |WR*D1| ( + |WI*D1| )

instead of by |C| itself, and use MAX( SMIN, EPSCNORM ) in the
perturbed (INFO /= 0) branch. This is the rounding-error bound of forming
C, and it matches the perturbation bound documented in SLALN2
("a small multiple of max( SMIN, ulp
norm(ca A - w D) )"). The
denominators 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 -O3 with and without -ffp-contract=off, flang -O0/-O3
now all give RMAX = 1.77 (before: 0.622E+07 with nagfor -O2+).

Diff: 219 lines (+164 / -55) across 2 files Reviewer: martin-frbg Review duration: 1046m
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
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.7% (MEDIUM) · Higher = larger blast radius
36.7%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 14.5% · Safe to merge
14.5%