Skip to content

Commit 768b690

Browse files
committed
wasm: cover all standard BLAS L1–L3 ops with readable CBLAS checks
Add scalar-oracle checks for the full Level 1/2/3 surface (dense, banded, and packed), including S/D/C/Z where applicable. Keep the deep AXPY/GEMV/ GEMM grids and exercise the remaining families on a compact size set. Merge the former check_*_full sources into per-level check_l*.c files with one test function per CBLAS interface and shared expect_close_* helpers. House oracles in ref_l1.c / ref_l2.c / ref_l3.c (typed deep-grid AXPY/GEMV, polymorphic L1/L2 helpers, and UPLO-aware L3 including SYMM/HEMM/HERK/ SYR2K/HER2K); triangular fixtures live in common.h. Document L1/L2/L3 and IEEE vs relaxed tolerance choices in tol.h. Discover emcc via PATH, OPENBLAS_EM_PREFIX, or \$ROOT/.em-prefix only. Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
1 parent d309a89 commit 768b690

13 files changed

Lines changed: 6706 additions & 775 deletions

File tree

‎test/wasm/README.md‎

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ Deep CBLAS correctness checks for `TARGET=WASM128_GENERIC`, run under Node / Ems
44

55
## Oracle
66

7-
Results from OpenBLAS (public CBLAS API) are compared to a **hand-written scalar C reference** in `ref.c` (IEEE `*` / `+` only — no SIMD, no FMA intrinsics). This is not Netlib BLAS and not a second OpenBLAS build.
7+
Results from OpenBLAS (public CBLAS API) are compared to hand-written scalar
8+
C references in `ref_l1.c`, `ref_l2.c`, and `ref_l3.c` (IEEE `*` / `+` only —
9+
no SIMD or FMA intrinsics). This is not Netlib BLAS and not a second OpenBLAS
10+
build.
811

912
Tolerances live in `tol.h`. Builds with `WASM_RELAXED_SIMD=1` use a slightly larger L2/L3 budget (`TEST_WASM_RELAXED`).
1013

@@ -23,11 +26,26 @@ Requires `emcc` on `PATH`, or an emscripten-forge prefix via `OPENBLAS_EM_PREFIX
2326

2427
CI runs the same script via `.github/workflows/wasm.yml` (Emscripten + Node on `ubuntu-latest`) on changes under `test/wasm/` and `kernel/wasm/`.
2528

26-
## Coverage (MVP)
29+
## Coverage
2730

28-
- L1: `saxpy` / `daxpy` (unit stride, non-unit, `inc==0`)
29-
- L2: `sgemv` / `dgemv` (N/T, square and rectangular, some non-unit strides)
30-
- L3: `sgemm` / `dgemm` / `cgemm` / `zgemm`, `ssyrk` / `dsyrk`, `strmm` / `dtrmm`, `strsm` / `dtrsm`
31+
The suite covers the complete standard CBLAS Level 1/2/3 families:
32+
33+
- Level 1: rotations, swap, scaling, copy, axpy, dot products, norms, absolute
34+
sums, and maximum-index operations for all applicable S/D/C/Z types.
35+
- Level 2 dense: general, symmetric, Hermitian, triangular, and rank-update
36+
operations.
37+
- Level 2 banded and packed: general, symmetric/Hermitian, triangular, solve,
38+
and rank-update operations.
39+
- Level 3: GEMM, SYMM/HEMM, SYRK/HERK, SYR2K/HER2K, and TRMM/TRSM.
40+
41+
Matrices used by the full checks include off-diagonal values. Symmetric and
42+
Hermitian inputs are mirrored explicitly; triangular solve inputs are
43+
diagonally dominant; band and packed layouts include their off-diagonals.
44+
Triangular solves are checked by constructing a right-hand side with the
45+
matching scalar matrix product and recovering the original input.
46+
47+
This scope is standard BLAS only. OpenBLAS extensions such as `axpby`, `gemmt`,
48+
`imatcopy`, and bfloat16 routines are intentionally excluded.
3149

3250
Size grids emphasize tile remainders around 4×4 / 8×4 / 2×2 (see `cases.h`).
3351

‎test/wasm/cases.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ static const int SIZES_CZ[] = {
5252
1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 16, 17, 31, 32, 33, 63, 64, 65};
5353
static const int NS_CZ = (int)(sizeof(SIZES_CZ) / sizeof(SIZES_CZ[0]));
5454

55+
/* Full standard-BLAS coverage: broad remainder sampling without large cases. */
56+
static const int SIZES_FULL[] = {
57+
1, 2, 3, 4, 5, 7, 8, 9, 15, 16, 17, 31, 32};
58+
static const int NS_FULL = (int)(sizeof(SIZES_FULL) / sizeof(SIZES_FULL[0]));
59+
5560
static const int INCS[] = {0, 1, 2, 3};
5661
static const int NINCS = (int)(sizeof(INCS) / sizeof(INCS[0]));
5762

0 commit comments

Comments
 (0)