Skip to content

BLAS TESTING: exercise the Level 1 unrolled loops and the ?NRM2 threshold - #1413

Open
ACSimon33 wants to merge 1 commit into
masterfrom
blas-cov-level1-long
Open

ACSimon33 wants to merge 1 commit into
masterfrom
blas-cov-level1-long

Conversation

@ACSimon33

@ACSimon33 ACSimon33 commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Description

?DOT, ?COPY, ?SCAL and ?ASUM unroll by 5, 7, 5 and 6 and return early below their factor, so the Level 1 testers, every case of which stops at N = 4, never entered their unrolled bodies. CHECK1 and CHECK2 each gain one pass at N = 16, on small integer data so that the unrolled and sequential sums agree exactly and the expected values can be formed in the tester rather than tabulated. ?AXPY and ?SWAP unroll by 4 and 3 and are already reached at N = 4; they are in the new pass for symmetry.

?B1NRM2 gains two values at the threshold where ?NRM2 switches to its small accumulator. SQRT(SAFMIN) is exactly that threshold, so one value at it and one just below let a vector's small part outweigh its mid-range part, which is what the arm ordering the two sums needs.

Coverage

gcov under gfortran 13.3.0 at -O0, each ?blat1 driver linked against an otherwise uninstrumented BLAS, so these are what the BLAS testers reach on their own. Single precision shown; double is identical, and routines not listed are unchanged.

Routine Lines Branches
SDOT 88.00% to 100.00% 80.00% to 100.00%
SCOPY 65.38% to 100.00% 80.00% to 100.00%
SSCAL 63.16% to 100.00% 72.73% to 90.91%
SASUM 85.00% to 100.00% 72.73% to 90.91%
SNRM2 95.24% to 100.00% 100.00%, unchanged

SCNRM2 and DZNRM2 keep the arm the new values open for the real precisions: CB1NRM2 builds its known element as CMPLX(V0,-3*V0), fixing the mid-range part at SQRT(10) times the threshold, which the small part cannot outweigh at the N values in use.

Codecov reports these files at 100% on master already. Its blas flag measures the whole ctest suite rather than the BLAS testers alone (DASUM, for one, is reached through eight SRC callers), so this closes a hole in the BLAS test suite, not in the project's coverage.

langou
langou previously approved these changes Sep 14, 2026
@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.37%. Comparing base (a6c6e74) to head (11d5937).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1413      +/-   ##
==========================================
+ Coverage   69.36%   69.37%   +0.01%     
==========================================
  Files        6122     6122              
  Lines      486711   486884     +173     
  Branches    23268    23268              
==========================================
+ Hits       337584   337760     +176     
+ Misses     148689   148687       -2     
+ Partials      438      437       -1     
Components Coverage Δ
BLAS 97.96% <ø> (+0.02%) ⬆️
CBLAS 96.98% <ø> (ø)
LAPACK 82.38% <ø> (ø)
LAPACKE 2.17% <ø> (ø)
TMGLIB 55.69% <ø> (ø)
BLAS testing 88.45% <100.00%> (+0.11%) ⬆️
CBLAS testing 89.63% <ø> (ø)
LAPACK testing 82.20% <ø> (ø)
LAPACKE testing ∅ <ø> (∅)
Files with missing lines Coverage Δ
BLAS/TESTING/cblat1.f 88.85% <100.00%> (+0.07%) ⬆️
BLAS/TESTING/dblat1.f 92.26% <100.00%> (+1.41%) ⬆️
BLAS/TESTING/sblat1.f 93.24% <100.00%> (+1.28%) ⬆️
BLAS/TESTING/zblat1.f 88.85% <100.00%> (+0.07%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6c6e74...11d5937. Read the comment docs.

…hold

?DOT, ?COPY, ?SCAL and ?ASUM return early below their unroll factors of
5, 7, 5 and 6, so no case at N <= 4 reached the unrolled body: CHECK1
and CHECK2 gain a pass at N = 16.  ?B1NRM2 gains a value at
SQRT(SAFMIN), where ?NRM2 switches to its small accumulator, and one
just below it, so that the small sum can outweigh the mid-range one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ACSimon33
ACSimon33 marked this pull request as draft September 14, 2026 16:32
@ACSimon33
ACSimon33 marked this pull request as ready for review September 14, 2026 22:10
@ACSimon33
ACSimon33 requested a review from langou September 14, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants