[PATCH] D121468: [OpenMP] Add linking of OpenMP math library

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 11 07:57:38 PST 2022


jhuber6 created this revision.
jhuber6 added reviewers: JonChesterfield, tianshilei1992, jdoerfert, ggeorgakoudis.
Herald added subscribers: asavonic, dang, kerbowa, guansong, yaxunl, jvesely.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

This patch adds support for linking in the OpenMP math wrappers library.
The math library first replaces all math calls with an OpenMP wrapper
call. This wrapper call is linked early with a library that associates
the wrapper call to the original math function. This is necessary to
have access to the math function symbols without including the math
header which includes incompatible code with the GPU. These wrapper
functions have another library which maps them to the device library
version late when doing LTO. Linking libdevice must be done after this
library and done late when doing LTO. Unfortunately doing LTO with
libdevice is very slow right now.

Depends on D121467 <https://reviews.llvm.org/D121467>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121468

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/test/Driver/Inputs/libomptarget/libomptarget-nvptx-math.bc
  clang/test/Driver/Inputs/libomptarget/libomptarget-nvptx-wrapper.bc
  clang/test/Driver/openmp-offload-gpu.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121468.414662.patch
Type: text/x-patch
Size: 12626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220311/17a2ef21/attachment.bin>


More information about the cfe-commits mailing list