-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[OpenMP] Disable LTO build of libomptarget and plugins by default. #79387
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
CheckIPOSupported is used to test for working LTO. However, before CMake 3.24 this will test the default linker and ignore options such as LLVM_ENABLE_LLD. As a result, CMake would test whether LTO works with the default linker but build with another one. In a typical scenario, libomptarget is compiled with the in-tree Clang, but linked with ld.gold, which requires the LLVMgold plugin, when it actually would work with the lld linker (or also fail because the system lld is too old to understand opaque pointers). Using gcc as the compiler would pass the test, but fail when linking with lld since does not understand gcc's LTO format. Disable LTO by default for now since automatic detection causes too many problems. It causes the openmp-offload-cuda-project buildbot (https://lab.llvm.org/staging/#/builders/151) to fail and LLVM_ENABLE_RUNTIMES=openmp builds will have it implicitly disabled in the vast majority of system configurations.
I think this also made the projects build fail at some point. |
I'm wondering if we shouldn't just go off of |
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.
Let's just turn this off for now as it causes some other problems and revisit it after the move.
I assume Johannes had an intention behind, such that the runtime library performance is more critical than compiler performance. If so, it should apply on every runtime including libcxx. Maybe those are too big such that the llvm-project build time become too long to be switched on by default? If not, then I agree the setting should be handled for all runtimes.
If by that you mean check for that the flag is accepted by the compiler (
gcc and the most recent Clang also support Note that the issue has been fixed in CMake 3.24, but even if you have CMake 3.24 or newer, it intentionally uses the old behavior for compatibility unless we use |
There's a reasonable chance we could somewhat enforce |
CheckIPOSupported is used to test for working LTO since #74520. However, before CMake 3.24 this will test the default linker and ignore options such as LLVM_ENABLE_LLD. As a result, CMake would test whether LTO works with the default linker but builds with another one. In a typical scenario, libomptarget is compiled with the in-tree Clang, but linked with ld.gold, which requires the LLVMgold plugin, when it actually would work with the lld linker (or also fail because the system lld is too old to understand opaque pointers). Using gcc as the compiler would pass the test, but fail when linking with lld since does not understand gcc's LTO format.
Disable LTO by default for now since automatic detection causes too many problems. It causes the openmp-offload-cuda-project buildbot (https://lab.llvm.org/staging/#/builders/151) to fail and LLVM_ENABLE_RUNTIMES=openmp builds will have it implicitly disabled in the vast majority of system configurations anyway.