From e9fa67a0b94e2c095e1470aab205f3aa45225e72 Mon Sep 17 00:00:00 2001 From: dezhliao Date: Fri, 27 Sep 2024 14:51:18 -0700 Subject: [PATCH] C++17 become stable after GCC 7 --- libhsakmt/tests/kfdtest/CMakeLists.txt | 4 +++- runtime/hsa-runtime-tools/CMakeLists.txt | 2 +- runtime/hsa-runtime/core/util/atomic_helpers.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libhsakmt/tests/kfdtest/CMakeLists.txt b/libhsakmt/tests/kfdtest/CMakeLists.txt index d956cf4f7..e329a4ab3 100644 --- a/libhsakmt/tests/kfdtest/CMakeLists.txt +++ b/libhsakmt/tests/kfdtest/CMakeLists.txt @@ -221,11 +221,13 @@ message( STATUS "PROJECT_SOURCE_DIR:" ${PROJECT_SOURCE_DIR} ) # message(STATUS "${file}") #endforeach() -#add_definitions(-Wall -std=c++17) if ( "${CMAKE_C_COMPILER_VERSION}" STRGREATER "4.8.0") ## Add --enable-new-dtags to generate DT_RUNPATH set ( CMAKE_CXX_FLAGS "-std=gnu++17 -Wl,--enable-new-dtags" ) +elseif ( "${CMAKE_C_COMPILER_VERSION}" STRGREATER "7.5.0") +## c++17 become stable after GCC 7 +set ( CMAKE_CXX_FLAGS "-std=c++17 -Wl,--enable-new-dtags" ) endif() if ( "${CMAKE_BUILD_TYPE}" STREQUAL Release ) set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2" ) diff --git a/runtime/hsa-runtime-tools/CMakeLists.txt b/runtime/hsa-runtime-tools/CMakeLists.txt index ac8bccdfa..6ff1850fa 100755 --- a/runtime/hsa-runtime-tools/CMakeLists.txt +++ b/runtime/hsa-runtime-tools/CMakeLists.txt @@ -75,7 +75,7 @@ set( OPEN_SOURCE_DIR ${OPEN_SOURCE_DIR} CACHE PATH "Open source root dir" FORCE set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../../lib;$ORIGIN/../../lib64;$ORIGIN/../lib64") ## ------------------------- Linux Compiler and Linker options ------------------------- -set ( CMAKE_CXX_FLAGS "-std=c++11 ") +set ( CMAKE_CXX_FLAGS "-std=c++17 ") set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type -Werror -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=sign-compare -Wno-error=enum-compare -Wno-sign-compare -Wno-write-strings -Wno-deprecated-declarations -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -fPIC" ) diff --git a/runtime/hsa-runtime/core/util/atomic_helpers.h b/runtime/hsa-runtime/core/util/atomic_helpers.h index 41c6b8a34..1fd755aeb 100644 --- a/runtime/hsa-runtime/core/util/atomic_helpers.h +++ b/runtime/hsa-runtime/core/util/atomic_helpers.h @@ -41,7 +41,7 @@ //////////////////////////////////////////////////////////////////////////////// /* - Helpers to use native types with C++11 atomic operations. + Helpers to use native types with C++17 atomic operations. Fixes GCC builtin functionality for x86 with respect to WC and non-temporal stores. */