This patch replaces the math functions when called on the device with an
__omp_ variant that we can use. This will later be turned back into
the regular math call so we can avoid the problems with including math.h
on the device. This patch introduces the -fopenmp-device-libm flag
which enables the new math wrappers by defining MATH_WRAPPERS in the
header.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
We've got quite a lot of debt in this area and seem at risk of taking on more. Ideally the cuda and hip and openmp headers would be closer to a single header containing:
double acosh(double);
INSTANTIATE(1, acosh, cuda_acosh, amdgpu_acosh, intel_acosh);
clang/lib/Headers/openmp_wrappers/__clang_openmp_math.h | ||
---|---|---|
43 | This is not totally good. Can we do something with macros or code generators instead, even in the first instance? Also wonder if what we actually want to do is map these things onto __gpu_acosh or __llvm_gpu_acosh or similar, there's nothing openmp specific about this and it would be really nice to not end up spinning another copy of this for some other gpu language. |
We want one copy of this, yes. s/omp/llvm_gpu/, sure, though gpu might also not the best name. Generators, macros, etc. I'm not sold. Even if we want to do this, let's not conflate that.
This is not totally good. Can we do something with macros or code generators instead, even in the first instance?
Also wonder if what we actually want to do is map these things onto __gpu_acosh or __llvm_gpu_acosh or similar, there's nothing openmp specific about this and it would be really nice to not end up spinning another copy of this for some other gpu language.