Skip to content

Commit 30c4220

Browse files
edwsmythkvaragan
andauthored
GCC 15 SUP kernel workaround (#35)
GCC 15 fails to compile some SUP kernels. The problem seems to be related to one of the optimization phases enabled at -O2 or above. Workaround is to disable this specific optimization by adding the flag -fno-tree-slp-vectorize to CKOPTFLAGS. AMD-Internal: [CPUPL-6579] Co-authored-by: Varaganti, Kiran <[email protected]>
1 parent 15c44a6 commit 30c4220

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

config/haswell/make_defs.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ endif
6666
# they make explicit use of the rbp register.
6767
CKOPTFLAGS := $(COPTFLAGS) -O3 -fomit-frame-pointer
6868
ifeq ($(CC_VENDOR),gcc)
69+
ifeq ($(shell test $(CC_MAJOR) -ge 15; echo $$?),0)
70+
# gcc 15.1.0 fails to compile SUP kernels if -ftree-slp-vectorize
71+
# is enabled, which is default in -O2 and higher
72+
CKOPTFLAGS += -fno-tree-slp-vectorize
73+
endif
6974
CKVECFLAGS := -mavx2 -mfma -mfpmath=sse -march=haswell
7075
ifeq ($(GCC_OT_4_9_0),yes)
7176
# If gcc is older than 4.9.0, we must use a different label for -march.

config/skx/make_defs.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ endif
6767
CKOPTFLAGS := $(COPTFLAGS) -O3 -fomit-frame-pointer
6868

6969
ifeq ($(CC_VENDOR),gcc)
70+
ifeq ($(shell test $(CC_MAJOR) -ge 15; echo $$?),0)
71+
# gcc 15.1.0 fails to compile SUP kernels if -ftree-slp-vectorize
72+
# is enabled, which is default in -O2 and higher
73+
CKOPTFLAGS += -fno-tree-slp-vectorize
74+
endif
7075
CKVECFLAGS := -mavx512f -mavx512dq -mavx512bw -mavx512vl -mfpmath=sse -march=skylake-avx512
7176
else ifeq ($(CC_VENDOR),icc)
7277
CKVECFLAGS := -xCORE-AVX512

config/zen/amd_config.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,15 @@ endif()
5858

5959
if(MSVC)
6060
set(CKVECFLAGS -mavx2 -mfma -mno-fma4 -mno-tbm -mno-xop -mno-lwp)
61+
6162
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
63+
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0.0)
64+
# gcc 15.1.0 fails to compile SUP kernels if -ftree-slp-vectorize
65+
# is enabled, which is default in -O2 and higher
66+
list(APPEND CKOPTFLAGS -fno-tree-slp-vectorize)
67+
endif()
6268
set(CKVECFLAGS -mavx2 -mfpmath=sse -mfma)
69+
6370
elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
6471
set(CKVECFLAGS -mavx2 -mfpmath=sse -mfma -mno-fma4 -mno-tbm -mno-xop -mno-lwp)
6572
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string)
@@ -68,6 +75,7 @@ elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
6875
if("${CLANG_STRING}" MATCHES "(AOCC.LLVM)")
6976
list(APPEND CKVECFLAGS -mllvm -disable-licm-vrp)
7077
endif()
78+
7179
else()
7280
message(FATAL_ERROR "gcc or clang are required for this configuration.")
7381
endif()

config/zen/amd_config.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ CKLPOPTFLAGS :=
6262

6363
ifeq ($(CC_VENDOR),gcc)
6464
CKVECFLAGS := -mavx2 -mfpmath=sse -mfma
65+
ifeq ($(shell test $(CC_MAJOR) -ge 15; echo $$?),0)
66+
# gcc 15.1.0 fails to compile SUP kernels if -ftree-slp-vectorize
67+
# is enabled, which is default in -O2 and higher
68+
CKOPTFLAGS += -fno-tree-slp-vectorize
69+
endif
6570
else ifeq ($(CC_VENDOR),clang)
6671
CKVECFLAGS := -mavx2 -mfpmath=sse -mfma -mno-fma4 -mno-tbm -mno-xop -mno-lwp
6772
ifeq ($(strip $(shell $(CC) -v |&head -1 |grep -c 'AOCC.LLVM')),1)

0 commit comments

Comments
 (0)