[all-commits] [llvm/llvm-project] 30efb4: [Libomptarget] Remove use of ELF link_address in x...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Aug 24 08:46:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 30efb459e0a50139dab287c77bc975aadb18cd1d
      https://github.com/llvm/llvm-project/commit/30efb459e0a50139dab287c77bc975aadb18cd1d
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-08-24 (Wed, 24 Aug 2022)

  Changed paths:
    M openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp

  Log Message:
  -----------
  [Libomptarget] Remove use of ELF link_address in x86_64 plugin

We use the offloading entires array to determine the relative names and
addressed of device-side kernel functions. The x86_64 plugin previously
derived the device-side entry table by first identifying the
`omp_offloading_entries` section offset in the loaded elf. Then we would
use the base offset of the loaded dyanmic library to identify the
entries array within the loaded image. This relied on some more
unconventional methods which prevented us from using the LLVM dynamic
library loader for this plugin. This patch simplifies this by instead
copying the host-side entry and replacing its address with the
device-side address looked up through `dlsym`.

Reviewed By: JonChesterfield

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


  Commit: 540a13652fda8b91b62b73fb9ae1e34879e8e36c
      https://github.com/llvm/llvm-project/commit/540a13652fda8b91b62b73fb9ae1e34879e8e36c
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-08-24 (Wed, 24 Aug 2022)

  Changed paths:
    M openmp/libomptarget/include/rtl.h
    M openmp/libomptarget/plugins/CMakeLists.txt
    M openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
    M openmp/libomptarget/plugins/amdgpu/dynamic_hsa/hsa.cpp
    M openmp/libomptarget/plugins/cuda/CMakeLists.txt
    M openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
    M openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
    M openmp/libomptarget/src/CMakeLists.txt
    M openmp/libomptarget/src/rtl.cpp

  Log Message:
  -----------
  [Libomptarget] Replace use of `dlopen` with LLVM's dynamic library support

This patch replaces uses of `dlopen` and `dlsym` with LLVM's support
with `loadPermanentLibrary` and `getSymbolAddress`. This allows us to
remove the explicit dependency on the `dl` libraries in the CMake. This
removes another explicit dependency and solves an issue encountered
while building on Windows platforms. The one downside to this is that
the LLVM library does not currently support `dlclose` functionality, but
this could be added in the future.

Reviewed By: JonChesterfield

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


Compare: https://github.com/llvm/llvm-project/compare/8e8a62006eca...540a13652fda


More information about the All-commits mailing list