One of the issues we frequently hit when using the Clang OpenMP implementation on NVIDIA GPUs is the lack of support for many common math functions (e.g. cos/sin). Trying to use them produces errors of the form:
Translating math functions in target regions is listed as a feature that isn’t supported yet, but is this something that is expected to be implemented soon? Failing that, if someone can describe the desired approach to implement this I might be able to take a stab at getting some initial patches together (depending on the complexity).
Some functions such as sqrt work fine, but I assume this is because they map directly to NVVM intrinsics.
However, when I use clang built from mainstream to build the clang-ykt offload compiler, I got a device library issue when linking my application
My solution is just building a clang using sources from clang-ykt repo with -DOPENMP_ENABLE_LIBOMPTARGET=OFF first and then use it to build clang-ykt with offload on.
Best,
What’s the underlying problem and how does clang-ykt fix it? Do we have open reviews that resolve this upstream?
I recall that these functions are provided by libdevice.*.bc and that some renaming needs to happen to get this to work. Also, I recall there being some reviews open on this, but I don’t now recall which ones and where.
Clang-ykt is now actually upstream if you checkout the patched-upstream branch on Clang, LLVM and OpenMP.
This is a way of enabling people to use any patches which haven’t been upstreamed yet.
Current status summary:
The patched-upstream branch for LLVM is identical to the upstream branch (no patches outstanding).
The patched-upstream branch for OpenMP has a 1 line patch.
The patched-upstream branch for Clang has a few patches: the static linking patch and the math functions patch.
For consistency (and just in case in the future those branches may contain patches) I just point everyone to use the patched-upstream branches.