diff --git a/builds/cmake/install-cmake.sh b/builds/cmake/install-cmake.sh index fa0259f49..caacfe9ec 100755 --- a/builds/cmake/install-cmake.sh +++ b/builds/cmake/install-cmake.sh @@ -8,36 +8,7 @@ # Script managing the build and installation of libbitcoin-node and its dependencies. # # Script options: -# -Denable-shani= Use Intel SHA Extensions. -# Default: OFF -# -Denable-sha512= Use Intel SHA512 Extensions (implies AVX2). -# Default: OFF -# -Denable-aesni= Use Intel AES-NI and PCLMULQDQ intrinsics. -# Default: OFF -# -Denable-vaes= Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2). -# Default: OFF -# -Denable-avx512ifma= Use Intel AVX512 IFMA intrinsics (implies AVX512VL). -# Default: OFF -# -Denable-avx512= Use Intel AVX512 intrinsics. -# Default: OFF -# -Denable-avxifma= Use Intel AVX IFMA intrinsics (implies AVX2). -# Default: OFF -# -Denable-avx2= Use Intel AVX2 intrinsics. -# Default: OFF -# -Denable-sse41= Use SSE4.1 hardware instructions. -# Default: OFF -# -Denable-sha2= Use ARM SHA1/SHA256 Extensions. -# Default: OFF -# -Denable-sha3= Use ARM SHA3 Extensions for SHA512. -# Default: OFF -# -Denable-aes= Use ARM AES and PMULL Extensions. -# Default: OFF -# -Dwith-secp256k1= Use bitcoin-core/secp256k1 library. -# Default: OFF -# -Dwith-valgrind= Use valgrind memcheck client requests. -# Default: OFF -# -Denable-cuda= Use cuda (gpu) batch signature verification (inert on macOS). -# Default: ON + # --build-secp256k1 Build libsecp256k1 libraries # --build-src-dir= Location for sources. # Default: $(pwd) @@ -68,6 +39,54 @@ # --verbose Display verbose script output. # --help, -h Display usage, overriding script execution. # +# Hardware configuration options for arm64: +# --hardware-aes Use ARM AES and PMULL Extensions. +# --hardware-sha2 Use ARM SHA1/SHA256 Extensions. +# --hardware-sha3 Use ARM SHA3 Extensions for SHA512. +# +# Hardware configuration options for x64: +# --hardware-avx2 Use Intel AVX2 intrinsics. +# --hardware-avx512 Use Intel AVX512 intrinsics. +# --hardware-avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL). +# --hardware-avxifma Use Intel AVX IFMA intrinsics (implies AVX2). +# --hardware-shani Use Intel SHA Extensions. +# --hardware-sha512 Use Intel SHA512 Extensions (implies AVX2). +# --hardware-sse41 Use SSE4.1 hardware instructions. +# --hardware-aesni Use Intel AES-NI and PCLMULQDQ intrinsics. +# --hardware-vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2). +# +# Recognized pass-through options: +# -Denable-shani= Add Intel SHA Extensions via compilation options. +# Default: OFF +# -Denable-sha512= Add Intel SHA512 Extensions (implies AVX2) via compilation options. +# Default: OFF +# -Denable-aesni= Add Intel AES-NI and PCLMULQDQ intrinsics via compilation options. +# Default: OFF +# -Denable-vaes= Add Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2) via compilation options. +# Default: OFF +# -Denable-avx512ifma= Add Intel AVX512 IFMA intrinsics (implies AVX512VL) via compilation options. +# Default: OFF +# -Denable-avx512= Add Intel AVX512 intrinsics via compilation options. +# Default: OFF +# -Denable-avxifma= Add Intel AVX IFMA intrinsics (implies AVX2) via compilation options. +# Default: OFF +# -Denable-avx2= Add Intel AVX2 intrinsics via compilation options. +# Default: OFF +# -Denable-sse41= Add SSE4.1 hardware instructions via compilation options. +# Default: OFF +# -Denable-sha2= Check for ARM SHA1/SHA256 Extensions. +# Default: OFF +# -Denable-sha3= Check for ARM SHA3 Extensions for SHA512. +# Default: OFF +# -Denable-aes= Check for ARM AES and PMULL Extensions. +# Default: OFF +# -Dwith-secp256k1= Use bitcoin-core/secp256k1 library. +# Default: OFF +# -Dwith-valgrind= Use valgrind memcheck client requests. +# Default: OFF +# -Dwith-cuda= Use cuda (gpu) batch signature verification (inert on macOS). +# Default: ON +# # All unrecognized options provided shall be passed as configuration # options for all dependencies. @@ -121,6 +140,18 @@ main() for OPTION in "$@"; do case ${OPTION} in (--build-secp256k1) BUILD_secp256k1="yes";; + (--hardware-aes) HARDWARE_AES="yes";; + (--hardware-sha2) HARDWARE_SHA2="yes";; + (--hardware-sha3) HARDWARE_SHA3="yes";; + (--hardware-avx2) HARDWARE_AVX2="yes";; + (--hardware-avx512) HARDWARE_AVX512="yes";; + (--hardware-avx512ifma) HARDWARE_AVX512IFMA="yes";; + (--hardware-avxifma) HARDWARE_AVXIFMA="yes";; + (--hardware-shani) HARDWARE_SHANI="yes";; + (--hardware-sha512) HARDWARE_SHA512="yes";; + (--hardware-sse41) HARDWARE_SSE41="yes";; + (--hardware-aesni) HARDWARE_AESNI="yes";; + (--hardware-vaes) HARDWARE_VAES="yes";; (--build-src-dir=*) BUILD_SRC_DIR="${OPTION#*=}";; (--build-obj-dir=*) BUILD_OBJ_DIR="${OPTION#*=}";; (--build-obj-dir-relative) BUILD_OBJ_DIR_RELATIVE="yes";; @@ -166,6 +197,18 @@ main() CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--verbose/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--help/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#-h/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-aes/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sha2/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sha3/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avx2/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avx512/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avx512ifma/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avxifma/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-shani/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sha512/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sse41/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-aesni/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-vaes/}") CONFIGURE_OPTIONS_CMAKE=("${CONFIGURE_OPTIONS[@]}") msg_verbose "*** ARGUMENTS: ${CONFIGURE_OPTIONS_ORIGINAL[*]}" msg_verbose "*** SANITIZED: ${CONFIGURE_OPTIONS[*]}" @@ -393,6 +436,99 @@ main() ARCHTUNE="-march=native -mtune=native" fi + # Platform options: arm64 + + if [[ "${HARDWARE_AES}" == "yes" ]]; then + HARDWARE_PLATFORM_ARM64="yes" + ARCHBASE="armv8-a" + ARCHSUFFIX="${ARCHSUFFIX}+aes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-aes=ON" ) + fi + + if [[ "${HARDWARE_SHA2}" == "yes" ]]; then + HARDWARE_PLATFORM_ARM64="yes" + ARCHBASE="armv8-a" + ARCHSUFFIX="${ARCHSUFFIX}+sha2" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-sha2=ON" ) + fi + + if [[ "${HARDWARE_SHA3}" == "yes" ]]; then + HARDWARE_PLATFORM_ARM64="yes" + ARCHBASE="armv8.2-a" + ARCHSUFFIX="${ARCHSUFFIX}+sha3" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-sha3=ON" ) + fi + + if [[ ${HARDWARE_PLATFORM_ARM64} == "yes" ]]; then + ARCHTUNE="${ARCHBASE}${ARCHSUFFIX}" + fi + + # Platform options: x64 + + if [[ "${HARDWARE_AVX2}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-avx2=ON" ) + fi + + if [[ "${HARDWARE_AVX512}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-avx512=ON" ) + fi + + if [[ "${HARDWARE_AVX512IFMA}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-avx512ifma=ON" ) + fi + + if [[ "${HARDWARE_AVXIFMA}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-avxifma=ON" ) + fi + + if [[ "${HARDWARE_SHANI}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-shani=ON" ) + fi + + if [[ "${HARDWARE_SHA512}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-sha512=ON" ) + fi + + if [[ "${HARDWARE_SSE41}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-sse41=ON" ) + fi + + if [[ "${HARDWARE_AESNI}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-aesni=ON" ) + fi + + if [[ "${HARDWARE_VAES}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-vaes=ON" ) + fi + + HARDWARE_PLATFORM_COUNT=0 + if [[ ${HARDWARE_PLATFORM_ARM64} == "yes" ]]; then + HARDWARE_PLATFORM_COUNT=$((HARDWARE_PLATFORM_COUNT + 1)) + fi + if [[ ${HARDWARE_PLATFORM_X64} == "yes" ]]; then + HARDWARE_PLATFORM_COUNT=$((HARDWARE_PLATFORM_COUNT + 1)) + fi + + if [ ${HARDWARE_PLATFORM_COUNT} -gt 1 ]; then + msg_error "Hardware options spanning more than one platform have been specified." + exit 1 + fi + + if [[ "${HARDWARE_OPTIMIZED}" == "yes" ]] && + [ ${HARDWARE_PLATFORM_COUNT} -gt 0 ]; then + msg_error "Hardware optimization cannot be reliably rationalized with hardware platform options." + exit 1 + fi + # translate BUILD_CONFIG to ZFLAGS if [[ -n "${BUILD_CONFIG}" ]]; then msg_verbose "*** Build config specified, calculating flags..." @@ -893,36 +1029,7 @@ help() msg "Script managing the build and installation of libbitcoin-node and its dependencies." msg "" msg "Script options:" - msg "-Denable-shani= Use Intel SHA Extensions." - msg " Default: OFF" - msg "-Denable-sha512= Use Intel SHA512 Extensions (implies AVX2)." - msg " Default: OFF" - msg "-Denable-aesni= Use Intel AES-NI and PCLMULQDQ intrinsics." - msg " Default: OFF" - msg "-Denable-vaes= Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2)." - msg " Default: OFF" - msg "-Denable-avx512ifma= Use Intel AVX512 IFMA intrinsics (implies AVX512VL)." - msg " Default: OFF" - msg "-Denable-avx512= Use Intel AVX512 intrinsics." - msg " Default: OFF" - msg "-Denable-avxifma= Use Intel AVX IFMA intrinsics (implies AVX2)." - msg " Default: OFF" - msg "-Denable-avx2= Use Intel AVX2 intrinsics." - msg " Default: OFF" - msg "-Denable-sse41= Use SSE4.1 hardware instructions." - msg " Default: OFF" - msg "-Denable-sha2= Use ARM SHA1/SHA256 Extensions." - msg " Default: OFF" - msg "-Denable-sha3= Use ARM SHA3 Extensions for SHA512." - msg " Default: OFF" - msg "-Denable-aes= Use ARM AES and PMULL Extensions." - msg " Default: OFF" - msg "-Dwith-secp256k1= Use bitcoin-core/secp256k1 library." - msg " Default: OFF" - msg "-Dwith-valgrind= Use valgrind memcheck client requests." - msg " Default: OFF" - msg "-Denable-cuda= Use cuda (gpu) batch signature verification (inert on macOS)." - msg " Default: ON" + msg "--build-secp256k1 Build libsecp256k1 libraries" msg "--build-src-dir= Location for sources." msg " Default: $(pwd)" @@ -953,6 +1060,54 @@ help() msg "--verbose Display verbose script output." msg "--help, -h Display usage, overriding script execution." msg "" + msg "Hardware configuration options for arm64:" + msg "--hardware-aes Use ARM AES and PMULL Extensions." + msg "--hardware-sha2 Use ARM SHA1/SHA256 Extensions." + msg "--hardware-sha3 Use ARM SHA3 Extensions for SHA512." + msg "" + msg "Hardware configuration options for x64:" + msg "--hardware-avx2 Use Intel AVX2 intrinsics." + msg "--hardware-avx512 Use Intel AVX512 intrinsics." + msg "--hardware-avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL)." + msg "--hardware-avxifma Use Intel AVX IFMA intrinsics (implies AVX2)." + msg "--hardware-shani Use Intel SHA Extensions." + msg "--hardware-sha512 Use Intel SHA512 Extensions (implies AVX2)." + msg "--hardware-sse41 Use SSE4.1 hardware instructions." + msg "--hardware-aesni Use Intel AES-NI and PCLMULQDQ intrinsics." + msg "--hardware-vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2)." + msg "" + msg "Recognized pass-through options:" + msg "-Denable-shani= Add Intel SHA Extensions via compilation options." + msg " Default: OFF" + msg "-Denable-sha512= Add Intel SHA512 Extensions (implies AVX2) via compilation options." + msg " Default: OFF" + msg "-Denable-aesni= Add Intel AES-NI and PCLMULQDQ intrinsics via compilation options." + msg " Default: OFF" + msg "-Denable-vaes= Add Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2) via compilation options." + msg " Default: OFF" + msg "-Denable-avx512ifma= Add Intel AVX512 IFMA intrinsics (implies AVX512VL) via compilation options." + msg " Default: OFF" + msg "-Denable-avx512= Add Intel AVX512 intrinsics via compilation options." + msg " Default: OFF" + msg "-Denable-avxifma= Add Intel AVX IFMA intrinsics (implies AVX2) via compilation options." + msg " Default: OFF" + msg "-Denable-avx2= Add Intel AVX2 intrinsics via compilation options." + msg " Default: OFF" + msg "-Denable-sse41= Add SSE4.1 hardware instructions via compilation options." + msg " Default: OFF" + msg "-Denable-sha2= Check for ARM SHA1/SHA256 Extensions." + msg " Default: OFF" + msg "-Denable-sha3= Check for ARM SHA3 Extensions for SHA512." + msg " Default: OFF" + msg "-Denable-aes= Check for ARM AES and PMULL Extensions." + msg " Default: OFF" + msg "-Dwith-secp256k1= Use bitcoin-core/secp256k1 library." + msg " Default: OFF" + msg "-Dwith-valgrind= Use valgrind memcheck client requests." + msg " Default: OFF" + msg "-Dwith-cuda= Use cuda (gpu) batch signature verification (inert on macOS)." + msg " Default: ON" + msg "" msg "All unrecognized options provided shall be passed as configuration" msg "options for all dependencies." } diff --git a/builds/cmake/install-presets.sh b/builds/cmake/install-presets.sh index a73a6c2ef..f31b10314 100755 --- a/builds/cmake/install-presets.sh +++ b/builds/cmake/install-presets.sh @@ -8,36 +8,7 @@ # Script managing the build and installation of libbitcoin-node and its dependencies. # # Script options: -# -Denable-shani= Use Intel SHA Extensions. -# Default: OFF -# -Denable-sha512= Use Intel SHA512 Extensions (implies AVX2). -# Default: OFF -# -Denable-aesni= Use Intel AES-NI and PCLMULQDQ intrinsics. -# Default: OFF -# -Denable-vaes= Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2). -# Default: OFF -# -Denable-avx512ifma= Use Intel AVX512 IFMA intrinsics (implies AVX512VL). -# Default: OFF -# -Denable-avx512= Use Intel AVX512 intrinsics. -# Default: OFF -# -Denable-avxifma= Use Intel AVX IFMA intrinsics (implies AVX2). -# Default: OFF -# -Denable-avx2= Use Intel AVX2 intrinsics. -# Default: OFF -# -Denable-sse41= Use SSE4.1 hardware instructions. -# Default: OFF -# -Denable-sha2= Use ARM SHA1/SHA256 Extensions. -# Default: OFF -# -Denable-sha3= Use ARM SHA3 Extensions for SHA512. -# Default: OFF -# -Denable-aes= Use ARM AES and PMULL Extensions. -# Default: OFF -# -Dwith-secp256k1= Use bitcoin-core/secp256k1 library. -# Default: OFF -# -Dwith-valgrind= Use valgrind memcheck client requests. -# Default: OFF -# -Denable-cuda= Use cuda (gpu) batch signature verification (inert on macOS). -# Default: ON + # --build-secp256k1 Build libsecp256k1 libraries # --build-preset= Specifies preset configuration to build. # --build-src-dir= Location for sources. @@ -58,6 +29,54 @@ # --verbose Display verbose script output. # --help, -h Display usage, overriding script execution. # +# Hardware configuration options for arm64: +# --hardware-aes Use ARM AES and PMULL Extensions. +# --hardware-sha2 Use ARM SHA1/SHA256 Extensions. +# --hardware-sha3 Use ARM SHA3 Extensions for SHA512. +# +# Hardware configuration options for x64: +# --hardware-avx2 Use Intel AVX2 intrinsics. +# --hardware-avx512 Use Intel AVX512 intrinsics. +# --hardware-avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL). +# --hardware-avxifma Use Intel AVX IFMA intrinsics (implies AVX2). +# --hardware-shani Use Intel SHA Extensions. +# --hardware-sha512 Use Intel SHA512 Extensions (implies AVX2). +# --hardware-sse41 Use SSE4.1 hardware instructions. +# --hardware-aesni Use Intel AES-NI and PCLMULQDQ intrinsics. +# --hardware-vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2). +# +# Recognized pass-through options: +# -Denable-shani= Add Intel SHA Extensions via compilation options. +# Default: OFF +# -Denable-sha512= Add Intel SHA512 Extensions (implies AVX2) via compilation options. +# Default: OFF +# -Denable-aesni= Add Intel AES-NI and PCLMULQDQ intrinsics via compilation options. +# Default: OFF +# -Denable-vaes= Add Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2) via compilation options. +# Default: OFF +# -Denable-avx512ifma= Add Intel AVX512 IFMA intrinsics (implies AVX512VL) via compilation options. +# Default: OFF +# -Denable-avx512= Add Intel AVX512 intrinsics via compilation options. +# Default: OFF +# -Denable-avxifma= Add Intel AVX IFMA intrinsics (implies AVX2) via compilation options. +# Default: OFF +# -Denable-avx2= Add Intel AVX2 intrinsics via compilation options. +# Default: OFF +# -Denable-sse41= Add SSE4.1 hardware instructions via compilation options. +# Default: OFF +# -Denable-sha2= Check for ARM SHA1/SHA256 Extensions. +# Default: OFF +# -Denable-sha3= Check for ARM SHA3 Extensions for SHA512. +# Default: OFF +# -Denable-aes= Check for ARM AES and PMULL Extensions. +# Default: OFF +# -Dwith-secp256k1= Use bitcoin-core/secp256k1 library. +# Default: OFF +# -Dwith-valgrind= Use valgrind memcheck client requests. +# Default: OFF +# -Dwith-cuda= Use cuda (gpu) batch signature verification (inert on macOS). +# Default: ON +# # All unrecognized options provided shall be passed as configuration # options for all dependencies. @@ -111,6 +130,18 @@ main() for OPTION in "$@"; do case ${OPTION} in (--build-secp256k1) BUILD_secp256k1="yes";; + (--hardware-aes) HARDWARE_AES="yes";; + (--hardware-sha2) HARDWARE_SHA2="yes";; + (--hardware-sha3) HARDWARE_SHA3="yes";; + (--hardware-avx2) HARDWARE_AVX2="yes";; + (--hardware-avx512) HARDWARE_AVX512="yes";; + (--hardware-avx512ifma) HARDWARE_AVX512IFMA="yes";; + (--hardware-avxifma) HARDWARE_AVXIFMA="yes";; + (--hardware-shani) HARDWARE_SHANI="yes";; + (--hardware-sha512) HARDWARE_SHA512="yes";; + (--hardware-sse41) HARDWARE_SSE41="yes";; + (--hardware-aesni) HARDWARE_AESNI="yes";; + (--hardware-vaes) HARDWARE_VAES="yes";; (--build-preset=*) BUILD_PRESET="${OPTION#*=}";; (--build-src-dir=*) BUILD_SRC_DIR="${OPTION#*=}";; (--build-limit=*) BUILD_LIMIT="${OPTION#*=}";; @@ -148,6 +179,18 @@ main() CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--verbose/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--help/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#-h/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-aes/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sha2/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sha3/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avx2/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avx512/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avx512ifma/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avxifma/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-shani/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sha512/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sse41/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-aesni/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-vaes/}") CONFIGURE_OPTIONS_CMAKE=("${CONFIGURE_OPTIONS[@]}") msg_verbose "*** ARGUMENTS: ${CONFIGURE_OPTIONS_ORIGINAL[*]}" msg_verbose "*** SANITIZED: ${CONFIGURE_OPTIONS[*]}" @@ -425,6 +468,99 @@ main() ARCHTUNE="-march=native -mtune=native" fi + # Platform options: arm64 + + if [[ "${HARDWARE_AES}" == "yes" ]]; then + HARDWARE_PLATFORM_ARM64="yes" + ARCHBASE="armv8-a" + ARCHSUFFIX="${ARCHSUFFIX}+aes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-aes=ON" ) + fi + + if [[ "${HARDWARE_SHA2}" == "yes" ]]; then + HARDWARE_PLATFORM_ARM64="yes" + ARCHBASE="armv8-a" + ARCHSUFFIX="${ARCHSUFFIX}+sha2" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-sha2=ON" ) + fi + + if [[ "${HARDWARE_SHA3}" == "yes" ]]; then + HARDWARE_PLATFORM_ARM64="yes" + ARCHBASE="armv8.2-a" + ARCHSUFFIX="${ARCHSUFFIX}+sha3" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-sha3=ON" ) + fi + + if [[ ${HARDWARE_PLATFORM_ARM64} == "yes" ]]; then + ARCHTUNE="${ARCHBASE}${ARCHSUFFIX}" + fi + + # Platform options: x64 + + if [[ "${HARDWARE_AVX2}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-avx2=ON" ) + fi + + if [[ "${HARDWARE_AVX512}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-avx512=ON" ) + fi + + if [[ "${HARDWARE_AVX512IFMA}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-avx512ifma=ON" ) + fi + + if [[ "${HARDWARE_AVXIFMA}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-avxifma=ON" ) + fi + + if [[ "${HARDWARE_SHANI}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-shani=ON" ) + fi + + if [[ "${HARDWARE_SHA512}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-sha512=ON" ) + fi + + if [[ "${HARDWARE_SSE41}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-sse41=ON" ) + fi + + if [[ "${HARDWARE_AESNI}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-aesni=ON" ) + fi + + if [[ "${HARDWARE_VAES}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "-Denable-vaes=ON" ) + fi + + HARDWARE_PLATFORM_COUNT=0 + if [[ ${HARDWARE_PLATFORM_ARM64} == "yes" ]]; then + HARDWARE_PLATFORM_COUNT=$((HARDWARE_PLATFORM_COUNT + 1)) + fi + if [[ ${HARDWARE_PLATFORM_X64} == "yes" ]]; then + HARDWARE_PLATFORM_COUNT=$((HARDWARE_PLATFORM_COUNT + 1)) + fi + + if [ ${HARDWARE_PLATFORM_COUNT} -gt 1 ]; then + msg_error "Hardware options spanning more than one platform have been specified." + exit 1 + fi + + if [[ "${HARDWARE_OPTIMIZED}" == "yes" ]] && + [ ${HARDWARE_PLATFORM_COUNT} -gt 0 ]; then + msg_error "Hardware optimization cannot be reliably rationalized with hardware platform options." + exit 1 + fi + # Specify cmake build if [[ "${BUILD_CONFIG}" == "debug" ]]; then @@ -958,36 +1094,7 @@ help() msg "Script managing the build and installation of libbitcoin-node and its dependencies." msg "" msg "Script options:" - msg "-Denable-shani= Use Intel SHA Extensions." - msg " Default: OFF" - msg "-Denable-sha512= Use Intel SHA512 Extensions (implies AVX2)." - msg " Default: OFF" - msg "-Denable-aesni= Use Intel AES-NI and PCLMULQDQ intrinsics." - msg " Default: OFF" - msg "-Denable-vaes= Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2)." - msg " Default: OFF" - msg "-Denable-avx512ifma= Use Intel AVX512 IFMA intrinsics (implies AVX512VL)." - msg " Default: OFF" - msg "-Denable-avx512= Use Intel AVX512 intrinsics." - msg " Default: OFF" - msg "-Denable-avxifma= Use Intel AVX IFMA intrinsics (implies AVX2)." - msg " Default: OFF" - msg "-Denable-avx2= Use Intel AVX2 intrinsics." - msg " Default: OFF" - msg "-Denable-sse41= Use SSE4.1 hardware instructions." - msg " Default: OFF" - msg "-Denable-sha2= Use ARM SHA1/SHA256 Extensions." - msg " Default: OFF" - msg "-Denable-sha3= Use ARM SHA3 Extensions for SHA512." - msg " Default: OFF" - msg "-Denable-aes= Use ARM AES and PMULL Extensions." - msg " Default: OFF" - msg "-Dwith-secp256k1= Use bitcoin-core/secp256k1 library." - msg " Default: OFF" - msg "-Dwith-valgrind= Use valgrind memcheck client requests." - msg " Default: OFF" - msg "-Denable-cuda= Use cuda (gpu) batch signature verification (inert on macOS)." - msg " Default: ON" + msg "--build-secp256k1 Build libsecp256k1 libraries" msg "--build-preset= Specifies preset configuration to build." msg "--build-src-dir= Location for sources." @@ -1008,6 +1115,54 @@ help() msg "--verbose Display verbose script output." msg "--help, -h Display usage, overriding script execution." msg "" + msg "Hardware configuration options for arm64:" + msg "--hardware-aes Use ARM AES and PMULL Extensions." + msg "--hardware-sha2 Use ARM SHA1/SHA256 Extensions." + msg "--hardware-sha3 Use ARM SHA3 Extensions for SHA512." + msg "" + msg "Hardware configuration options for x64:" + msg "--hardware-avx2 Use Intel AVX2 intrinsics." + msg "--hardware-avx512 Use Intel AVX512 intrinsics." + msg "--hardware-avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL)." + msg "--hardware-avxifma Use Intel AVX IFMA intrinsics (implies AVX2)." + msg "--hardware-shani Use Intel SHA Extensions." + msg "--hardware-sha512 Use Intel SHA512 Extensions (implies AVX2)." + msg "--hardware-sse41 Use SSE4.1 hardware instructions." + msg "--hardware-aesni Use Intel AES-NI and PCLMULQDQ intrinsics." + msg "--hardware-vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2)." + msg "" + msg "Recognized pass-through options:" + msg "-Denable-shani= Add Intel SHA Extensions via compilation options." + msg " Default: OFF" + msg "-Denable-sha512= Add Intel SHA512 Extensions (implies AVX2) via compilation options." + msg " Default: OFF" + msg "-Denable-aesni= Add Intel AES-NI and PCLMULQDQ intrinsics via compilation options." + msg " Default: OFF" + msg "-Denable-vaes= Add Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2) via compilation options." + msg " Default: OFF" + msg "-Denable-avx512ifma= Add Intel AVX512 IFMA intrinsics (implies AVX512VL) via compilation options." + msg " Default: OFF" + msg "-Denable-avx512= Add Intel AVX512 intrinsics via compilation options." + msg " Default: OFF" + msg "-Denable-avxifma= Add Intel AVX IFMA intrinsics (implies AVX2) via compilation options." + msg " Default: OFF" + msg "-Denable-avx2= Add Intel AVX2 intrinsics via compilation options." + msg " Default: OFF" + msg "-Denable-sse41= Add SSE4.1 hardware instructions via compilation options." + msg " Default: OFF" + msg "-Denable-sha2= Check for ARM SHA1/SHA256 Extensions." + msg " Default: OFF" + msg "-Denable-sha3= Check for ARM SHA3 Extensions for SHA512." + msg " Default: OFF" + msg "-Denable-aes= Check for ARM AES and PMULL Extensions." + msg " Default: OFF" + msg "-Dwith-secp256k1= Use bitcoin-core/secp256k1 library." + msg " Default: OFF" + msg "-Dwith-valgrind= Use valgrind memcheck client requests." + msg " Default: OFF" + msg "-Dwith-cuda= Use cuda (gpu) batch signature verification (inert on macOS)." + msg " Default: ON" + msg "" msg "All unrecognized options provided shall be passed as configuration" msg "options for all dependencies." } diff --git a/builds/gnu/install-gnu.sh b/builds/gnu/install-gnu.sh index 93868791d..540d56626 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -8,36 +8,7 @@ # Script managing the build and installation of libbitcoin-node and its dependencies. # # Script options: -# ---shani Use Intel SHA Extensions. -# Default: --disable-shani -# ---sha512 Use Intel SHA512 Extensions (implies AVX2). -# Default: --disable-sha512 -# ---aesni Use Intel AES-NI and PCLMULQDQ intrinsics. -# Default: --disable-aesni -# ---vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2). -# Default: --disable-vaes -# ---avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL). -# Default: --disable-avx512ifma -# ---avx512 Use Intel AVX512 intrinsics. -# Default: --disable-avx512 -# ---avxifma Use Intel AVX IFMA intrinsics (implies AVX2). -# Default: --disable-avxifma -# ---avx2 Use Intel AVX2 intrinsics. -# Default: --disable-avx2 -# ---sse41 Use SSE4.1 hardware instructions. -# Default: --disable-sse41 -# ---sha2 Use ARM SHA1/SHA256 Extensions. -# Default: --disable-sha2 -# ---sha3 Use ARM SHA3 Extensions for SHA512. -# Default: --disable-sha3 -# ---aes Use ARM AES and PMULL Extensions. -# Default: --disable-aes -# ---secp256k1 Use bitcoin-core/secp256k1 library. -# Default: --without-secp256k1 -# ---valgrind Use valgrind memcheck client requests. -# Default: --without-valgrind -# ---cuda Use cuda (gpu) batch signature verification (inert on macOS). -# Default: --enable-cuda + # --build-secp256k1 Build libsecp256k1 libraries # --build-src-dir= Location for sources. # Default: $(pwd) @@ -69,6 +40,54 @@ # --verbose Display verbose script output. # --help, -h Display usage, overriding script execution. # +# Hardware configuration options for arm64: +# --hardware-aes Use ARM AES and PMULL Extensions. +# --hardware-sha2 Use ARM SHA1/SHA256 Extensions. +# --hardware-sha3 Use ARM SHA3 Extensions for SHA512. +# +# Hardware configuration options for x64: +# --hardware-avx2 Use Intel AVX2 intrinsics. +# --hardware-avx512 Use Intel AVX512 intrinsics. +# --hardware-avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL). +# --hardware-avxifma Use Intel AVX IFMA intrinsics (implies AVX2). +# --hardware-shani Use Intel SHA Extensions. +# --hardware-sha512 Use Intel SHA512 Extensions (implies AVX2). +# --hardware-sse41 Use SSE4.1 hardware instructions. +# --hardware-aesni Use Intel AES-NI and PCLMULQDQ intrinsics. +# --hardware-vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2). +# +# Recognized pass-through options: +# ---shani Add Intel SHA Extensions via compilation options. +# Default: --disable-shani +# ---sha512 Add Intel SHA512 Extensions (implies AVX2) via compilation options. +# Default: --disable-sha512 +# ---aesni Add Intel AES-NI and PCLMULQDQ intrinsics via compilation options. +# Default: --disable-aesni +# ---vaes Add Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2) via compilation options. +# Default: --disable-vaes +# ---avx512ifma Add Intel AVX512 IFMA intrinsics (implies AVX512VL) via compilation options. +# Default: --disable-avx512ifma +# ---avx512 Add Intel AVX512 intrinsics via compilation options. +# Default: --disable-avx512 +# ---avxifma Add Intel AVX IFMA intrinsics (implies AVX2) via compilation options. +# Default: --disable-avxifma +# ---avx2 Add Intel AVX2 intrinsics via compilation options. +# Default: --disable-avx2 +# ---sse41 Add SSE4.1 hardware instructions via compilation options. +# Default: --disable-sse41 +# ---sha2 Check for ARM SHA1/SHA256 Extensions. +# Default: --disable-sha2 +# ---sha3 Check for ARM SHA3 Extensions for SHA512. +# Default: --disable-sha3 +# ---aes Check for ARM AES and PMULL Extensions. +# Default: --disable-aes +# ---secp256k1 Use bitcoin-core/secp256k1 library. +# Default: --without-secp256k1 +# ---valgrind Use valgrind memcheck client requests. +# Default: --without-valgrind +# ---cuda Use cuda (gpu) batch signature verification (inert on macOS). +# Default: --with-cuda +# # All unrecognized options provided shall be passed as configuration # options for all dependencies. @@ -122,6 +141,18 @@ main() for OPTION in "$@"; do case ${OPTION} in (--build-secp256k1) BUILD_secp256k1="yes";; + (--hardware-aes) HARDWARE_AES="yes";; + (--hardware-sha2) HARDWARE_SHA2="yes";; + (--hardware-sha3) HARDWARE_SHA3="yes";; + (--hardware-avx2) HARDWARE_AVX2="yes";; + (--hardware-avx512) HARDWARE_AVX512="yes";; + (--hardware-avx512ifma) HARDWARE_AVX512IFMA="yes";; + (--hardware-avxifma) HARDWARE_AVXIFMA="yes";; + (--hardware-shani) HARDWARE_SHANI="yes";; + (--hardware-sha512) HARDWARE_SHA512="yes";; + (--hardware-sse41) HARDWARE_SSE41="yes";; + (--hardware-aesni) HARDWARE_AESNI="yes";; + (--hardware-vaes) HARDWARE_VAES="yes";; (--build-src-dir=*) BUILD_SRC_DIR="${OPTION#*=}";; (--build-obj-dir=*) BUILD_OBJ_DIR="${OPTION#*=}";; (--build-obj-dir-relative) BUILD_OBJ_DIR_RELATIVE="yes";; @@ -165,6 +196,18 @@ main() CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--verbose/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--help/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#-h/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-aes/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sha2/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sha3/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avx2/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avx512/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avx512ifma/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-avxifma/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-shani/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sha512/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-sse41/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-aesni/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/#--hardware-vaes/}") CONFIGURE_OPTIONS_CMAKE=() CONFIGURE_OPTIONS_GNU=("${CONFIGURE_OPTIONS[@]}") msg_verbose "*** ARGUMENTS: ${CONFIGURE_OPTIONS_ORIGINAL[*]}" @@ -398,6 +441,111 @@ main() ARCHTUNE="-march=native -mtune=native" fi + # Platform options: arm64 + + if [[ "${HARDWARE_AES}" == "yes" ]]; then + HARDWARE_PLATFORM_ARM64="yes" + ARCHBASE="armv8-a" + ARCHSUFFIX="${ARCHSUFFIX}+aes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-aes" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-aes" ) + fi + + if [[ "${HARDWARE_SHA2}" == "yes" ]]; then + HARDWARE_PLATFORM_ARM64="yes" + ARCHBASE="armv8-a" + ARCHSUFFIX="${ARCHSUFFIX}+sha2" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-sha2" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-sha2" ) + fi + + if [[ "${HARDWARE_SHA3}" == "yes" ]]; then + HARDWARE_PLATFORM_ARM64="yes" + ARCHBASE="armv8.2-a" + ARCHSUFFIX="${ARCHSUFFIX}+sha3" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-sha3" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-sha3" ) + fi + + if [[ ${HARDWARE_PLATFORM_ARM64} == "yes" ]]; then + ARCHTUNE="${ARCHBASE}${ARCHSUFFIX}" + fi + + # Platform options: x64 + + if [[ "${HARDWARE_AVX2}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-avx2" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-avx2" ) + fi + + if [[ "${HARDWARE_AVX512}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-avx512" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-avx512" ) + fi + + if [[ "${HARDWARE_AVX512IFMA}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-avx512ifma" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-avx512ifma" ) + fi + + if [[ "${HARDWARE_AVXIFMA}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-avxifma" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-avxifma" ) + fi + + if [[ "${HARDWARE_SHANI}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-shani" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-shani" ) + fi + + if [[ "${HARDWARE_SHA512}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-sha512" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-sha512" ) + fi + + if [[ "${HARDWARE_SSE41}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-sse41" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-sse41" ) + fi + + if [[ "${HARDWARE_AESNI}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-aesni" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-aesni" ) + fi + + if [[ "${HARDWARE_VAES}" == "yes" ]]; then + HARDWARE_PLATFORM_X64="yes" + CONFIGURE_OPTIONS_CMAKE=( "${CONFIGURE_OPTIONS_CMAKE[@]}" "--enable-vaes" ) + CONFIGURE_OPTIONS_GNU=( "${CONFIGURE_OPTIONS_GNU[@]}" "--enable-vaes" ) + fi + + HARDWARE_PLATFORM_COUNT=0 + if [[ ${HARDWARE_PLATFORM_ARM64} == "yes" ]]; then + HARDWARE_PLATFORM_COUNT=$((HARDWARE_PLATFORM_COUNT + 1)) + fi + if [[ ${HARDWARE_PLATFORM_X64} == "yes" ]]; then + HARDWARE_PLATFORM_COUNT=$((HARDWARE_PLATFORM_COUNT + 1)) + fi + + if [ ${HARDWARE_PLATFORM_COUNT} -gt 1 ]; then + msg_error "Hardware options spanning more than one platform have been specified." + exit 1 + fi + + if [[ "${HARDWARE_OPTIMIZED}" == "yes" ]] && + [ ${HARDWARE_PLATFORM_COUNT} -gt 0 ]; then + msg_error "Hardware optimization cannot be reliably rationalized with hardware platform options." + exit 1 + fi + # translate BUILD_CONFIG to ZFLAGS if [[ -n "${BUILD_CONFIG}" ]]; then msg_verbose "*** Build config specified, calculating flags..." @@ -954,36 +1102,7 @@ help() msg "Script managing the build and installation of libbitcoin-node and its dependencies." msg "" msg "Script options:" - msg "---shani Use Intel SHA Extensions." - msg " Default: --disable-shani" - msg "---sha512 Use Intel SHA512 Extensions (implies AVX2)." - msg " Default: --disable-sha512" - msg "---aesni Use Intel AES-NI and PCLMULQDQ intrinsics." - msg " Default: --disable-aesni" - msg "---vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2)." - msg " Default: --disable-vaes" - msg "---avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL)." - msg " Default: --disable-avx512ifma" - msg "---avx512 Use Intel AVX512 intrinsics." - msg " Default: --disable-avx512" - msg "---avxifma Use Intel AVX IFMA intrinsics (implies AVX2)." - msg " Default: --disable-avxifma" - msg "---avx2 Use Intel AVX2 intrinsics." - msg " Default: --disable-avx2" - msg "---sse41 Use SSE4.1 hardware instructions." - msg " Default: --disable-sse41" - msg "---sha2 Use ARM SHA1/SHA256 Extensions." - msg " Default: --disable-sha2" - msg "---sha3 Use ARM SHA3 Extensions for SHA512." - msg " Default: --disable-sha3" - msg "---aes Use ARM AES and PMULL Extensions." - msg " Default: --disable-aes" - msg "---secp256k1 Use bitcoin-core/secp256k1 library." - msg " Default: --without-secp256k1" - msg "---valgrind Use valgrind memcheck client requests." - msg " Default: --without-valgrind" - msg "---cuda Use cuda (gpu) batch signature verification (inert on macOS)." - msg " Default: --enable-cuda" + msg "--build-secp256k1 Build libsecp256k1 libraries" msg "--build-src-dir= Location for sources." msg " Default: $(pwd)" @@ -1015,6 +1134,54 @@ help() msg "--verbose Display verbose script output." msg "--help, -h Display usage, overriding script execution." msg "" + msg "Hardware configuration options for arm64:" + msg "--hardware-aes Use ARM AES and PMULL Extensions." + msg "--hardware-sha2 Use ARM SHA1/SHA256 Extensions." + msg "--hardware-sha3 Use ARM SHA3 Extensions for SHA512." + msg "" + msg "Hardware configuration options for x64:" + msg "--hardware-avx2 Use Intel AVX2 intrinsics." + msg "--hardware-avx512 Use Intel AVX512 intrinsics." + msg "--hardware-avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL)." + msg "--hardware-avxifma Use Intel AVX IFMA intrinsics (implies AVX2)." + msg "--hardware-shani Use Intel SHA Extensions." + msg "--hardware-sha512 Use Intel SHA512 Extensions (implies AVX2)." + msg "--hardware-sse41 Use SSE4.1 hardware instructions." + msg "--hardware-aesni Use Intel AES-NI and PCLMULQDQ intrinsics." + msg "--hardware-vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2)." + msg "" + msg "Recognized pass-through options:" + msg "---shani Add Intel SHA Extensions via compilation options." + msg " Default: --disable-shani" + msg "---sha512 Add Intel SHA512 Extensions (implies AVX2) via compilation options." + msg " Default: --disable-sha512" + msg "---aesni Add Intel AES-NI and PCLMULQDQ intrinsics via compilation options." + msg " Default: --disable-aesni" + msg "---vaes Add Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2) via compilation options." + msg " Default: --disable-vaes" + msg "---avx512ifma Add Intel AVX512 IFMA intrinsics (implies AVX512VL) via compilation options." + msg " Default: --disable-avx512ifma" + msg "---avx512 Add Intel AVX512 intrinsics via compilation options." + msg " Default: --disable-avx512" + msg "---avxifma Add Intel AVX IFMA intrinsics (implies AVX2) via compilation options." + msg " Default: --disable-avxifma" + msg "---avx2 Add Intel AVX2 intrinsics via compilation options." + msg " Default: --disable-avx2" + msg "---sse41 Add SSE4.1 hardware instructions via compilation options." + msg " Default: --disable-sse41" + msg "---sha2 Check for ARM SHA1/SHA256 Extensions." + msg " Default: --disable-sha2" + msg "---sha3 Check for ARM SHA3 Extensions for SHA512." + msg " Default: --disable-sha3" + msg "---aes Check for ARM AES and PMULL Extensions." + msg " Default: --disable-aes" + msg "---secp256k1 Use bitcoin-core/secp256k1 library." + msg " Default: --without-secp256k1" + msg "---valgrind Use valgrind memcheck client requests." + msg " Default: --without-valgrind" + msg "---cuda Use cuda (gpu) batch signature verification (inert on macOS)." + msg " Default: --with-cuda" + msg "" msg "All unrecognized options provided shall be passed as configuration" msg "options for all dependencies." } diff --git a/builds/msvc/build-msvc.cmd b/builds/msvc/build-msvc.cmd index 4cd8b2e48..590019909 100644 --- a/builds/msvc/build-msvc.cmd +++ b/builds/msvc/build-msvc.cmd @@ -11,19 +11,19 @@ REM ########################################################################### REM Script managing the build of libbitcoin-node. REM REM Script options: -REM --enable-shani Use Intel SHA Extensions. -REM --enable-sha512 Use Intel SHA512 Extensions (implies AVX2). -REM --enable-aesni Use Intel AES-NI and PCLMULQDQ intrinsics. -REM --enable-vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2). -REM --enable-avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL). -REM --enable-avx512 Use Intel AVX512 intrinsics. -REM --enable-avxifma Use Intel AVX IFMA intrinsics (implies AVX2). -REM --enable-avx2 Use Intel AVX2 intrinsics. -REM --enable-sse41 Use SSE4.1 hardware instructions. -REM --enable-sha2 Use ARM SHA1/SHA256 Extensions. -REM --enable-sha3 Use ARM SHA3 Extensions for SHA512. -REM --enable-aes Use ARM AES and PMULL Extensions. -REM --[enable/disable]-cuda Use cuda (gpu) batch signature verification (inert on macOS). +REM --enable-shani Add Intel SHA Extensions via compilation options. +REM --enable-sha512 Add Intel SHA512 Extensions (implies AVX2) via compilation options. +REM --enable-aesni Add Intel AES-NI and PCLMULQDQ intrinsics via compilation options. +REM --enable-vaes Add Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2) via compilation options. +REM --enable-avx512ifma Add Intel AVX512 IFMA intrinsics (implies AVX512VL) via compilation options. +REM --enable-avx512 Add Intel AVX512 intrinsics via compilation options. +REM --enable-avxifma Add Intel AVX IFMA intrinsics (implies AVX2) via compilation options. +REM --enable-avx2 Add Intel AVX2 intrinsics via compilation options. +REM --enable-sse41 Add SSE4.1 hardware instructions via compilation options. +REM --enable-sha2 Check for ARM SHA1/SHA256 Extensions. +REM --enable-sha3 Check for ARM SHA3 Extensions for SHA512. +REM --enable-aes Check for ARM AES and PMULL Extensions. +REM --[with/without]-cuda Use cuda (gpu) batch signature verification (inert on macOS). REM --build-config config Build configuration. REM --build-platform platform Build platform. REM --build-version version Build MSVC version. @@ -330,13 +330,13 @@ if "!libbitcoin_node_TAG!" == "" ( ) else ( set "libbitcoin-system_PARAMS=!libbitcoin-system_PARAMS! /p:Option-aes=true" ) - ) else if "%~1" == "--enable-cuda" ( + ) else if "%~1" == "--with-cuda" ( if "!libbitcoin-system_PARAMS!" == "" ( set "libbitcoin-system_PARAMS=/p:Option-cuda=true" ) else ( set "libbitcoin-system_PARAMS=!libbitcoin-system_PARAMS! /p:Option-cuda=true" ) - ) else if "%~1" == "--disable-cuda" ( + ) else if "%~1" == "--without-cuda" ( if "!libbitcoin-system_PARAMS!" == "" ( set "libbitcoin-system_PARAMS=/p:Option-cuda=false" ) else ( @@ -594,19 +594,19 @@ if "!libbitcoin_node_TAG!" == "" ( call :msg "Script managing the build of libbitcoin-node." call :msg "" call :msg "Script options:" - call :msg "--enable-shani Use Intel SHA Extensions." - call :msg "--enable-sha512 Use Intel SHA512 Extensions (implies AVX2)." - call :msg "--enable-aesni Use Intel AES-NI and PCLMULQDQ intrinsics." - call :msg "--enable-vaes Use Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2)." - call :msg "--enable-avx512ifma Use Intel AVX512 IFMA intrinsics (implies AVX512VL)." - call :msg "--enable-avx512 Use Intel AVX512 intrinsics." - call :msg "--enable-avxifma Use Intel AVX IFMA intrinsics (implies AVX2)." - call :msg "--enable-avx2 Use Intel AVX2 intrinsics." - call :msg "--enable-sse41 Use SSE4.1 hardware instructions." - call :msg "--enable-sha2 Use ARM SHA1/SHA256 Extensions." - call :msg "--enable-sha3 Use ARM SHA3 Extensions for SHA512." - call :msg "--enable-aes Use ARM AES and PMULL Extensions." - call :msg "--[enable/disable]-cuda Use cuda (gpu) batch signature verification (inert on macOS)." + call :msg "--enable-shani Add Intel SHA Extensions via compilation options." + call :msg "--enable-sha512 Add Intel SHA512 Extensions (implies AVX2) via compilation options." + call :msg "--enable-aesni Add Intel AES-NI and PCLMULQDQ intrinsics via compilation options." + call :msg "--enable-vaes Add Intel VAES and VPCLMULQDQ intrinsics (implies AES-NI and AVX2) via compilation options." + call :msg "--enable-avx512ifma Add Intel AVX512 IFMA intrinsics (implies AVX512VL) via compilation options." + call :msg "--enable-avx512 Add Intel AVX512 intrinsics via compilation options." + call :msg "--enable-avxifma Add Intel AVX IFMA intrinsics (implies AVX2) via compilation options." + call :msg "--enable-avx2 Add Intel AVX2 intrinsics via compilation options." + call :msg "--enable-sse41 Add SSE4.1 hardware instructions via compilation options." + call :msg "--enable-sha2 Check for ARM SHA1/SHA256 Extensions." + call :msg "--enable-sha3 Check for ARM SHA3 Extensions for SHA512." + call :msg "--enable-aes Check for ARM AES and PMULL Extensions." + call :msg "--[with/without]-cuda Use cuda (gpu) batch signature verification (inert on macOS)." call :msg "--build-config config Build configuration." call :msg "--build-platform platform Build platform." call :msg "--build-version version Build MSVC version."