Skip to content

Commit 7ac8ce4

Browse files
committed
[OpenMP] Document how to specify flags to device libraries
Add an explanation on how to use RUNTIMES_<triple>_CMAKE_CXX_FLAGS in order to specify different compiler flags for OpenMP device libraries.
1 parent ba4bb1f commit 7ac8ce4

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

openmp/device/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ 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)
4639

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

openmp/docs/SupportAndFAQ.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ Support for the device library comes from a separate build of the OpenMP library
8282
that targets the GPU architecture. Building it requires enabling the runtime
8383
targets, or setting the target manually when doing a standalone build. This is
8484
done with the ``LLVM_RUNTIME_TARGETS`` option and then enabling the OpenMP
85-
runtime for the GPU target. ``RUNTIMES_<triple>_LLVM_ENABLE_RUNTIMES``. Refer to
86-
the cache file for the specific invocation.
85+
runtime for the GPU target via ``RUNTIMES_<triple>_LLVM_ENABLE_RUNTIMES``.
86+
It's possible to set different flags for each device library by using
87+
``RUNTIMES_<triple>_CMAKE_CXX_FLAGS``. Refer to the cache file for the specific
88+
invocation.
8789

8890
For Nvidia offload, please see :ref:`build_nvidia_offload_capable_compiler`.
8991
For AMDGPU offload, please see :ref:`build_amdgpu_offload_capable_compiler`.

0 commit comments

Comments
 (0)