Skip to content

Commit

Permalink
Fixed error when using common.mk from testsuite. (#768)
Browse files Browse the repository at this point in the history
Details:
- Commit 2db31e0 (#755) inserted logic into common.mk that attempts to
  preprocess build/detect/android/bionic.h to determine whether the
  __BIONIC__ macro is defined (in which case -lrt should not be included
  in LDFLAGS). However, the path to bionic.h was encoded without regard
  to DIST_PATH, and so utilizing common.mk anywhere that isn't the top-
  level directory (such as in the testsuite directory) resulted in a
  compiler error:

    gcc: error: build/detect/android/bionic.h: No such file or directory
    gcc: fatal error: no input files
    compilation terminated.

  This commit adds a $(DIST_PATH) prefix to the path to bionic.h so that
  it can be located from other applications' Makefiles that use BLIS's
  makefile fragments.
- (cherry picked from commit fa6a9b2)

Set thrcomm timpl_t id inside init functions. (#766)

Details:
- Previously, the timpl_t id being used when a thrcomm_t is being
  initialized was set within the bli_thrcomm_init() dispatch function
  after the timpl_t-specific bli_thrcomm_init_*() function returned. But
  it just occurred to me that each bli_thrcomm_init_*() function already
  intrinsically knows its own timpl_t value. This commit shifts the
  setting of the thrcomm_t.ti field into the corresponding
  bli_thrcomm_init_*() function for each timpl_t type (e.g. single,
  openmp, pthreads, hpx).
- Removed long-deprecated code dating back nearly 10 years.
- Whitespace changes
- Comment updates.
- (cherry picked from 634e532)

Small fixes/improvements to docs/Multithreading.md. (#764)

Details:
- Added reminders that #include "blis.h" must be added to source files
  in order to access BLIS API function prototypes. Thanks to Barry Smith
  for suggesting this improvement.
- Fixed pre-existing typos.
- CREDITS file update.
- (cherry picked from 3cf17b4)

CREDITS file update.

Details:
- Thanks to Igor Zhuravlov for PR #753 (commit 915daaa).
- (cherry picked from dbc7981)

Fix typos in docs + example code comments. (#753)

Details:
- Fixed various typos in API documentation in docs/BLIS*API.md and
  comments in the source code examples within examples/?api/*.c.
- (cherry picked from 915daaa)

Exclude -lrt on Android with Bionic libraries. (#755)

Details:
- Added build/detect/android/bionic.h header to test whether the
  __BIONIC__ cpp macro is defined.
- In common.mk, only add -lrt to LDFLAGS when Bionic is not present.
- CREDITS file update.
- (cherry picked from 2db31e0)

Small fixes to support hpx in the testsuite (#759)

Details:
- Minor changes to test_libblis.c to support hpx.
- (cherry picked from 22ad8c1)

Auto-detect the RISC-V ABI of the compiler and use -mabi= during RISC-V Build
s (#750)

Details:
- Generate a build error if there is a 32/64-bit mismatch between the
  RISC-V ABI or architecture and the BLIS configuration selected.
- Handle Q, Zicsr, ZiFencei, Zba, Zbb, Zbc, Zbs and Zfh extensions in
  the RISC-V architecture auto-detection. ZiFencei and Zicsr is not
  detectable with built-in RISC-V macros right now.
- ZiFencei is not important for BLIS because doesn't it have
  Just-In-Time compilation or self-modifying code, and Zicsr is implied
  by the floating-point extensions, which are required for good
  performance in BLIS.
- Move RISC-V autodetect header files to build/detect/riscv/.
- (cherry picked from c91b41d)

Rewrote regen-symbols.sh (gen-libblis-symbols.sh). (#751)

Details:
- Wrote an alternative to regen-symbols.sh, gen-libblis-symbols.sh,
  that generates a list of exported symbols from the monolithic blis.h
  file rather than peeking inside of the shared object via nm. (This new
  script lives in the 'build' directory and the older script has been
  retired to build/old.) Special thanks to Devin Matthews for authoring
  gen-libblis-symbols.sh.
- Added a 'symbols' target to the top-level Makefile which will refresh
  build/libblis-symbols.def, with supporting changes to common.mk.
- Updates to build/libblis-symbols.def using the new symbol-generating
  script.
- (cherry picked from a0b04e3)

Fix 1m enablement for herk/her2k/syrk/syr2k. (#743)

Details:
- Ever since 28b0982, herk, her2k, syrk, and syr2k have been implemented
  in terms of the gemmt expert API. And since the decision of which
  induced method to use (1m or native) is made *below* the level of the
  expert API, executing any of {herk,her2k,syrk,syr2k} results in BLIS
  checking the enablement status for gemmt.
- This commit applies a band-aid of sorts to this issue by modifying
  bli_l3_ind_oper_get_enable() and bli_l3_ind_oper_set_enable() so that
  any attempts to query or modify the internal enablement status for
  herk, her2k, syrk, or syr2k instead does so for gemmt.
- This solution isn't perfect since, in theory, the user could enable 1m
  for, say, herk but then disable it for syrk, and then be confused when
  herk runs via native execution. But we don't anticipate that users
  modify 1m enablement at the operation level, and so in practice this
  solution is likely fine for now.
- (cherry picked from 89b7863)

add nvhpc compiler support (#719)

Add detection of the NVIDIA nvhpc compiler (`nvc`) in `configure`,
and adjust some warning options in `config.mk`. Currently, no
specific options for `nvc` have been added in the relevant
configurations so it may not be usable without further tweaks.
- (cherry picked from 138de3b)
  • Loading branch information
fgvanzee committed May 22, 2024
1 parent 65ef992 commit 280553d
Show file tree
Hide file tree
Showing 29 changed files with 701 additions and 335 deletions.
3 changes: 3 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ but many others have contributed code, ideas, and feedback, including
Ivan Korostelev @ivan23kor (University of Alberta)
Kyungmin Lee @kyungminlee (Ohio State University)
Michael Lehn @michael-lehn
@leo4678
Shmuel Levine @ShmuelLevine
@lschork2
Dave Love @loveshack
Expand Down Expand Up @@ -105,6 +106,7 @@ but many others have contributed code, ideas, and feedback, including
Rene Sitt
Tony Skjellum @tonyskjellum (The University of Tennessee at Chattanooga)
Mikhail Smelyanskiy (Intel, Parallel Computing Lab)
Barry Smith @BarrySmith (Argonne National Laboratory)
Nathaniel Smith @njsmith
Shaden Smith @ShadenSmith
Tyler Smith @tlrmchlsmth (The University of Texas at Austin)
Expand Down Expand Up @@ -134,6 +136,7 @@ but many others have contributed code, ideas, and feedback, including
Roman Yurchak @rth (Symerio)
Stefano Zampini @stefanozampini
M. Zhou @cdluminate
Igor Zhuravlov @jip (Far Eastern Federal University)

BLIS's development was partially funded by grants from industry
partners, including
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
clean cleanmk cleanh cleanlib distclean \
cleantest cleanblastest cleanblistest \
changelog \
symbols \
install uninstall uninstall-old \
uninstall-libs uninstall-lib-symlinks uninstall-headers \
uninstall-old-libs uninstall-lib-symlinks uninstall-old-headers
Expand Down Expand Up @@ -497,6 +498,19 @@ ifeq ($(ALL_MAKE_DEFS_MK_PRESENT),no)
endif


# --- Shared/dynamic libblis symbol file creation/refresh ---

symbols: check-env $(SYM_FILE)

$(SYM_FILE): $(HEADERS_TO_INSTALL)
ifeq ($(ENABLE_VERBOSE),yes)
$(GEN_SYMS) > $(SYM_FILE)
else
@echo "Updating $(SYM_FILE)"
@$(GEN_SYMS) > $(SYM_FILE)
endif


# --- Consolidated blis.h header creation ---

flat-header: check-env $(BLIS_H_FLAT)
Expand Down
36 changes: 36 additions & 0 deletions build/detect/android/bionic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, The University of Texas at Austin
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name(s) of the copyright holder(s) nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/* Detect Bionic on Android */
#if __BIONIC__
bionic
#endif
File renamed without changes.
63 changes: 63 additions & 0 deletions build/detect/riscv/bli_riscv_detect_abi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, The University of Texas at Austin
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name(s) of the copyright holder(s) nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/* Construct a RISC-V ABI string based on available features. */

#if __riscv

#define CAT2(a,b) a##b
#define CAT(a,b) CAT2(a,b)

#if __riscv_xlen == 32
#define RISCV_INT_ABI ilp32
#else
#define RISCV_INT_ABI lp64
#endif

#if __riscv_abi_rve
CAT(RISCV_INT_ABI, e)
#elif __riscv_float_abi_soft
RISCV_INT_ABI
#elif __riscv_float_abi_single
CAT(RISCV_INT_ABI, f)
#elif __riscv_float_abi_double
CAT(RISCV_INT_ABI, d)
#elif __riscv_float_abi_quad
CAT(RISCV_INT_ABI, q)
#else
#error "Unknown RISC-V ABI"
#endif

#endif /* __riscv */
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
#define RISCV_D
#endif

#if __riscv_flen >= 128
#define RISCV_Q q
#else
#define RISCV_Q
#endif

#if __riscv_c
#define RISCV_C c
#else
Expand All @@ -94,6 +100,47 @@
#define RISCV_V
#endif

/* No test currently for Zicsr, which was removed from the base ISA,
but F implies Zicsr */
#if __riscv_f
#define RISCV_ZICSR _zicsr
#else
#define RISCV_ZICSR
#endif

/* No test currently for Zifencei, which was removed from the base ISA */
#define RISCV_ZIFENCEI

#if __riscv_zba
#define RISCV_ZBA _zba
#else
#define RISCV_ZBA
#endif

#if __riscv_zbb
#define RISCV_ZBB _zbb
#else
#define RISCV_ZBB
#endif

#if __riscv_zbc
#define RISCV_ZBC _zbc
#else
#define RISCV_ZBC
#endif

#if __riscv_zbs
#define RISCV_ZBS _zbs
#else
#define RISCV_ZBS
#endif

#if __riscv_zfh
#define RISCV_ZFH _zfh
#else
#define RISCV_ZFH
#endif

#else /* __riscv_arch_test */

/* We assume I and E are exclusive when __riscv_arch_test isn't defined */
Expand Down Expand Up @@ -129,6 +176,12 @@
#define RISCV_D
#endif

#if __riscv_flen >= 128
#define RISCV_Q q
#else
#define RISCV_Q
#endif

#if __riscv_compressed
#define RISCV_C c
#else
Expand All @@ -144,12 +197,29 @@
#define RISCV_V
#endif

/* No test currently for Zicsr, which was removed from the base ISA, but
F implies Zicsr */
#if __riscv_flen >= 32
#define RISCV_ZICSR _zicsr
#else
#define RISCV_ZICSR
#endif

#define RISCV_ZIFENCEI
#define RISCV_ZBA
#define RISCV_ZBB
#define RISCV_ZBC
#define RISCV_ZBS
#define RISCV_ZFH

#endif /* __riscv_arch_test */

#define CAT2(a,b) a##b
#define CAT(a,b) CAT2(a,b)

CAT(rv, CAT(__riscv_xlen, CAT(RISCV_I, CAT(RISCV_E, CAT(RISCV_M, CAT(RISCV_A,
CAT(RISCV_F, CAT(RISCV_D, CAT(RISCV_C, CAT(RISCV_P, RISCV_V))))))))))
CAT(RISCV_F, CAT(RISCV_D, CAT(RISCV_Q, CAT(RISCV_C, CAT(RISCV_P, CAT(RISCV_V,
CAT(RISCV_ZICSR, CAT(RISCV_ZIFENCEI, CAT(RISCV_ZBA, CAT(RISCV_ZBB,
CAT(RISCV_ZBC, CAT(RISCV_ZBS, RISCV_ZFH))))))))))))))))))

#endif /* __riscv */
60 changes: 60 additions & 0 deletions build/gen-libblis-symbols.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash

get_config_var()
{
# Parse the compiler assigned to the CC variable within the config.mk file.
echo "$(grep "^ *$1 *:=" config.mk | sed 's/'$1' *:= *//')"
}

main()
{
if [ ! -e config.mk ]; then
echo "No config.mk file detected; have you configured BLIS?"
exit 1
fi

CC=$(get_config_var CC)
CONFIG_NAME=$(get_config_var CONFIG_NAME)
BLIS_H_FLAT="include/${CONFIG_NAME}/blis.h"

if [ ! -e ${BLIS_H_FLAT} ]; then
echo "No monolithic blis.h file detected at ${BLIS_H_FLAT}; have you run 'make'?"
exit 1
fi

#
# Header line
#
echo "EXPORTS"

#
# Breakdown of commands:
# $(CC) ... # Pre-process blis.h, making sure to include all BLAS and CBLAS symbols
# | tr ... # Make sure to split lines at ';' so that each declaration is on its own line
# | grep ... # Find exported symbols
# | sed -E
# -e ... # 1. Remove all __attribute__ clauses
# -e ... # 2. Select only the portion before an opening '(' (if any)
# -e ... # 3. Pull out the last word, which is the function name.
# | grep ... # Remove constants
# | grep ... # Remove blank lines
# | sed ... # Remove trailing spaces
# | sort
# | uniq
#
${CC} -DBLIS_ENABLE_CBLAS=1 -DBLIS_ENABLE_BLAS=1 -E ${BLIS_H_FLAT} \
| tr ';' '\n' \
| grep visibility \
| sed -E \
-e 's/__attribute__ *\( *\([^\)]+(\([^\)]+\) *)\) *\)//g' \
-e 's/(.*) *\(.*/\1/' \
-e 's/.* ([^ ].*)/\1/' \
| grep -v BLIS \
| grep -E '[^ ]' \
| sed -e 's/[[:space:]]*$//g' \
| sort \
| uniq
}

main "$@"

Loading

0 comments on commit 280553d

Please sign in to comment.