[PATCH] D47849: [OpenMP][Clang][NVPTX] Enable math functions called in an OpenMP NVPTX target device region to be resolved as device-native function calls

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 8 02:12:52 PDT 2018


Hahnfeld added a comment.

In https://reviews.llvm.org/D47849#1190997, @gtbercea wrote:

> Don't we want to use device specific math functions?
>  It's not just about avoiding some the host specific assembly, it's also about getting an implementation tailored to the device.


Ok, so you are already talking about performance. I think we should fix correctness first, in particular the compiler shouldn't complain whenever `<math.h>` is included.

I experimented with adding only a minimum of target defines (`__amd64__` and `__x86_64__`): While I think this is a step into the right direction it still fails when including `<fenv.h>`.

Btw the GCC folks don't have a complete solution either: If you compile with `-O2` you get the same complaints once the code starts calling `signbit`. Maybe Clang should also implement lazy Sema checking for device side compilation?


Repository:
  rC Clang

https://reviews.llvm.org/D47849





More information about the cfe-commits mailing list