| @@ -2,13 +2,12 @@ | |||
| ## Author: Hank Anderson <hank@statease.com> | |||
| ## Description: Ported from portion of OpenBLAS/Makefile.system | |||
| ## Sets C related variables. | |||
| include(CheckCCompilerFlag) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "LSB" OR ${CMAKE_C_COMPILER_ID} MATCHES "Clang") | |||
| set(CCOMMON_OPT "${CCOMMON_OPT} -Wall") | |||
| set(COMMON_PROF "${COMMON_PROF} -fno-inline") | |||
| set(NO_UNINITIALIZED_WARN "-Wno-uninitialized") | |||
| set(GCC_VERSION ${CMAKE_C_COMPILER_VERSION}) | |||
| if (QUIET_MAKE) | |||
| set(CCOMMON_OPT "${CCOMMON_OPT} ${NO_UNINITIALIZED_WARN} -Wno-unused") | |||
| @@ -37,14 +36,14 @@ if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "LS | |||
| if (LOONGARCH64) | |||
| if (BINARY64) | |||
| CHECK_C_COMPILER_FLAG("-mabi=lp64d" COMPILER_SUPPORT_LP64D_ABI) | |||
| CHECK_CXX_COMPILER_FLAG("-mabi=lp64d" COMPILER_SUPPORT_LP64D_ABI) | |||
| if(COMPILER_SUPPORT_LP64D_ABI) | |||
| set(CCOMMON_OPT "${CCOMMON_OPT} -mabi=lp64d") | |||
| else() | |||
| set(CCOMMON_OPT "${CCOMMON_OPT} -mabi=lp64") | |||
| endif () | |||
| else () | |||
| CHECK_C_COMPILER_FLAG("-mabi=ilp32d" COMPILER_SUPPORT_ILP32D_ABI) | |||
| CHECK_CXX_COMPILER_FLAG("-mabi=ilp32d" COMPILER_SUPPORT_ILP32D_ABI) | |||
| if(COMPILER_SUPPORT_ILP32D_ABI) | |||
| set(CCOMMON_OPT "${CCOMMON_OPT} -mabi=ilp32d") | |||
| else() | |||
| @@ -140,7 +139,6 @@ endif () | |||
| if (${CORE} STREQUAL COOPERLAKE) | |||
| if (NOT DYNAMIC_ARCH) | |||
| if (NOT NO_AVX512) | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 10.1 OR ${GCC_VERSION} VERSION_EQUAL 10.1) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=cooperlake") | |||
| else () | |||
| @@ -153,7 +151,6 @@ endif () | |||
| if (${CORE} STREQUAL SAPPHIRERAPIDS) | |||
| if (NOT DYNAMIC_ARCH) | |||
| if (NOT NO_AVX512) | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 11.0 OR ${GCC_VERSION} VERSION_EQUAL 11.0) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=sapphirerapids") | |||
| else () | |||
| @@ -167,7 +164,6 @@ if (${CORE} STREQUAL ZEN) | |||
| if (HAVE_AVX512VL) | |||
| if (NOT DYNAMIC_ARCH) | |||
| if (NOT NO_AVX512) | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 13.0 OR ${GCC_VERSION} VERSION_EQUAL 13.0) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=znver4") | |||
| else () | |||
| @@ -180,7 +176,6 @@ endif () | |||
| if (${CORE} STREQUAL A64FX) | |||
| if (NOT DYNAMIC_ARCH) | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 11.0 OR ${GCC_VERSION} VERSION_EQUAL 11.0) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.2-a+sve -mtune=a64fx") | |||
| else () | |||
| @@ -194,7 +189,6 @@ if (${CORE} STREQUAL NEOVERSEN2) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -Msve_intrinsics -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | |||
| else () | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | |||
| else () | |||
| @@ -209,7 +203,6 @@ if (${CORE} STREQUAL NEOVERSEV1) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -Msve_intrinsics -march=armv8.4-a+sve -mtune=neoverse-v1") | |||
| else () | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.4-a+sve -mtune=neoverse-v1") | |||
| else () | |||
| @@ -221,7 +214,6 @@ endif () | |||
| if (${CORE} STREQUAL NEOVERSEN1) | |||
| if (NOT DYNAMIC_ARCH) | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 9.4 OR ${GCC_VERSION} VERSION_EQUAL 9.4) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.2-a+sve -mtune=neoverse-n1") | |||
| else () | |||
| @@ -266,23 +258,21 @@ endif () | |||
| if (${CORE} STREQUAL POWER10) | |||
| if (NOT DYNAMIC_ARCH) | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 10.2 OR ${GCC_VERSION} VERSION_EQUAL 10.2) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -mcpu=power10 -mtune=power10 -mvsx -fno-fast-math") | |||
| else () | |||
| message(FATAL_ERROR "Compiler GCC.${GCC_VERSION} does not support Power10." ) | |||
| message(FATAL_ERROR "Compiler GCC ${GCC_VERSION} does not support Power10." ) | |||
| endif() | |||
| endif () | |||
| endif () | |||
| if (${CORE} STREQUAL POWER9) | |||
| if (NOT DYNAMIC_ARCH) | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 5.0 OR ${GCC_VERSION} VERSION_EQUAL 5.0) | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -mcpu=power9 -mtune=power9 -mvsx -fno-fast-math") | |||
| else () | |||
| set (CCOMMON_OPT "${CCOMMON_OPT} -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math") | |||
| message(WARNING "Compiler GCC.${GCC_VERSION} does not fully support Power9.") | |||
| message(WARNING "Compiler GCC ${GCC_VERSION} does not fully support Power9.") | |||
| endif () | |||
| endif () | |||
| endif () | |||
| @@ -38,7 +38,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |||
| # Test for supporting MS_ABI | |||
| # removed string parsing in favor of CMake's version comparison -hpa | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| set(GCC_VERSION ${CMAKE_C_COMPILER_VERSION}) | |||
| if (${GCC_VERSION} VERSION_GREATER 4.7 OR ${GCC_VERSION} VERSION_EQUAL 4.7) | |||
| # GCC Version >=4.7 | |||
| # It is compatible with MSVC ABI. | |||
| @@ -160,17 +160,10 @@ else() | |||
| endif () | |||
| endif () | |||
| if (C_LAPACK) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") | |||
| set(CCOMMON_OPT "${CCOMMON_OPT} -Wno-error=incompatible-pointer-types") | |||
| endif () | |||
| endif () | |||
| include("${PROJECT_SOURCE_DIR}/cmake/prebuild.cmake") | |||
| if (DEFINED TARGET) | |||
| if (${TARGET} STREQUAL COOPERLAKE AND NOT NO_AVX512) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 10.09) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=cooperlake") | |||
| else() | |||
| @@ -186,7 +179,6 @@ if (DEFINED TARGET) | |||
| endif() | |||
| if (${TARGET} STREQUAL SAPPHIRERAPIDS AND NOT NO_AVX512) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 11.0) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=sapphirerapids") | |||
| else() | |||
| @@ -209,7 +201,6 @@ if (DEFINED TARGET) | |||
| if (((${TARGET} STREQUAL ZEN) AND HAVE_AVX512VL) AND NOT NO_AVX512) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 12.99) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=znver4") | |||
| else() | |||
| @@ -227,8 +218,7 @@ if (DEFINED TARGET) | |||
| if ((${TARGET} STREQUAL HASWELL OR (${TARGET} STREQUAL ZEN AND NOT HAVE_AVX512VL)) AND NOT NO_AVX2) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 4.7 OR ${GCC_VERSION} VERSION_EQUAL 4.7) | |||
| if (CMAKE_C_COMPILER_VERSION} VERSION_GREATER 4.7 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.7) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mavx2") | |||
| endif() | |||
| elseif (${CMAKE_C_COMPILER_ID} STREQUAL "CLANG") | |||
| @@ -267,20 +257,18 @@ if (DEFINED TARGET) | |||
| endif() | |||
| if (${TARGET} STREQUAL POWER10) | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 10.2 OR ${GCC_VERSION} VERSION_EQUAL 10.2) | |||
| if (CMAKE_C_COMPILER VERSION VERSION_GREATER 10.2 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.2) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power10 -mtune=power10 -mvsx -fno-fast-math") | |||
| else () | |||
| message(FATAL_ERROR "Compiler GCC.${GCC_VERSION} does not support Power10.") | |||
| message(FATAL_ERROR "Compiler GCC ${CMAKE_C_COMPILER_VERSION} does not support Power10.") | |||
| endif() | |||
| endif() | |||
| if (${TARGET} STREQUAL POWER9) | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 5.0 OR ${GCC_VERSION} VERSION_EQUAL 5.0) | |||
| if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 5.0 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 5.0) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power9 -mtune=power9 -mvsx -fno-fast-math") | |||
| else () | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math") | |||
| message(WARNING "Compiler GCC.${GCC_VERSION} does not support fully Power9.") | |||
| message(WARNING "Compiler GCC ${CMAKE_C_COMPILER_VERSION} does not support fully Power9.") | |||
| endif() | |||
| endif() | |||
| if (${TARGET} STREQUAL POWER8) | |||
| @@ -291,11 +279,10 @@ if (${TARGET} STREQUAL NEOVERSEV1) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve_intrinsics -march=armv8.4-a+sve -mtune=neoverse-v1") | |||
| else () | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||
| if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 10.4 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.4) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.4-a+sve -mtune=neoverse-v1") | |||
| else () | |||
| message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER} ${GCC_VERSION} does not support Neoverse V1.") | |||
| message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_VERSION} does not support Neoverse V1.") | |||
| endif() | |||
| endif() | |||
| endif() | |||
| @@ -303,11 +290,10 @@ if (${TARGET} STREQUAL NEOVERSEV1) | |||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve-intrinsics -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | |||
| else () | |||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
| if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||
| if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 10.4 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.4) | |||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | |||
| else () | |||
| message(FATAL_ERROR "Compiler $${CMAKE_C_COMPILER} {GCC_VERSION} does not support Neoverse N2.") | |||
| message(FATAL_ERROR "Compiler $${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_VERSION} does not support Neoverse N2.") | |||
| endif() | |||
| endif() | |||
| endif() | |||