Skip to content

Commit ba4bb1f

Browse files
committed
[OpenMP] Avoid using CPU-specific flags for GPU
Since commit be6f110 we lost a few workarounds that prevented CPU-specific flags to leak from CXXFLAGS to a binary targetting GPUs causing errors and/or warnings. Re-add those workarounds and expand them with -mtune, -mbranch-protection and -fcf-protection.
1 parent 92f5d8d commit ba4bb1f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

openmp/device/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ list(APPEND compile_options -Wno-unknown-cuda-version)
3636
if(LLVM_DEFAULT_TARGET_TRIPLE)
3737
list(APPEND compile_options --target=${LLVM_DEFAULT_TARGET_TRIPLE})
3838
endif()
39+
# Ensure that CPU-related parameters won't be brought in.
40+
string(REGEX REPLACE "-mcpu[^ \t\r\n]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
41+
string(REGEX REPLACE "-march[^ \t\r\n]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
42+
string(REGEX REPLACE "-mtune[^ \t\r\n]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
43+
string(REGEX REPLACE "-mbranch-protection[^ \t\r\n]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
44+
string(REGEX REPLACE "-fcf-protection[^ \t\r\n]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
45+
list(APPEND compile_options -Wno-unused-command-line-argument)
3946

4047
# We disable the slp vectorizer during the runtime optimization to avoid
4148
# vectorized accesses to the shared state. Generally, those are "good" but

0 commit comments

Comments
 (0)