OpenBLAS/utest/test_extensions
Amrita H S 0d6d459161 power/bgemm: add BFloat16-in, BFloat16-out GEMM kernel for POWER10
Add BGEMM (BF16 input → BF16 output) for POWER10 by reusing the
existing SBGEMM kernel infrastructure. A -DBGEMM compile flag switches
only the store path; the xvbf16ger2pp MMA instruction and BF16 packing
routines are shared with SBGEMM unchanged.

Changes
-------
kernel/power/KERNEL.POWER10
  - Register BGEMM kernel and copy-routine targets, reusing the
    sbgemm_ncopy/tcopy sources (packing layout is identical).

kernel/power/sbgemm_kernel_power10.c
  - Under BGEMM: force v4sf_t to float so accumulators stay in
    float32; add STORE4_BF16/STORE2_BF16 macros (read BF16 C, widen,
    apply alpha*acc, convert back via xvcvspbf16, store); add
    f32_to_bf16_scalar() for m&1/n&1 tails; add BGEMM variants of
    all SAVE_ACC macros covering the full m/n tile hierarchy.

param.h
  - Add BGEMM_DEFAULT_UNROLL_M=16, UNROLL_N=8, P/Q/R blocking
    parameters for POWER10, matching the 16x8 kernel tile.

Unit test (utest/test_extensions/test_bgemm.c)
  - Uses SBGEMM as a trusted reference. 21 test cases cover all four
    transpose combinations, all m/n remainder paths, odd-k, alpha=0,
    beta=0/1, and the m>=32 fast path. Tolerance 0.01 to account for
    the one extra BF16 rounding on the BGEMM store.

Performance (POWER10, single-threaded, Transa=N Transb=N)
----------------------------------------------------------
Step=1 (sizes 1–200):
  - Sizes 1–80:   baseline 0.1–128 MFlops (scalar fallback);
                  patch 0.1–39,656 MFlops (up to ~350x faster at M=80).
  - Sizes 81–200: patch 3x–24x faster (avg ~10x) with 16×8 MMA tile
                  engaged.

Step=8 (sizes 8–1024):
  - Baseline peaks at ~2,950 MFlops (avg ~1,746 MFlops).
  - Patch sustains 75,000–1,009,866 MFlops for sizes 384–960,
    exceeding 1 TFlops at large sizes.
  - Median speedup ~99x; average speedup ~140x across all sizes.

Signed-off-by: Amrita H S <amritahs@linux.vnet.ibm.com>
2026-07-23 02:13:31 -05:00
..
common.c build comparison functions for complex cases too 2026-02-18 19:12:35 +01:00
common.h utest: cover explicit XERBLA handler registration 2026-07-10 14:59:30 +08:00
test_bgemm.c power/bgemm: add BFloat16-in, BFloat16-out GEMM kernel for POWER10 2026-07-23 02:13:31 -05:00
test_caxpby.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_caxpyc.c Added new tests for BLAS-like and BLAS API in utest 2024-01-18 23:56:22 +03:00
test_cgbmv.c Added new tests for BLAS-like and BLAS API in utest 2024-01-18 23:56:22 +03:00
test_cgeadd.c Add transpose support for C in GEADD (fixes #4646) 2026-07-15 17:12:31 +05:30
test_cgemm.c use blasint instead of int to quiet warnings 2024-05-12 10:24:16 +03:00
test_cgemmt.c Fix expectation values for CblasRowMajor order 2024-10-10 20:39:29 +02:00
test_cgemv_n.c Added new tests for BLAS-like and BLAS API in utest 2024-01-18 23:56:22 +03:00
test_cgemv_t.c fix zdotu argument passing in utest_ext on windows (#4691) 2024-05-13 14:50:50 +02:00
test_cimatcopy.c Rename local copy functions to avoid name clash with the standard BLAS ones 2024-12-23 19:12:17 +01:00
test_comatcopy.c Rename local copy functions to avoid name clash with the standard BLAS ones 2024-12-23 19:12:17 +01:00
test_crot.c Disable tests with incx,incy=0 (undefined behavior) 2025-02-09 20:16:03 +01:00
test_crotg.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_csbmv.c Fix portability problems 2024-02-26 22:22:48 +01:00
test_cscal.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_cspmv.c Added new tests for BLAS-like and BLAS API in utest 2024-01-18 23:56:22 +03:00
test_ctrmv.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_ctrsv.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_damin.c Fix uninitialized variables in the extensions utest 2024-04-13 12:26:35 +02:00
test_daxpby.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_dgeadd.c Add transpose support for C in GEADD (fixes #4646) 2026-07-15 17:12:31 +05:30
test_dgemmt.c Fix expectation values for CblasRowMajor order 2024-10-10 20:39:29 +02:00
test_dimatcopy.c Rename local copy functions to avoid name clash with the standard BLAS ones 2024-12-23 19:12:17 +01:00
test_domatcopy.c Rename local copy functions to avoid name clash with the standard BLAS ones 2024-12-23 19:12:17 +01:00
test_drotmg.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_dsum.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_dzamax.c check abs zero inc 2024-02-10 00:46:52 +03:00
test_dzamin.c check abs zero inc 2024-02-10 00:46:52 +03:00
test_dzsum.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_icamin.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_idamin.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_isamin.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_izamin.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_samin.c check abs zero inc 2024-02-10 00:46:52 +03:00
test_saxpby.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_scamax.c check abs zero inc 2024-02-10 00:46:52 +03:00
test_scamin.c check abs zero inc 2024-02-10 00:46:52 +03:00
test_scsum.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_sgeadd.c Add transpose support for C in GEADD (fixes #4646) 2026-07-15 17:12:31 +05:30
test_sgemmt.c Fix expectation values for CblasRowMajor order 2024-10-10 20:39:29 +02:00
test_simatcopy.c Rename local copy functions to avoid name clash with the standard BLAS ones 2024-12-23 19:12:17 +01:00
test_somatcopy.c Rename local copy functions to avoid name clash with the standard BLAS ones 2024-12-23 19:12:17 +01:00
test_srotmg.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_ssum.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_zaxpby.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_zaxpyc.c Added new tests for BLAS-like and BLAS API in utest 2024-01-18 23:56:22 +03:00
test_zgbmv.c Added new tests for BLAS-like and BLAS API in utest 2024-01-18 23:56:22 +03:00
test_zgeadd.c Add transpose support for C in GEADD (fixes #4646) 2026-07-15 17:12:31 +05:30
test_zgemm.c use blasint instead of int to quiet warnings 2024-05-12 10:24:16 +03:00
test_zgemmt.c Fix expectation values for CblasRowMajor order 2024-10-10 20:39:29 +02:00
test_zgemv_n.c Added new tests for BLAS-like and BLAS API in utest 2024-01-18 23:56:22 +03:00
test_zgemv_t.c fix zdotu argument passing in utest_ext on windows (#4691) 2024-05-13 14:50:50 +02:00
test_zimatcopy.c Rename local copy functions to avoid name clash with the standard BLAS ones 2024-12-23 19:12:17 +01:00
test_zomatcopy.c Rename local copy functions to avoid name clash with the standard BLAS ones 2024-12-23 19:12:17 +01:00
test_zrot.c Disable tests with incx,incy=0 (undefined behavior) 2025-02-09 20:17:29 +01:00
test_zrotg.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_zsbmv.c Fix portability problem 2024-02-27 07:19:52 +01:00
test_zscal.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_zspmv.c Added new tests for BLAS-like and BLAS API in utest 2024-01-18 23:56:22 +03:00
test_ztrmv.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
test_ztrsv.c Support compilation without CBLAS 2024-05-11 13:10:54 +02:00
utest_main2.c Fix openblas_utest_ext build in AIX 2024-04-25 07:32:21 -04:00
xerbla.c utest: bound XERBLA routine name diagnostics 2026-07-10 15:40:02 +08:00