Browse Source

Do not attempt to check host CPU if TARGET is set.

This wired 'autodetection' breaks DYNAMIC arch (or makes the build
unreproducible) and will most likely not work with cross compiling.

Presently, this is only relevant for SkylakeX, Cooperlake and
Sapphire Rapids cores, that's what has been implemented. Going
forward, other cores would have to be added here as well (in sync
with Markfile.$(arch) as this needs to be kept in sync with changes
to getarch.
It would be better to remove this hack (and the counterpart in
getarch) entirely.
This fixes issue #3557.

Signed-off-by: Egbert Eich <eich@suse.com>
pull/3569/head
Egbert Eich 4 years ago
parent
commit
943ffbb778
3 changed files with 14 additions and 6 deletions
  1. +11
    -3
      Makefile.system
  2. +2
    -2
      cmake/system.cmake
  3. +1
    -1
      getarch.c

+ 11
- 3
Makefile.system View File

@@ -197,9 +197,17 @@ endif

# On x86_64 build getarch with march=native unless the compiler is PGI. This is required to detect AVX512 support in getarch.
ifeq ($(HOSTARCH), x86_64)
ifeq ($(findstring pgcc,$(HOSTCC))$(findstring nvc,$(HOSTCC)),)
GETARCH_FLAGS += -march=native
endif
ifeq ($(findstring pgcc,$(HOSTCC))$(findstring nvc,$(HOSTCC)),)
ifdef TARGET
GETARCH_NOPROBE=1
endif
ifdef TARGET_CORE
GETARCH_NOPROBE=1
endif
ifndef GETARCH_NOPROBE
GETARCH_FLAGS += -march=native -DAUTOPROBE
endif
endif
endif

ifdef INTERFACE64


+ 2
- 2
cmake/system.cmake View File

@@ -55,8 +55,8 @@ if (DEFINED TARGET)
endif ()

# On x86_64 build getarch with march=native. This is required to detect AVX512 support in getarch.
if (X86_64 AND NOT ${CMAKE_C_COMPILER_ID} STREQUAL "PGI")
set(GETARCH_FLAGS "${GETARCH_FLAGS} -march=native")
if (X86_64 AND NOT ${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT DEFINED TARGET)
set(GETARCH_FLAGS "${GETARCH_FLAGS} -march=native -DAUTOPROBE")
endif ()

# On x86 no AVX support is available


+ 1
- 1
getarch.c View File

@@ -94,7 +94,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sys/sysinfo.h>
#endif

#if defined(__x86_64__) || defined(_M_X64)
#if defined (AUTOPROBE) && (defined(__x86_64__) || defined(_M_X64))
#if (( defined(__GNUC__) && __GNUC__ > 6 && defined(__AVX2__)) || (defined(__clang__) && __clang_major__ >= 6))
#else
#ifndef NO_AVX512


Loading…
Cancel
Save