OpenBLAS/utest
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
..
test_extensions power/bgemm: add BFloat16-in, BFloat16-out GEMM kernel for POWER10 2026-07-23 02:13:31 -05:00
CMakeLists.txt Fix CTest command for openblas_utest_ext 2026-07-09 09:50:42 +02:00
Makefile power/bgemm: add BFloat16-in, BFloat16-out GEMM kernel for POWER10 2026-07-23 02:13:31 -05:00
ctest.h Avoid resolving wild pointers in automatic search for tests 2026-03-17 23:20:51 +01:00
openblas_utest.h Assume no underline suffixes on symbols when compiling with Intel ifx on Windows 2024-12-23 19:09:34 +01:00
test_amax.c utest: Add utest for the {sc/dz}amax and {s/d/sc/dz}amin 2024-01-30 11:32:36 +08:00
test_amin.c utest: Add utest for the {sc/dz}amax and {s/d/sc/dz}amin 2024-01-30 11:32:36 +08:00
test_axpby.c utest: add axpby 2024-02-04 09:41:30 +08:00
test_axpy.c Add INCX=0,INCY=1 test case for CAXPY 2023-08-04 15:28:02 +02:00
test_dnrm2.c Update utest/test_dnrm2.c 2024-03-12 15:28:50 +03:00
test_dotu.c Make tests for individual variable types conditional on the respective BUILD_ option 2020-09-13 21:52:18 +02:00
test_dsdot.c Fix non-SVE ARM64 potentially using non-zeroed register in SDOT/DDOT accumulation (#5918) 2026-07-15 17:30:11 +02:00
test_fork.c Free arrays after test 2026-03-17 23:22:20 +01:00
test_gemv.c utest: Add utest for {c/z}scal and {c/z}gemv 2025-01-21 14:24:03 +08:00
test_ismin.c Make tests for individual variable types conditional on the respective BUILD_ option 2020-09-13 21:52:18 +02:00
test_kernel_regress.c Make tests conditional on BUILD_DOUBLE 2020-09-13 22:17:46 +02:00
test_min.c Make tests for individual variable types conditional on the respective BUILD_ option 2020-09-13 21:52:18 +02:00
test_post_fork.c Free arrays after test 2026-03-17 23:22:20 +01:00
test_post_fork_async.c Free arrays after test 2026-03-17 23:22:20 +01:00
test_potrs.c no-gcse when loongarch64 2025-04-10 15:44:31 +02:00
test_rot.c Further rearranged the rotm kernel for the different architectures. 2025-01-22 11:41:12 +08:00
test_rotmg.c Make tests conditional on BUILD_DOUBLE 2020-09-13 22:17:46 +02:00
test_swap.c Make tests for individual variable types conditional on the respective BUILD_ option 2020-09-13 21:52:18 +02:00
test_zscal.c utest: Add utest for {c/z}scal and {c/z}gemv 2025-01-21 14:24:03 +08:00
utest_main.c Use ctest.h for unit test. Enable unit test on travis CI. 2016-01-29 11:35:31 +08:00
utest_main2.c Fix utest compilation 2024-01-18 18:21:30 +04:00