Repository navigation
Conversation
Inventory every check in OpenBLAS test/ and ctest/ at 791b02a against its faer counterpart (docs/blas-test-inventory.md), and port the bounded ones: TRMM through matmul::triangular, TRSM/TRSV through triangular_solve, the rank-1 (GER) and symmetric rank-k (SYR/SYRK) updates through matmul with K = 1 and a triangular destination. Each test asserts an independently accumulated reference product and the source's rogue-value properties: the unreferenced triangle, an implicit unit diagonal and the leading-dimension padding must not be read, the triangular operand must not change, and only the referenced triangle of the destination is written. NaN replaces the source's ROGUE = -1.0D10 and exact integers replace its random fixture, so the comparison is exact. Test-only, four scalar types, 24 tests in the default run: cargo test -p t4a-faer --lib blas Refs #166
`matmul::dot::inner_prod` has no unit test of its own; it is exercised only
through the decompositions that call it, so the reference BLAS dot check is a
candidate for the next batch rather than covered. Also name the source's
CHECK subroutines per row: DNRM2/DASUM/IDAMAX are CHECK1 (`incx` 1/2), while
DDOT and the vector updates are CHECK2/CHECK3 with `incx`/`incy` in
{1, 2, -2, -1}.
Refs #166
|
Note for review: after the first green run I pushed The two CI failures seen earlier were unrelated flakes: |
GPT-6.1-sol adversarial reviewCRITICAL: none Critical (must not merge)none Needs changes
Unverified claims
Checked and finenone Not checked: executable tests, repository code outside the supplied diff, pinned upstream sources, or live CI; the padding-test failures above are established by assertion flow, not executed mutations.Reviewed head: |
Summary
Part of #166 (the follow-up to #31): the LAPACK validation covered the
decompositions, not the BLAS-level kernels. This PR adds the inventory of the
OpenBLAS
test/andctest/checks at the pinned revision, and a first batch ofbounded unit tests next to the owning modules.
Inventory:
docs/blas-test-inventory.md. It mapsevery check family in
test/{s,d,c,z}blat{1,2,3}.f,ctest/c_*(CBLAS,row-major, argument errors) and the OpenBLAS-only files to its faer counterpart,
marks each row ported / covered / no counterpart, and gives the reason. Test-only
change: no production path is touched, only
#[cfg(test)]module wiring inmatmul/mod.rsandtriangular_solve.rs.Ported in this batch
test/blat3.fDCHK3,DTRMM(and level-2TRMVas the rectangular destination)matmul::triangular::matmul_with_conjmatmul::blas::*::trmm_matches_an_independent_product,...::trmm_reads_and_writes_nothing_outside_its_operandstest/blat3.fDCHK3,DTRSM;test/blat2.fDCHK3,DTRSVtriangular_solve::solve_{,unit_}{lower,upper}_triangular_in_place_with_conjtriangular_solve::blas::*::trsm_recovers_the_exact_solution_with_an_implicit_diagonal,...::trsm_does_not_touch_memory_outside_its_operandtest/blat2.fDCHK4DGERmatmul::matmulwithK = 1(the privaterank_updatemodule), column-major and row-major destinationmatmul::blas::*::rank_one_update_matches_the_source_contracttest/blat2.fDCHK5DSYR;test/blat3.fDCHK4DSYRKmatmul_with_conjwith a triangular destinationmatmul::blas::*::symmetric_rank_k_update_writes_only_the_stored_triangleThe checked properties are the source's: an independently accumulated reference
product, the operand left unchanged, only the referenced triangle of the
destination written, and the parts a routine must not read (the unreferenced
triangle, an implicit unit diagonal, the leading-dimension padding) holding a
rogue value. The source's
ROGUE = -1.0D10becomes NaN (a masked read stillpoisons the result), its random
DBEG/DMAKEfixture and dimension sweepbecome bounded exact-integer fixtures, and
DMMCH's eps-ratio comparisonbecomes exact comparison.
DTRSM'salphahas no faer parameter, so thefixture scales the right-hand side by
alphabefore the solve - the samecomputation.
Inventory summary (the judgement, not every row)
TRMM,TRSM/TRSV,GER,SYR/SYRK(4 checks, 6 tests).NRM2(thenorm_l2tests already read a stride-2row view and the exponent range is norm_l2: strided fallback overflows or underflows for finite norms #36/
faer-008) andASUM(norm_l1).DOThas a counterpart (matmul::dot::inner_prod) but no unit test of itsown, so it is a next-batch candidate, not covered.
GBMV/SBMV/SPMV/TBMV/TPMV/TBSV/TPSV/SPR/SPR2), symmetric and Hermitian structured multiply(
SYMM/SYMV),SYR2K, the 3m variants, bfloat16/half comparisons, all oflevel-1 (
AXPY/COPY/SCAL/ROT/SWAP/IAMAX), and XERBLA-style argumentvalidation (faer panics on a bad shape instead of returning an info code).
GEMMitself -matmul::tests::test_matmulcoversthe product but is
#[ignore]d as too slow, so a bounded non-ignored GEMM caseis the next candidate.
Provenance and licence
test/LICENSEandctest/LICENSEin OpenBLAS are the netlib reference BLAStest-program notice (credit requested). No Fortran is translated, so
faer/COPYING.BLAS.NETLIBcarries that notice and the credit,NOTICErecordsit and states why the crate's
licenseexpression is unchanged. Each adaptedfile's header names the source file, the pinned revision, the routine, the URL
and the material changes; the oracle helpers are reimplemented in
faer/src/linalg/tests/blas_support.rs.Verification
cargo test -p t4a-faer --lib blas- the package ist4a-faer(the lib is namedfaer), so-p faerdoes not resolve. Full output, no filter:Regression on the two owning modules, nothing else changed:
Red before green: one deliberate mutation per ported property
Each mutation was applied to the kernel, the matching test run, then the mutation
reverted and the test re-run. Only the f64 arm is shown; the other three types
fail and pass identically.
(
diag_kind():Unit->Generic). The unit diagonal holds NaN.Rectangular, so thereferenced-half-only contract is broken and the other half is overwritten.
beta(let beta = Accum::Replace;inrank_update_imp).multiplies by
tril[(i1, i1)]instead of 1). The unit diagonal holds NaN.After reverting each mutation:
The two padding tests (
trmm_reads_and_writes_nothing_outside_its_operands,trsm_does_not_touch_memory_outside_its_operand) are the source'sleading-dimension check: they fail only when a kernel writes outside its output
region, which none of the four mutations does, and injecting that would need an
out-of-bounds write in the kernel. Their red state is therefore not demonstrated
here.
git status --shortafter the last mutation run shows only the intendedfiles.
Formatting
cargo fmt --all -- --checkis red onorigin/mainalready with the pinned1.96.0 toolchain (unrelated files:
faer/examples/*,faer-ffi,operator/*,...), because the tree's layout comes from a nightly formatter; the same is true
for
cargo +nightly fmt --check. Neither reports a diff in this PR's files:The new files were formatted with the repository's
rustfmt.tomlundernightly 1.11.0(imports granularity, comment width, style edition 2024).Continuous integration
All checks pass. Two jobs needed one rerun each, both for reasons outside this
diff:
buildfailed once infaer-ffi's newtests/fork.rs(
destroy left the handle's workers running, left 3 / right 2). That filecame in with
origin/main57db5c04(ffi: the team handle owns its pool instead of building one per call (#333) #344), this diff touches nofaer-ffipath, the same test passes locally on
828fd9e4(3 of 3 runs), and the flakeis already reported in faer-ffi fork test is flaky: 'destroy left the handle workers running' (3 != 2) under parallel test execution #348 (after docs(upstream-reports): list the performance reports in the parent README #346) with the same message. It passed on
the rerun.
testing-stable(the coverage job) failed once after 14m24s with fourSIGTERM/SIGKILL timeouts in
qz_real::tests::test_qz_real_blocked,qz_cplx::tests::test_qz_cplx_blocked,lu::partial_pivoting::factor::tests::wide_matrix_parallel_agrees_with_serialand
...::zero_pivot_column_reconstructs(292/918 run, 626 not run). Fiveworkflows were running on the hosted runners at the time and
main's owntesting-stablewas still in progress after 25m; no BLAS test failed. On thererun it took 19m34s and reported 918/918 passed, which includes the 24 new
tests (
PASS linalg::matmul::blas::{f32,f64,c32,c64}::*,linalg::triangular_solve::blas::*) under--features=unstablecoverageinstrumentation.
State
Pushed
3f45961fontest/166-blas-inventory(PR #349): the batch itself isee0ac939, plus one docs correction that names the source'sCHECKsubroutines per row and stops claiming a unit test for
matmul::dot::inner_prod(it has none). Based on
origin/main4ccd69b3.origin/mainhas since moved to828fd9e4(#344, #342), which this branch does not conflict with.Not verified
Par::Seqcalls, but only x86_64 has been run here.SYMM/SYMV,SYR2K, the 3m variants and the#[ignore]d full GEMM sweep remain unported (see the inventory).