mirror of https://github.com/xianyi/OpenBLAS.git
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>
|
||
|---|---|---|
| .. | ||
| common.c | ||
| common.h | ||
| test_bgemm.c | ||
| test_caxpby.c | ||
| test_caxpyc.c | ||
| test_cgbmv.c | ||
| test_cgeadd.c | ||
| test_cgemm.c | ||
| test_cgemmt.c | ||
| test_cgemv_n.c | ||
| test_cgemv_t.c | ||
| test_cimatcopy.c | ||
| test_comatcopy.c | ||
| test_crot.c | ||
| test_crotg.c | ||
| test_csbmv.c | ||
| test_cscal.c | ||
| test_cspmv.c | ||
| test_ctrmv.c | ||
| test_ctrsv.c | ||
| test_damin.c | ||
| test_daxpby.c | ||
| test_dgeadd.c | ||
| test_dgemmt.c | ||
| test_dimatcopy.c | ||
| test_domatcopy.c | ||
| test_drotmg.c | ||
| test_dsum.c | ||
| test_dzamax.c | ||
| test_dzamin.c | ||
| test_dzsum.c | ||
| test_icamin.c | ||
| test_idamin.c | ||
| test_isamin.c | ||
| test_izamin.c | ||
| test_samin.c | ||
| test_saxpby.c | ||
| test_scamax.c | ||
| test_scamin.c | ||
| test_scsum.c | ||
| test_sgeadd.c | ||
| test_sgemmt.c | ||
| test_simatcopy.c | ||
| test_somatcopy.c | ||
| test_srotmg.c | ||
| test_ssum.c | ||
| test_zaxpby.c | ||
| test_zaxpyc.c | ||
| test_zgbmv.c | ||
| test_zgeadd.c | ||
| test_zgemm.c | ||
| test_zgemmt.c | ||
| test_zgemv_n.c | ||
| test_zgemv_t.c | ||
| test_zimatcopy.c | ||
| test_zomatcopy.c | ||
| test_zrot.c | ||
| test_zrotg.c | ||
| test_zsbmv.c | ||
| test_zscal.c | ||
| test_zspmv.c | ||
| test_ztrmv.c | ||
| test_ztrsv.c | ||
| utest_main2.c | ||
| xerbla.c | ||