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 <Kiran.Varaganti@amd.com>
This commit is contained in:
Smyth, Edward
2025-06-25 11:01:34 +01:00
committed by GitHub
parent 15c44a6f8c
commit 30c42202d7
4 changed files with 23 additions and 0 deletions

View File

@@ -66,6 +66,11 @@ endif
# they make explicit use of the rbp register.
CKOPTFLAGS := $(COPTFLAGS) -O3 -fomit-frame-pointer
ifeq ($(CC_VENDOR),gcc)
ifeq ($(shell test $(CC_MAJOR) -ge 15; echo $$?),0)
# gcc 15.1.0 fails to compile SUP kernels if -ftree-slp-vectorize
# is enabled, which is default in -O2 and higher
CKOPTFLAGS += -fno-tree-slp-vectorize
endif
CKVECFLAGS := -mavx2 -mfma -mfpmath=sse -march=haswell
ifeq ($(GCC_OT_4_9_0),yes)
# If gcc is older than 4.9.0, we must use a different label for -march.

View File

@@ -67,6 +67,11 @@ endif
CKOPTFLAGS := $(COPTFLAGS) -O3 -fomit-frame-pointer
ifeq ($(CC_VENDOR),gcc)
ifeq ($(shell test $(CC_MAJOR) -ge 15; echo $$?),0)
# gcc 15.1.0 fails to compile SUP kernels if -ftree-slp-vectorize
# is enabled, which is default in -O2 and higher
CKOPTFLAGS += -fno-tree-slp-vectorize
endif
CKVECFLAGS := -mavx512f -mavx512dq -mavx512bw -mavx512vl -mfpmath=sse -march=skylake-avx512
else ifeq ($(CC_VENDOR),icc)
CKVECFLAGS := -xCORE-AVX512

View File

@@ -58,8 +58,15 @@ endif()
if(MSVC)
set(CKVECFLAGS -mavx2 -mfma -mno-fma4 -mno-tbm -mno-xop -mno-lwp)
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0.0)
# gcc 15.1.0 fails to compile SUP kernels if -ftree-slp-vectorize
# is enabled, which is default in -O2 and higher
list(APPEND CKOPTFLAGS -fno-tree-slp-vectorize)
endif()
set(CKVECFLAGS -mavx2 -mfpmath=sse -mfma)
elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
set(CKVECFLAGS -mavx2 -mfpmath=sse -mfma -mno-fma4 -mno-tbm -mno-xop -mno-lwp)
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string)
@@ -68,6 +75,7 @@ elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
if("${CLANG_STRING}" MATCHES "(AOCC.LLVM)")
list(APPEND CKVECFLAGS -mllvm -disable-licm-vrp)
endif()
else()
message(FATAL_ERROR "gcc or clang are required for this configuration.")
endif()

View File

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