From 0784679d4d87a7d8f163b601d6e8ec02fb93c376 Mon Sep 17 00:00:00 2001 From: Kiran Varaganti Date: Thu, 15 Feb 2024 11:35:49 +0530 Subject: [PATCH] Fix gcc 7.5 compilation error for zen4 and above configs For gcc greater than or equal to 7.0 version added AVX512 compiler flags in makde_defs.mk and make_defs.cmake. AVX512VNNI compiler flag is only supported from gcc version 8 or greater. So added another else condition for gcc version greater than or equal to 7 - enabling avx512 flags. This enables compilation of AVX512 assembly code paths with gcc 7.5 version. Change-Id: I2cda00e578010db5e5a515b506c0b99f685307e0 --- config/zen4/make_defs.cmake | 8 ++++++-- config/zen4/make_defs.mk | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/config/zen4/make_defs.cmake b/config/zen4/make_defs.cmake index e5ce4401b..ec28a451c 100644 --- a/config/zen4/make_defs.cmake +++ b/config/zen4/make_defs.cmake @@ -1,4 +1,4 @@ -##Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved. ## +##Copyright (C) 2023-2024, Advanced Micro Devices, Inc. All rights reserved. ## # FLAGS that are specific to the 'zen4' architecture are added here. # FLAGS that are common for all the AMD architectures are present in @@ -52,8 +52,12 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # gcc 8.0 or later list(APPEND CKVECFLAGS -march=znver1 -mavx512f -mavx512dq -mavx512bw -mavx512vl -mavx512vnni) list(APPEND CRVECFLAGS -march=znver1) + elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0.0) + # gcc 7.0 or later + list(APPEND CKVECFLAGS -march=znver1 -mavx512f -mavx512dq -mavx512bw -mavx512vl) + list(APPEND CRVECFLAGS -march=znver1) else() - # If gcc is older than 8.0.0 but at least 6.1.0, then we can use -march=znver1 + # If gcc is older than 7.0.0 but at least 6.1.0, then we can use -march=znver1 # as the fallback option. list(APPEND CKVECFLAGS -march=znver1 -mno-avx256-split-unaligned-store) list(APPEND CRVECFLAGS -march=znver1 -mno-avx256-split-unaligned-store) diff --git a/config/zen4/make_defs.mk b/config/zen4/make_defs.mk index bca80fcc9..5ad057042 100644 --- a/config/zen4/make_defs.mk +++ b/config/zen4/make_defs.mk @@ -4,7 +4,7 @@ # An object-based framework for developing high-performance BLAS-like # libraries. # -# Copyright (C) 2022 - 2023, Advanced Micro Devices, Inc. All rights reserved. +# Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -102,8 +102,12 @@ ifeq ($(CC_VENDOR),gcc) # gcc 8.0 or later CKVECFLAGS += -march=znver1 -mavx512f -mavx512dq -mavx512bw -mavx512vl -mavx512vnni CRVECFLAGS += -march=znver1 + else ifeq ($(shell test $(GCC_VERSION) -ge 7; echo $$?),0) + # gcc 7.0 or later + CKVECFLAGS += -march=znver1 -mavx512f -mavx512dq -mavx512bw -mavx512vl + CRVECFLAGS += -march=znver1 else - # If gcc is older than 8.0.0 but at least 6.1.0, then we can use -march=znver1 + # If gcc is older than 7.0.0 but at least 6.1.0, then we can use -march=znver1 # as the fallback option. CKVECFLAGS += -march=znver1 -mno-avx256-split-unaligned-store CRVECFLAGS += -march=znver1 -mno-avx256-split-unaligned-store