[all-commits] [llvm/llvm-project] a88f3a: [Clang] Add `__CLANG_GPU_DISABLE_MATH_WRAPPERS` ma...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Aug 14 14:54:59 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a88f3a331137d6379f2f1189d5eb4b086c686ab4
      https://github.com/llvm/llvm-project/commit/a88f3a331137d6379f2f1189d5eb4b086c686ab4
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2024-08-14 (Wed, 14 Aug 2024)

  Changed paths:
    M clang/lib/Headers/__clang_cuda_math.h
    M clang/lib/Headers/__clang_hip_math.h
    A clang/test/Headers/gpu_disabled_math.cpp

  Log Message:
  -----------
  [Clang] Add `__CLANG_GPU_DISABLE_MATH_WRAPPERS` macro for offloading math (#98234)

Summary:
Currently we replace all math calls with vendor specific ones. This
patch introduces a macro `__CLANG_GPU_DISABLE_MATH_WRAPPERS` that when
defined will disable this.

I went this route instead of a flag for two reasons. One, I think we
have too many flags as is, and we already have `-nogpuinc` to cover
disabling these wrappers entirely, so this would be a really specific
subset of that. Second, these math headers aren't easily decoupled by
simply not including a single header from the clang driver layer.
There's the cmath and the regular math forward declares it would disable
as well.

Note, this currently causes errors because the GPU `libm` doesn't have
`powi`, that's an NVIDIA extension I'll add to LLVM libm.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list