-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[OpenMP] Fix runtimes default build #149871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Joseph Huber <[email protected]>
The default build of openmp (`cmake -S <llvm-project>/runtimes -DLLVM_ENABLE_RUNTIMES=openmp`) current fails with ``` CMake Error at /home/meinersbur/src/llvm/flangrt/_src/cmake/Modules/GetClangResourceDir.cmake:17 (string): string sub-command REGEX, mode MATCH needs at least 5 arguments total to command. Call Stack (most recent call first): /home/meinersbur/src/llvm/flangrt/_src/openmp/CMakeLists.txt:126 (get_clang_resource_dir) ``` The reason is that because it is not a bootstrapping-build, the clang resource dir that it intends to write files such as `omp-tools.h` into, is unavailable. Using the Clang resource dir for writing files is conceptually broken, as that dir might be located in `/usr/lib/clang/<version>/`. Writing to it is only intended in bootstrapping builds where Clang is built alongside openmp. This patch unifies the identification of being in a bootstrapping built. The same `LLVM_TREE_AVAILABLE` definition is going to be used in llvm#137828. No reason for each runtime to define its own.
Hi @Meinersbur This commit has broken 3-stage AArch64 builds. Without this build, We use 3-stage builds quite often; I appreciate the recommendation or a fix here soon.
Here is the simple code:
I believe as this commit has changed the location of |
@madhur13490 can you provide information about the three stages (i.e., relevant cmake flags for all stages like llvm-projects/runtime, flags to customize openmp build/install paths)? |
@@ -11,7 +11,7 @@ | |||
include(ExtendPath) | |||
|
|||
# The generated headers will be placed in clang's resource directory if present. | |||
if(OPENMP_STANDALONE_BUILD OR NOT LLVM_RUNTIMES_BUILD) | |||
if(NOT LLVM_TREE_AVAILABLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When building openmp as llvm project, LLVM_TREE_AVAILABLE
is undefined, so the wrong branch will be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only considered the standalone build when LLVM_TREE_AVAILABLE
being undefined just means means the LLVM tree is indeed not available. Will create a fix.
Note that that build mode is deprecated. #124014.
We use standard 3-stage LTO-PGO-BOLT builds, which primarily use https://github.com/llvm/llvm-project/blob/main/clang/cmake/caches/BOLT-PGO.cmake. You can find top-level community doc at https://llvm.org/docs/AdvancedBuilds.html |
This fits to my in code comment above.
These documents don't include OpenMP in their builds. |
via |
I assume The openmp build must not write outside its own build tree. Doing so causes countless problems such as conflicting versions of
This looks like you are invoking clang from the build directory. Either switch to a bootstrapping-build of openmp, or install both Clang and openmp into the same CMAKE_INSTALL_PREFIX and launch Clang from there. |
In this case the Clang build tree and the openmp build tree are identical. Fixed in #151117. Note that this build mode is deprecated since #136314. Consider moving to a runtimes build. According to the warning message added in #136314, that build mode should already have been removed. |
Thanks for all the help. We switched to |
The default build of openmp (
cmake -S <llvm-project>/runtimes -DLLVM_ENABLE_RUNTIMES=openmp
) current fails withThe reason is that because it is not a bootstrapping-build, the clang resource dir that it intends to write files such as
omp-tools.h
into, is unavailable. Using the Clang resource dir for writing files is conceptually broken, as that dir might be located in/usr/lib/clang/<version>/
. Writing to it is only intended in bootstrapping builds where Clang is built alongside openmp.This patch unifies the identification of being in a bootstrapping built. The same
LLVM_TREE_AVAILABLE
definition is going to be used in #137828. No reason for each runtime to define its own.