Skip to content

Commit

Permalink
Fix Win64 AVX512 bug.
Browse files Browse the repository at this point in the history
Use `-march=haswell` for kernels. Fixes #514.
  • Loading branch information
devinamatthews committed Jul 8, 2021
1 parent aaa10c8 commit 9a8e649
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions config/skx/make_defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ ifeq ($(CC_VENDOR),icc)
CKVECFLAGS := -xCORE-AVX512
else
ifeq ($(CC_VENDOR),clang)
# NOTE: We have to use -march=haswell on Windows because apparently AVX512
# uses an alternate calling convention where xmm registers are not callee-saved
# on the stack. When this is mixed with framework code compiled for general
# x86_64 mode then chaos ensues (e.g. #514).
ifeq ($(IS_WIN),yes)
CKVECFLAGS := -mavx512f -mavx512dq -mavx512bw -mavx512vl -mfpmath=sse -march=haswell
else
CKVECFLAGS := -mavx512f -mavx512dq -mavx512bw -mavx512vl -mfpmath=sse -march=skylake-avx512
endif
else
$(error gcc, icc, or clang is required for this configuration.)
endif
Expand All @@ -97,7 +105,15 @@ ifeq ($(CC_VENDOR),icc)
CRVECFLAGS := -xCORE-AVX2
else
ifeq ($(CC_VENDOR),clang)
# NOTE: We have to use -march=haswell on Windows because apparently AVX512
# uses an alternate calling convention where xmm registers are not callee-saved
# on the stack. When this is mixed with framework code compiled for general
# x86_64 mode then chaos ensues (e.g. #514).
ifeq ($(IS_WIN),yes)
CRVECFLAGS := -march=haswell -funsafe-math-optimizations -ffp-contract=fast
else
CRVECFLAGS := -march=skylake-avx512 -mno-avx512f -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -funsafe-math-optimizations -ffp-contract=fast
endif
else
$(error gcc, icc, or clang is required for this configuration.)
endif
Expand Down

0 comments on commit 9a8e649

Please sign in to comment.