[PATCH] D121466: [OpenMP] Replace math headers with OpenMP wrapper calls

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


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

This patch replaces the math functions when called on the device with an
`__omp_` variant that we can use. This will later be turned back into
the regular math call so we can avoid the problems with including math.h
on the device. This patch introduces the `-fopenmp-device-libm` flag
which enables the new math wrappers by defining __MATH_WRAPPERS__ in the
header.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121466

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/openmp_wrappers/__clang_openmp_math.h
  clang/lib/Headers/openmp_wrappers/__clang_openmp_math_forward_declares.h
  clang/lib/Headers/openmp_wrappers/math.h
  clang/test/Headers/nvptx_device_cmath_functions.c
  clang/test/Headers/nvptx_device_cmath_functions.cpp
  clang/test/Headers/nvptx_device_cmath_functions_cxx17.cpp
  clang/test/Headers/nvptx_device_math_functions.c
  clang/test/Headers/nvptx_device_math_functions.cpp
  clang/test/Headers/nvptx_device_math_functions_cxx17.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121466.414659.patch
Type: text/x-patch
Size: 39880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220311/0350584b/attachment-0001.bin>


More information about the cfe-commits mailing list