This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Make `libomptarget` link against `libomp`
ClosedPublic

Authored by tianshilei1992 on May 1 2023, 2:56 PM.

Details

Summary

In libomptarget we use a couple of functions from libomp, but we didn't link
libomptarget against libomp. That will not work on some platforms such
as macOS. A linker error will be encountered because those symbols are not resolved
at link time when building libomptarget. This patch simply makes libomptarget
link agains libomp, makes it a "user" of libomp. I think this will not break
the policies between libomp and libomptarget.

Diff Detail

Event Timeline

tianshilei1992 created this revision.May 1 2023, 2:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2023, 2:56 PM
tianshilei1992 requested review of this revision.May 1 2023, 2:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2023, 2:56 PM
tianshilei1992 edited the summary of this revision. (Show Details)May 1 2023, 2:57 PM
This revision is now accepted and ready to land.May 1 2023, 3:15 PM
This revision was automatically updated to reflect the committed changes.

We observed some change in CMake behaviour in the last 24 hours and we suspect that this revision might be the cause of it.
Originality, we used to enable openmp with the -DLLVM_ENABLE_PROJECTS="....;openmp" flag, but this now produces the following error:

CMake Error: install(EXPORT "LLVMExports" ...) includes target "omptarget" which requires target "omp" that is not in any export set.
CMake Error in cmake/modules/CMakeLists.txt:
   export called with target "omptarget" which requires target "omp" that is
   not in any export set.

Switching to use the -DLLVM_ENABLE_RUNTIMES="openmp" seem fix this issue.

I was just wondering if this is intended behaviour.

We observed some change in CMake behaviour in the last 24 hours and we suspect that this revision might be the cause of it.
Originality, we used to enable openmp with the -DLLVM_ENABLE_PROJECTS="....;openmp" flag, but this now produces the following error:

CMake Error: install(EXPORT "LLVMExports" ...) includes target "omptarget" which requires target "omp" that is not in any export set.
CMake Error in cmake/modules/CMakeLists.txt:
   export called with target "omptarget" which requires target "omp" that is
   not in any export set.

Switching to use the -DLLVM_ENABLE_RUNTIMES="openmp" seem fix this issue.

I was just wondering if this is intended behaviour.

This broke our ability to publish Sphinx documentation, it seems: https://lab.llvm.org/buildbot/#/builders/89/builds/40301 so hopefully we can get a quick fix or revert.

tianshilei1992 reopened this revision.May 2 2023, 7:22 AM
This revision is now accepted and ready to land.May 2 2023, 7:22 AM

Thanks for the report. I have reverted it and will fix it accordingly.

Thanks for the report. I have reverted it and will fix it accordingly.

Thank you! I can confirm we're publishing documentation again, so that's appreciated!

export omp as well

This revision was automatically updated to reflect the committed changes.