[all-commits] [llvm/llvm-project] f85ae0: [OpenMP] Provide math functions in OpenMP device c...

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Tue Apr 7 21:41:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f85ae058f580e9d74c4a8f2f0de168c18da6150f
      https://github.com/llvm/llvm-project/commit/f85ae058f580e9d74c4a8f2f0de168c18da6150f
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-07 (Tue, 07 Apr 2020)

  Changed paths:
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Headers/CMakeLists.txt
    M clang/lib/Headers/__clang_cuda_cmath.h
    M clang/lib/Headers/__clang_cuda_device_functions.h
    M clang/lib/Headers/__clang_cuda_math.h
    M clang/lib/Headers/__clang_cuda_math_forward_declares.h
    A clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h
    R clang/lib/Headers/openmp_wrappers/__clang_openmp_math.h
    R clang/lib/Headers/openmp_wrappers/__clang_openmp_math_declares.h
    M clang/lib/Headers/openmp_wrappers/cmath
    M clang/lib/Headers/openmp_wrappers/math.h
    A clang/lib/Headers/openmp_wrappers/time.h
    A clang/test/Headers/Inputs/include/climits
    M clang/test/Headers/Inputs/include/cmath
    M clang/test/Headers/Inputs/include/cstdlib
    M clang/test/Headers/Inputs/include/math.h
    M clang/test/Headers/Inputs/include/stdlib.h
    M clang/test/Headers/nvptx_device_cmath_functions.c
    M clang/test/Headers/nvptx_device_cmath_functions.cpp
    M clang/test/Headers/nvptx_device_cmath_functions_cxx17.cpp
    A clang/test/Headers/nvptx_device_math_complex.c
    M clang/test/Headers/nvptx_device_math_functions.c
    M clang/test/Headers/nvptx_device_math_functions.cpp
    M clang/test/Headers/nvptx_device_math_functions_cxx17.cpp
    A clang/test/Headers/nvptx_device_math_macro.cpp
    A clang/test/Headers/nvptx_device_math_modf.cpp
    A clang/test/Headers/nvptx_device_math_sin.c
    A clang/test/Headers/nvptx_device_math_sin.cpp
    A clang/test/Headers/nvptx_device_math_sin_cos.cpp
    A clang/test/Headers/nvptx_device_math_sincos.cpp

  Log Message:
  -----------
  [OpenMP] Provide math functions in OpenMP device code via OpenMP variants

For OpenMP target regions to piggy back on the CUDA/AMDGPU/... implementation of math functions,
we include the appropriate definitions inside of an `omp begin/end declare variant match(device={arch(nvptx)})` scope.
This way, the vendor specific math functions will become specialized versions of the system math functions.
When a system math function is called and specialized version is available the selection logic introduced in D75779
instead call the specialized version. In contrast to the code path we used so far, the system header is actually included.
This means functions without specialized versions are available and so are macro definitions.

This should address PR42061, PR42798, and PR42799.

Reviewed By: ye-luo

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




More information about the All-commits mailing list