[PATCH] D154790: [HIP] Use native math functions for `-fcuda-approx-transcendentals`

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 9 07:26:26 PDT 2023


yaxunl created this revision.
yaxunl added reviewers: tra, b-sumner.
Herald added a subscriber: mattd.
Herald added a project: All.
yaxunl requested review of this revision.

CUDA allows replacing standard math functions with less accurate
native math functions when `-use_fast_math` is specified
(https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#intrinsic-functions).
Cuda-clang does this when `-fcuda-approx-transcendentals`
or `-ffast-math` is specified. HIP-clang currently passes option
`-fcuda-approx-transcendentals` to clang `-cc1` and predefines
`__CLANG_CUDA_APPROX_TRANSCENDENTALS__` but does
not replace standard math functions with native math functions.

This patch implements this in a similar approach as cuda-clang.


https://reviews.llvm.org/D154790

Files:
  clang/lib/Headers/__clang_hip_math.h
  clang/test/Headers/__clang_hip_math.hip

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154790.538430.patch
Type: text/x-patch
Size: 137205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230709/1fc93776/attachment-0001.bin>


More information about the cfe-commits mailing list