Skip to content
Permalink
Browse files

Fix detection of AVX512 capable compilers in getarch

21eda8b 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.
  • Loading branch information...
michaellass committed May 3, 2019
1 parent 27649b9 commit 7a9a4dbc4fdd748747cd86ae685e760ae8cdc10f
Showing with 14 additions and 0 deletions.
  1. +9 −0 Makefile.system
  2. +5 −0 cmake/system.cmake
@@ -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
@@ -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")

0 comments on commit 7a9a4db

Please sign in to comment.
You can’t perform that action at this time.