From 7a9a4dbc4fdd748747cd86ae685e760ae8cdc10f Mon Sep 17 00:00:00 2001 From: Michael Lass Date: Fri, 3 May 2019 21:07:14 +0200 Subject: [PATCH 1/2] Fix detection of AVX512 capable compilers in getarch 21eda8b5 introduced a check in getarch.c to test if the compiler is capable of AVX512. This check currently fails, since the used __AVX2__ macro is only defined if getarch itself was compiled with AVX2/AVX512 support. Make sure this is the case by building getarch with -march=native on x86_64. It is only supposed to run on the build host anyway. --- Makefile.system | 9 +++++++++ cmake/system.cmake | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/Makefile.system b/Makefile.system index f574edf88..eb57cbb30 100644 --- a/Makefile.system +++ b/Makefile.system @@ -9,6 +9,11 @@ ifndef TOPDIR TOPDIR = . endif +# If ARCH is not set, we use the host system's architecture. +ifndef ARCH +ARCH := $(shell uname -m) +endif + # Catch conflicting usage of ARCH in some BSD environments ifeq ($(ARCH), amd64) override ARCH=x86_64 @@ -137,6 +142,10 @@ endif endif +# On x86_64 build getarch with march=native. This is required to detect AVX512 support in getarch. +ifeq ($(ARCH), x86_64) +GETARCH_FLAGS += -march=native +endif ifdef INTERFACE64 diff --git a/cmake/system.cmake b/cmake/system.cmake index adedd32cc..7f3696286 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -65,6 +65,11 @@ if (DEFINED TARGET) set(GETARCH_FLAGS "-DFORCE_${TARGET}") endif () +# On x86_64 build getarch with march=native. This is required to detect AVX512 support in getarch. +if (X86_64) + set(GETARCH_FLAGS "${GETARCH_FLAGS} -march=native") +endif () + if (INTERFACE64) message(STATUS "Using 64-bit integers.") set(GETARCH_FLAGS "${GETARCH_FLAGS} -DUSE64BITINT") From 9cdc828afa3b209c2c74a7d9daa5fac85bece49f Mon Sep 17 00:00:00 2001 From: Michael Lass Date: Fri, 3 May 2019 21:22:27 +0200 Subject: [PATCH 2/2] c_check: Unlink correct file --- c_check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_check b/c_check index d93b756d5..271182c54 100644 --- a/c_check +++ b/c_check @@ -240,7 +240,7 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) { } else { $no_avx512 = 0; } - unlink("tmpf.o"); + unlink("$tmpf.o"); } }