Skip to content

Commit

Permalink
Squash-merge 'pr' into 'squash'. (#457)
Browse files Browse the repository at this point in the history
Merged contributions from AMD's AOCL BLIS (#448).
  
Details:
- Added support for level-3 operation gemmt, which performs a gemm on
  only the lower or upper triangle of a square matrix C. For now, only
  the conventional/large code path will be supported (in vanilla BLIS).
  This was accomplished by leveraging the existing variant logic for
  herk. However, some of the infrastructure to support a gemmtsup is
  included in this commit, including
  - A bli_gemmtsup() front-end, similar to bli_gemmsup().
  - A bli_gemmtsup_ref() reference handler function.
  - A bli_gemmtsup_int() variant chooser function (with variant calls
    commented out).
- Added support for inducing complex domain gemmt via the 1m method.
- Added gemmt APIs to the BLAS and CBLAS compatiblity layers.
- Added gemmt test module to testsuite.
- Added standalone gemmt test driver to 'test' directory.
- Documented gemmt APIs in BLISObjectAPI.md and BLISTypedAPI.md.
- Added a C++ template header (blis.hh) containing a BLAS-inspired
  wrapper to a set of polymorphic CBLAS-like function wrappers defined
  in another header (cblas.hh). These two headers are installed if
  running the 'install' target with INSTALL_HH is set to 'yes'. (Also
  added a set of unit tests that exercise blis.hh, although they are
  disabled for now because they aren't compatible with out-of-tree
  builds.) These files now live in the 'vendor' top-level directory.
- Various updates to 'zen' and 'zen2' subconfigurations, particularly
  within the context initialization functions.
- Added s and d copyv, setv, and swapv kernels to kernels/zen/1, and
  various minor updates to dotv and scalv kernels. Also added various
  sup kernels contributed by AMD to kernels/zen/3. However, these
  kernels are (for now) not yet used, in part because they caused
  AppVeyor clang failures, and also because I have not found time to
  review and vet them.
- Output the python found during configure into the definition of PYTHON
  in build/config.mk (via build/config.mk.in).
- Added early-return checks (A, B, or C with zero dimension; alpha = 0)
  to bli_gemm_front.c.
- Implemented explicit beta = 0 handling in for the sgemm ukernel in
  bli_gemm_armv7a_int_d4x4.c, which was previously missing. This latent
  bug surfaced because the gemmt module verifies its computation using
  gemm with its beta parameter set to zero, which, on a cortexa15 system
  caused the gemm kernel code to unconditionally multiply the
  uninitialized C data by beta. The C matrix likely contained
  non-numeric values such as NaN, which then would have resulted in a
  false failure.
- Fixed a bug whereby the implementation for bli_herk_determine_kc(),
  in bli_l3_blocksize.c, was inadvertantly being defined in terms of
  helper functions meant for trmm. This bug was probably harmless since
  the trmm code should have also done the right thing for herk.
- Used cpp macros to neutralize the various AOCL_DTL_TRACE_ macros in
  kernels/zen/3/bli_gemm_small.c since those macros are not used in
  vanilla BLIS.
- Added cpp guard to definition of bli_mem_clear() in bli_mem.h to
  accommodate C++'s stricter type checking.
- Added cpp guard to test/*.c drivers that facilitate compilation on
  Windows systems.
- Various whitespace changes.
  • Loading branch information
fgvanzee committed Nov 14, 2020
1 parent 234b8b0 commit 88ad841
Show file tree
Hide file tree
Showing 163 changed files with 107,156 additions and 10,276 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ include/*/*.h
# -- misc. --

# BLIS testsuite output file
output.testsuite
output.testsuite.*

# BLAS test output files
out.*

# GTAGS database
GPATH
GRTAGS
GTAGS
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ ifeq ($(MK_ENABLE_CBLAS),yes)
HEADERS_TO_INSTALL += $(CBLAS_H_FLAT)
endif

# If requested, include AMD's C++ template header files in the list of headers
# to install.
ifeq ($(INSTALL_HH),yes)
HEADERS_TO_INSTALL += $(wildcard $(VEND_CPP_PATH)/*.hh)
endif



#
Expand Down Expand Up @@ -892,6 +898,19 @@ else
@- $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE)
endif


# --- AMD's C++ template header test rules ---

# NOTE: The targets below won't work as intended for an out-of-tree build,
# and so it's disabled for now.

#testcpp: testvendcpp

# Recursively run the test for AMD's C++ template header.
#testvendcpp:
# $(MAKE) -C $(VEND_TESTCPP_PATH)


# --- Install header rules ---

install-headers: check-env $(MK_INCL_DIR_INST)
Expand Down Expand Up @@ -1167,11 +1186,13 @@ ifeq ($(IS_CONFIGURED),yes)
ifeq ($(ENABLE_VERBOSE),yes)
- $(FIND) $(TESTSUITE_DIR)/$(OBJ_DIR) -name "*.o" | $(XARGS) $(RM_F)
- $(RM_F) $(TESTSUITE_DIR)/$(TESTSUITE_BIN)
# - $(MAKE) -C $(VEND_TESTCPP_DIR) clean
else
@echo "Removing object files from $(TESTSUITE_DIR)/$(OBJ_DIR)"
@- $(FIND) $(TESTSUITE_DIR)/$(OBJ_DIR) -name "*.o" | $(XARGS) $(RM_F)
@echo "Removing binary $(TESTSUITE_DIR)/$(TESTSUITE_BIN)"
@- $(RM_F) $(TESTSUITE_DIR)/$(TESTSUITE_BIN)
# @$(MAKE) -C $(VEND_TESTCPP_DIR) clean
endif # ENABLE_VERBOSE
endif # IS_CONFIGURED

Expand Down
3 changes: 3 additions & 0 deletions build/config.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ RANLIB := @RANLIB@
# Archiver.
AR := @AR@

# Python Interpreter
PYTHON := @PYTHON@

# Preset (required) CFLAGS and LDFLAGS. These variables capture the value
# of the CFLAGS and LDFLAGS environment variables at configure-time (and/or
# the value of CFLAGS/LDFLAGS if either was specified on the command line).
Expand Down
1 change: 1 addition & 0 deletions build/templates/license.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
libraries.
Copyright (C) 2019, The University of Texas at Austin
Copyright (C) 2018, Advanced Micro Devices, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
Expand Down
1 change: 1 addition & 0 deletions build/templates/license.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
libraries.
Copyright (C) 2019, The University of Texas at Austin
Copyright (C) 2018, Advanced Micro Devices, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
Expand Down
1 change: 1 addition & 0 deletions build/templates/license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# libraries.
#
# Copyright (C) 2019, The University of Texas at Austin
# Copyright (C) 2018, Advanced Micro Devices, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
Expand Down
8 changes: 8 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ INCLUDE_DIR := include
BLASTEST_DIR := blastest
TESTSUITE_DIR := testsuite

VEND_DIR := vendor
VEND_CPP_DIR := $(VEND_DIR)/cpp
VEND_TESTCPP_DIR := $(VEND_DIR)/testcpp

# The filename suffix for reference kernels.
REFNM := ref

Expand Down Expand Up @@ -358,6 +362,10 @@ REFKERN_PATH := $(DIST_PATH)/$(REFKERN_DIR)
KERNELS_PATH := $(DIST_PATH)/$(KERNELS_DIR)
SANDBOX_PATH := $(DIST_PATH)/$(SANDBOX_DIR)

# Construct paths to some optional C++ template headers contributed by AMD.
VEND_CPP_PATH := $(DIST_PATH)/$(VEND_CPP_DIR)
VEND_TESTCPP_PATH := $(DIST_PATH)/$(VEND_TESTCPP_DIR)

# Construct paths to the makefile fragments for the four primary directories
# of source code: the config directory, general framework code, reference
# kernel code, and optimized kernel code.
Expand Down
18 changes: 13 additions & 5 deletions config/cortexa15/bli_cntx_init_cortexa15.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ void bli_cntx_init_cortexa15( cntx_t* cntx )

// Initialize level-3 blocksize objects with architecture-specific values.
// s d c z
bli_blksz_init_easy( &blkszs[ BLIS_MR ], 4, 4, 0, 0 );
bli_blksz_init_easy( &blkszs[ BLIS_NR ], 4, 4, 0, 0 );
bli_blksz_init_easy( &blkszs[ BLIS_MC ], 336, 176, 0, 0 );
bli_blksz_init_easy( &blkszs[ BLIS_KC ], 528, 368, 0, 0 );
bli_blksz_init_easy( &blkszs[ BLIS_NC ], 4096, 4096, 0, 0 );
#if 1
bli_blksz_init_easy( &blkszs[ BLIS_MR ], 4, 4, -1, -1 );
bli_blksz_init_easy( &blkszs[ BLIS_NR ], 4, 4, -1, -1 );
bli_blksz_init_easy( &blkszs[ BLIS_MC ], 336, 176, -1, -1 );
bli_blksz_init_easy( &blkszs[ BLIS_KC ], 528, 368, -1, -1 );
bli_blksz_init_easy( &blkszs[ BLIS_NC ], 4096, 4096, -1, -1 );
#else
bli_blksz_init_easy( &blkszs[ BLIS_MR ], -1, 4, -1, -1 );
bli_blksz_init_easy( &blkszs[ BLIS_NR ], -1, 4, -1, -1 );
bli_blksz_init_easy( &blkszs[ BLIS_MC ], -1, 176, -1, -1 );
bli_blksz_init_easy( &blkszs[ BLIS_KC ], -1, 368, -1, -1 );
bli_blksz_init_easy( &blkszs[ BLIS_NC ], -1, 4096, -1, -1 );
#endif

// Update the context with the current architecture's register and cache
// blocksizes (and multiples) for native execution.
Expand Down
7 changes: 5 additions & 2 deletions config/haswell/bli_cntx_init_haswell.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void bli_cntx_init_haswell( cntx_t* cntx )
// gemmtrsm_l
BLIS_GEMMTRSM_L_UKR, BLIS_FLOAT, bli_sgemmtrsm_l_haswell_asm_6x16, TRUE,
BLIS_GEMMTRSM_L_UKR, BLIS_DOUBLE, bli_dgemmtrsm_l_haswell_asm_6x8, TRUE,

// gemmtrsm_u
BLIS_GEMMTRSM_U_UKR, BLIS_FLOAT, bli_sgemmtrsm_u_haswell_asm_6x16, TRUE,
BLIS_GEMMTRSM_U_UKR, BLIS_DOUBLE, bli_dgemmtrsm_u_haswell_asm_6x8, TRUE,
Expand All @@ -90,11 +91,11 @@ void bli_cntx_init_haswell( cntx_t* cntx )
bli_cntx_set_l1v_kers
(
10,
#if 1

// amaxv
BLIS_AMAXV_KER, BLIS_FLOAT, bli_samaxv_zen_int,
BLIS_AMAXV_KER, BLIS_DOUBLE, bli_damaxv_zen_int,
#endif

// axpyv
#if 0
BLIS_AXPYV_KER, BLIS_FLOAT, bli_saxpyv_zen_int,
Expand All @@ -106,9 +107,11 @@ void bli_cntx_init_haswell( cntx_t* cntx )
// dotv
BLIS_DOTV_KER, BLIS_FLOAT, bli_sdotv_zen_int,
BLIS_DOTV_KER, BLIS_DOUBLE, bli_ddotv_zen_int,

// dotxv
BLIS_DOTXV_KER, BLIS_FLOAT, bli_sdotxv_zen_int,
BLIS_DOTXV_KER, BLIS_DOUBLE, bli_ddotxv_zen_int,

// scalv
#if 0
BLIS_SCALV_KER, BLIS_FLOAT, bli_sscalv_zen_int,
Expand Down
4 changes: 1 addition & 3 deletions config/zen/amd_config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ ifeq ($(CC_VENDOR),gcc)
CKVECFLAGS := -mavx2 -mfpmath=sse -mfma
else
ifeq ($(CC_VENDOR),clang)
#CKVECFLAGS := -mavx2 -mfpmath=sse -mfma -march=znver1 -mno-fma4 -mno-tbm -mno-xop -mno-lwp
CKVECFLAGS := -mavx2 -mfpmath=sse -mfma
# When compiling with AOCC, add these flags to the default flags set above.
ifeq ($(strip $(shell clang -v |& head -1 | grep -c 'AOCC.LLVM.2.0.0')),1)
ifeq ($(strip $(shell clang -v |& head -1 | grep -c 'AOCC.LLVM')),1)
CKVECFLAGS += -mllvm -disable-licm-vrp
endif
else
Expand Down
Loading

0 comments on commit 88ad841

Please sign in to comment.