[Flang][OpenMP][RFC] Replace flang/module/omp_lib.{f90,h} with openmp/runtime/src/include/omp_lib.{f90,h}

Could we move the omp_lib module and header from the openmp runtime to llvm/{lib,include}/Frontend` and then use it from Flang/Clang?

I would not do this at this point. Having these definitions live in the openmp/ sub-project helps if one wants to do an external project build of OpenMP. So, for now, Iā€™d vote for keeping them at the old place.

It turned out to be a bit more work that I had initially thought, but the PR now seems to be ready for reviews.

The specifics PR changes are:

  • When openmp appears in LLVM_ENABLE_PROJECTS, the build picks up omp_lib.f90 and omp_lib.h from `OpenMP/runtime/src/include and compiles/copies them into the include folders. This includes a potential install as well.
  • When openmp is not present in LLVM_ENABLE_PROJECTS, the build does not happen. The compiler will then complain about missing a missing omp_lib module or omp_lib.h include file. That seems to appropriate, given that in that case the linker would also eventually fail due to a missing OpenMP runtime library.
  • The tests have been updated to be moved to ā€œUnsupportedā€ when Flang has been setup up w/o openmp in LLVM_ENABLE_PROJECTS.
  • There have been many issues in the test cases, where the wrong integer type was used (the runtime actually uses 64-bit integers) or a wrong value was used in the test (esp. for the pre-defined OpenMP allocators). I have fixed those.

I invite folks with applications to please test the PR and provide their feedback to me.

1 Like

I think all the post-commit CI we have in lab.llvm.org do not enable openmp, so we will lose testing for these tests. Could you enable the openmp runtime in one of these before you submit the change?

1 Like