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>
99 lines
3.5 KiB
Makefile
99 lines
3.5 KiB
Makefile
UTEST_CHECK = 1
|
|
TOPDIR = ..
|
|
DIR_EXT=test_extensions
|
|
|
|
override TARGET_ARCH=
|
|
override TARGET_MACH=
|
|
|
|
UTESTBIN=openblas_utest$(EXE)
|
|
UTESTEXTBIN=openblas_utest_ext$(EXE)
|
|
|
|
.PHONY : all
|
|
.NOTPARALLEL : all run_test $(UTESTBIN) $(UTESTEXTBIN)
|
|
|
|
include $(TOPDIR)/Makefile.system
|
|
|
|
OBJS=utest_main.o test_min.o test_amax.o test_ismin.o test_rotmg.o test_axpy.o test_dotu.o test_dsdot.o test_swap.o test_rot.o test_dnrm2.o test_zscal.o \
|
|
test_amin.o test_axpby.o test_gemv.o
|
|
#test_rot.o test_swap.o test_axpy.o test_dotu.o test_dsdot.o test_fork.o
|
|
OBJS_EXT=utest_main.o $(DIR_EXT)/xerbla.o $(DIR_EXT)/common.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_isamin.o $(DIR_EXT)/test_idamin.o $(DIR_EXT)/test_icamin.o $(DIR_EXT)/test_izamin.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_ssum.o $(DIR_EXT)/test_dsum.o $(DIR_EXT)/test_scsum.o $(DIR_EXT)/test_dzsum.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_saxpby.o $(DIR_EXT)/test_daxpby.o $(DIR_EXT)/test_caxpby.o $(DIR_EXT)/test_zaxpby.o $(DIR_EXT)/test_zaxpyc.o $(DIR_EXT)/test_caxpyc.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_samin.o $(DIR_EXT)/test_damin.o $(DIR_EXT)/test_scamin.o $(DIR_EXT)/test_dzamin.o $(DIR_EXT)/test_scamax.o $(DIR_EXT)/test_dzamax.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_drotmg.o $(DIR_EXT)/test_srotmg.o $(DIR_EXT)/test_zrotg.o $(DIR_EXT)/test_crotg.o $(DIR_EXT)/test_crot.o $(DIR_EXT)/test_zrot.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_zscal.o $(DIR_EXT)/test_cscal.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_domatcopy.o $(DIR_EXT)/test_somatcopy.o $(DIR_EXT)/test_zomatcopy.o $(DIR_EXT)/test_comatcopy.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_simatcopy.o $(DIR_EXT)/test_dimatcopy.o $(DIR_EXT)/test_cimatcopy.o $(DIR_EXT)/test_zimatcopy.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_sgeadd.o $(DIR_EXT)/test_dgeadd.o $(DIR_EXT)/test_cgeadd.o $(DIR_EXT)/test_zgeadd.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_cgemv_t.o $(DIR_EXT)/test_zgemv_t.o $(DIR_EXT)/test_cgemv_n.o $(DIR_EXT)/test_zgemv_n.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_sgemmt.o $(DIR_EXT)/test_dgemmt.o $(DIR_EXT)/test_cgemmt.o $(DIR_EXT)/test_zgemmt.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_ztrmv.o $(DIR_EXT)/test_ctrmv.o $(DIR_EXT)/test_ztrsv.o $(DIR_EXT)/test_ctrsv.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_zgemm.o $(DIR_EXT)/test_cgemm.o $(DIR_EXT)/test_zgbmv.o $(DIR_EXT)/test_cgbmv.o
|
|
OBJS_EXT+=$(DIR_EXT)/test_bgemm.o
|
|
|
|
ifneq ($(NO_LAPACK), 1)
|
|
OBJS += test_potrs.o
|
|
OBJS_EXT += $(DIR_EXT)/test_zspmv.o $(DIR_EXT)/test_cspmv.o $(DIR_EXT)/test_zsbmv.o $(DIR_EXT)/test_csbmv.o
|
|
ifneq ($(NO_CBLAS), 1)
|
|
ifneq ($(NO_LAPACKE), 1)
|
|
OBJS += test_kernel_regress.o
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
#this does not work with OpenMP nor with native Windows or Android threads
|
|
# FIXME TBD if this works on OSX, SunOS, POWER and zarch
|
|
ifeq ($(OSNAME), $(filter $(OSNAME),Linux CYGWIN_NT))
|
|
ifneq ($(USE_OPENMP), 1)
|
|
OBJS += test_fork.o
|
|
ifneq ($(NO_LAPACK), 1)
|
|
OBJS += test_post_fork_async.o
|
|
endif
|
|
endif
|
|
OBJS += test_post_fork.o
|
|
endif
|
|
|
|
ifeq ($(C_COMPILER), PGI)
|
|
OBJS = utest_main2.o
|
|
endif
|
|
ifeq ($(C_COMPILER), SUN)
|
|
OBJS = utest_main2.o
|
|
endif
|
|
ifeq ($(OSNAME), AIX)
|
|
OBJS = utest_main2.o
|
|
OBJS_EXT = $(DIR_EXT)/utest_main2.o
|
|
endif
|
|
|
|
ifeq ($(NO_CBLAS), 1)
|
|
override CFLAGS += -DNO_CBLAS
|
|
endif
|
|
|
|
all : run_test
|
|
|
|
ifeq ($(OSNAME), AIX)
|
|
$(UTESTBIN): $(OBJS)
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ ../$(LIBNAME) $(EXTRALIB)
|
|
|
|
$(UTESTEXTBIN): $(OBJS_EXT)
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ ../$(LIBNAME) $(EXTRALIB)
|
|
else
|
|
$(UTESTBIN): $(OBJS)
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ ../$(LIBNAME) $(EXTRALIB) $(FEXTRALIB)
|
|
|
|
$(UTESTEXTBIN): $(OBJS_EXT)
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ ../$(LIBNAME) $(EXTRALIB) $(FEXTRALIB)
|
|
endif
|
|
|
|
run_test: $(UTESTBIN) $(UTESTEXTBIN)
|
|
ifneq ($(CROSS), 1)
|
|
./$(UTESTBIN)
|
|
./$(UTESTEXTBIN)
|
|
endif
|
|
|
|
clean:
|
|
-rm -f *.o $(UTESTBIN) $(UTESTEXTBIN)
|
|
-rm -f $(DIR_EXT)/*.o
|
|
|
|
libs:
|