[all-commits] [llvm/llvm-project] 349c0a: [OpenMP] Remove 'keep_alive' functionality from th...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed May 31 15:12:59 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 349c0aacb38072a868421ce7c460514be57a3de7
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M openmp/libomptarget/DeviceRTL/CMakeLists.txt
    M openmp/libomptarget/DeviceRTL/src/Utils.cpp
    M openmp/libomptarget/DeviceRTL/src/exports

  Log Message:
  [OpenMP] Remove 'keep_alive' functionality from the device RTL

The OpenMP DeviceRTL uses a hacky workaround to keep certain runtime
calls alive. This used a function that prevented them from being
optimized out. We needed this hack because the 'OpenMPOpt' pass likes to
introduce new runtime calls into the TU. This then interacted badly with
the method of linking the bitcode file per-TU like we do with Nvidia.
The OpenMPOpt pass would then generate a runtime call to a function that
was never linked in.

This should not be a problem anymore because we unconditionally link in
the `libomptarget.devicertl.a` runtime library. This should thus only
extract symbols that are undefined. So, if we do end up with an
unresolved reference it will be resolved by the static library.

The downside to this is that if we are doing non-LTO NVPTX compilation
that introduces one of these calls it will be linked outside the module
and therefore provide the overhead of an external function call.
However, removing this flag should make optimizing things easier. We
will need to see if that performance is a problem.

Reviewed By: ye-luo

Differential Revision: https://reviews.llvm.org/D151324

More information about the All-commits mailing list