-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- `FindSSE.cmake` module that checks for availability of various SSE-related compiler flags. - Bug fixes in `base64.hpp` to account for the difference between char and signed char on some platforms, e.g., arm64. - Use GCC-8 specific version of `VAST_DISCARD_ARGS` for all GCC versions; the same issues occured for GCC-10.
- Loading branch information
1 parent
115eba2
commit 5774abd
Showing
5 changed files
with
213 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VAST now supports the arm64 architecture. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
# Check if SSE instructions are available on the machine where the project is | ||
# compiled. This file is assembled from many posts in the CMake issue tracker | ||
# at https://gitlab.kitware.com/cmake/cmake/-/issues. | ||
|
||
include(CheckCXXCompilerFlag) | ||
|
||
set(_CMAKE_REQUIRED_QUIET_OLD "${CMAKE_REQUIRED_QUIET}") | ||
set(CMAKE_REQUIRED_QUIET "${SSE_FIND_QUIETLY}") | ||
|
||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND (CPU MATCHES "x86_64" OR CPU MATCHES | ||
"i.86")) | ||
exec_program( | ||
cat ARGS | ||
"/proc/cpuinfo" | ||
OUTPUT_VARIABLE CPUINFO) | ||
|
||
string(REGEX REPLACE "^.*(sse).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "sse" "${_SSE_THERE}" _SSE_TRUE) | ||
check_cxx_compiler_flag("-msse" _SSE_OK) | ||
|
||
string(REGEX REPLACE "^.*(sse2).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "sse2" "${_SSE_THERE}" _SSE2_TRUE) | ||
check_cxx_compiler_flag("-msse2" _SSE2_OK) | ||
|
||
string(REGEX REPLACE "^.*(pni).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "pni" "${_SSE_THERE}" _SSE3_TRUE) | ||
check_cxx_compiler_flag("-msse3" _SSE3_OK) | ||
|
||
string(REGEX REPLACE "^.*(ssse3).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "ssse3" "${_SSE_THERE}" _SSSE3_TRUE) | ||
check_cxx_compiler_flag("-mssse3" _SSSE3_OK) | ||
|
||
string(REGEX REPLACE "^.*(sse4_1).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "sse4_1" "${_SSE_THERE}" _SSE41_TRUE) | ||
check_cxx_compiler_flag("-msse4.1" _SSE41_OK) | ||
|
||
string(REGEX REPLACE "^.*(sse4_2).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "sse4_2" "${_SSE_THERE}" _SSE42_TRUE) | ||
check_cxx_compiler_flag("-msse4.2" _SSE42_OK) | ||
|
||
string(REGEX REPLACE "^.*(avx).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "avx" "${_SSE_THERE}" _AVX_TRUE) | ||
check_cxx_compiler_flag("-mavx" _AVX_OK) | ||
|
||
string(REGEX REPLACE "^.*(avx2).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "avx2" "${_SSE_THERE}" _AVX2_TRUE) | ||
check_cxx_compiler_flag("-mavx2" _AVX2_OK) | ||
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" AND (CPU MATCHES "amd64" | ||
OR CPU MATCHES "i.86")) | ||
exec_program( | ||
cat ARGS | ||
"/var/run/dmesg.boot | grep Features" | ||
OUTPUT_VARIABLE CPUINFO) | ||
|
||
string(REGEX REPLACE "^.*(SSE).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE" "${_SSE_THERE}" _SSE_TRUE) | ||
check_cxx_compiler_flag("-msse" _SSE_OK) | ||
|
||
string(REGEX REPLACE "^.*(SSE2).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE2" "${_SSE_THERE}" _SSE2_TRUE) | ||
check_cxx_compiler_flag("-msse2" _SSE2_OK) | ||
|
||
string(REGEX REPLACE "^.*(SSE3).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE3" "${_SSE_THERE}" _SSE3_TRUE) | ||
check_cxx_compiler_flag("-msse3" _SSE3_OK) | ||
|
||
string(REGEX REPLACE "^.*(SSSE3).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSSE3" "${_SSE_THERE}" _SSSE3_TRUE) | ||
check_cxx_compiler_flag("-mssse3" _SSSE3_OK) | ||
|
||
string(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE4.1" "${_SSE_THERE}" _SSE41_TRUE) | ||
check_cxx_compiler_flag("-msse4.1" _SSE41_OK) | ||
string(REGEX REPLACE "^.*(SSE4.2).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE4.2" "${_SSE_THERE}" _SSE42_TRUE) | ||
check_cxx_compiler_flag("-msse4.2" _SSE42_OK) | ||
|
||
string(REGEX REPLACE "^.*(AVX).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "AVX" "${_SSE_THERE}" _AVX_TRUE) | ||
check_cxx_compiler_flag("-mavx" _AVX_OK) | ||
|
||
string(REGEX REPLACE "^.*(AVX2).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "AVX2" "${_SSE_THERE}" _AVX2_TRUE) | ||
check_cxx_compiler_flag("-mavx2" _AVX2_OK) | ||
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin" AND NOT CPU MATCHES "arm") | ||
exec_program( | ||
"/usr/sbin/sysctl -n machdep.cpu.features machdep.cpu.leaf7_features" | ||
OUTPUT_VARIABLE CPUINFO) | ||
|
||
string(REGEX REPLACE "^.*[^S](SSE).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE" "${_SSE_THERE}" _SSE_TRUE) | ||
check_cxx_compiler_flag("-msse" _SSE_OK) | ||
|
||
string(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE2" "${_SSE_THERE}" _SSE2_TRUE) | ||
check_cxx_compiler_flag("-msse2" _SSE2_OK) | ||
|
||
string(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE3" "${_SSE_THERE}" _SSE3_TRUE) | ||
check_cxx_compiler_flag("-msse3" _SSE3_OK) | ||
|
||
string(REGEX REPLACE "^.*(SSSE3).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSSE3" "${_SSE_THERE}" _SSSE3_TRUE) | ||
check_cxx_compiler_flag("-mssse3" _SSSE3_OK) | ||
|
||
string(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE4.1" "${_SSE_THERE}" _SSE41_TRUE) | ||
check_cxx_compiler_flag("-msse4.1" _SSE41_OK) | ||
|
||
string(REGEX REPLACE "^.*(SSE4.2).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "SSE4.2" "${_SSE_THERE}" _SSE42_TRUE) | ||
check_cxx_compiler_flag("-msse4.2" _SSE42_OK) | ||
|
||
string(REGEX REPLACE "^.*(AVX).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "AVX" "${_SSE_THERE}" _AVX_TRUE) | ||
check_cxx_compiler_flag("-mavx" _AVX_OK) | ||
|
||
string(REGEX REPLACE "^.*(AVX2).*$" "\\1" _SSE_THERE ${CPUINFO}) | ||
string(COMPARE EQUAL "AVX2" "${_SSE_THERE}" _AVX2_TRUE) | ||
check_cxx_compiler_flag("-mavx2" _AVX2_OK) | ||
else () | ||
message(WARNING "FindSSE does not support ${CPU} on ${CMAKE_SYSTEM_NAME}.") | ||
endif () | ||
|
||
set(CMAKE_REQUIRED_QUIET "${_CMAKE_REQUIRED_QUIET_OLD}") | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
SSE | ||
REQUIRED_VARS _SSE_TRUE _SSE_OK | ||
FAIL_MESSAGE "Failed to find hardware support for SSE") | ||
set(FPHSA_NAME_MISMATCHED ON) | ||
find_package_handle_standard_args( | ||
SSE2 | ||
REQUIRED_VARS _SSE2_TRUE _SSE2_OK | ||
FAIL_MESSAGE "Failed to find hardware support for SSE2") | ||
find_package_handle_standard_args( | ||
SSE3 | ||
REQUIRED_VARS _SSE3_TRUE _SSE3_OK | ||
FAIL_MESSAGE "Failed to find hardware support for SSE3") | ||
find_package_handle_standard_args( | ||
SSSE3 | ||
REQUIRED_VARS _SSSE3_TRUE _SSSE3_OK | ||
FAIL_MESSAGE "Failed to find hardware support for SSSE3") | ||
find_package_handle_standard_args( | ||
SSE4_1 | ||
REQUIRED_VARS _SSE41_TRUE _SSE41_OK | ||
FAIL_MESSAGE "Failed to find hardware support for SSE4.1") | ||
find_package_handle_standard_args( | ||
SSE4_2 | ||
REQUIRED_VARS _SSE42_TRUE _SSE42_OK | ||
FAIL_MESSAGE "Failed to find hardware support for SSE4.2") | ||
find_package_handle_standard_args( | ||
AVX | ||
REQUIRED_VARS _AVX_TRUE _AVX_OK | ||
FAIL_MESSAGE "Failed to find hardware support for AVX") | ||
find_package_handle_standard_args( | ||
AVX2 | ||
REQUIRED_VARS _AVX2_TRUE _AVX2_OK | ||
FAIL_MESSAGE "Failed to find hardware support for AVX2") | ||
unset(FPHSA_NAME_MISMATCHED) | ||
|
||
mark_as_advanced( | ||
SSE2_FOUND | ||
SSE3_FOUND | ||
SSSE3_FOUND | ||
SSE4_1_FOUND | ||
SSE4_2_FOUND | ||
AVX_FOUND | ||
AVX2_FOUND) | ||
|
||
unset(_SSE_THERE) | ||
unset(_SSE_TRUE) | ||
unset(_SSE_OK) | ||
unset(_SSE_OK CACHE) | ||
unset(_SSE2_TRUE) | ||
unset(_SSE2_OK) | ||
unset(_SSE2_OK CACHE) | ||
unset(_SSE3_TRUE) | ||
unset(_SSE3_OK) | ||
unset(_SSE3_OK CACHE) | ||
unset(_SSSE3_TRUE) | ||
unset(_SSSE3_OK) | ||
unset(_SSSE3_OK CACHE) | ||
unset(_SSE4_1_TRUE) | ||
unset(_SSE41_OK) | ||
unset(_SSE41_OK CACHE) | ||
unset(_SSE4_2_TRUE) | ||
unset(_SSE42_OK) | ||
unset(_SSE42_OK CACHE) | ||
unset(_AVX_TRUE) | ||
unset(_AVX_OK) | ||
unset(_AVX_OK CACHE) | ||
unset(_AVX2_TRUE) | ||
unset(_AVX2_OK) | ||
unset(_AVX2_OK CACHE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters