Skip to content

Commit

Permalink
Set CXX flags in debug mode
Browse files Browse the repository at this point in the history
clang++ crashes while building some hip code in debug mode.

Add -O2 as a workaround.

Hipcc does not have this issue since it adds -Ox implicitly.
  • Loading branch information
CongMa13 committed Apr 16, 2024
1 parent e529d4c commit 7566b7f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

#Set Clang C++ Version
#Set Clang C++ flags.
set(CMAKE_CXX_FLAGS_DEBUG "-g -O2") # clang++ crashes without -O2
set(CMAKE_CXX_FLAGS_MINSIZEREL "-O2 -DNDEBUG") # clang++ failed to build the project with the default -Os
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --driver-mode=g++ -Xclang -fallow-half-arguments-and-returns -D__HIP_HCC_COMPAT_MODE__=1 -Wno-format-nonliteral -parallel-jobs=4 -fclang-abi-compat=17")

# Top level configs
Expand Down

0 comments on commit 7566b7f

Please sign in to comment.