[all-commits] [llvm/llvm-project] a0709e: [HIP] Use native math functions for `-fcuda-approx...

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Tue Jul 25 07:06:01 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a0709e226b482c3d4a2d1f15227641590c43527a
      https://github.com/llvm/llvm-project/commit/a0709e226b482c3d4a2d1f15227641590c43527a
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2023-07-25 (Tue, 25 Jul 2023)

  Changed paths:
    M clang/lib/Headers/__clang_hip_math.h
    M clang/test/Headers/__clang_hip_math.hip

  Log Message:
  -----------
  [HIP] Use native math functions for `-fcuda-approx-transcendentals`

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.

Reviewed by: Brian Sumner, Matt Arsenault

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




More information about the All-commits mailing list