<font size=2 face="sans-serif">Hi Hal,</font><br><br><font size=2 face="sans-serif">Yes we do have an open patch:</font><br><br><a href="https://reviews.llvm.org/D47849"><font size=2 color=blue face="sans-serif">https://reviews.llvm.org/D47849</font></a><br><br><font size=2 face="sans-serif">The solution is to do what CUDA does
today.</font><br><br><br><font size=2 face="sans-serif">Clang-ykt is now actually upstream if
you checkout the <b>patched-upstream</b> branch on Clang, LLVM and OpenMP.</font><br><br><font size=2 face="sans-serif">This is a way of enabling people to
use any patches which haven't been upstreamed yet.</font><br><br><font size=2 face="sans-serif">Current status summary:</font><br><font size=2 face="sans-serif">The <b>patched-upstream</b> branch for
LLVM is identical to the <b>upstream </b>branch (no patches outstanding).</font><br><font size=2 face="sans-serif">The<b> patched-upstream</b> branch for
OpenMP has a 1 line patch.</font><br><font size=2 face="sans-serif">The<b> patched-upstream </b>branch for
Clang has a few patches: the static linking patch and the math functions
patch.</font><br><br><font size=2 face="sans-serif">For consistency (and just in case in
the future those branches may contain patches) I just point everyone to
use the <b>patched-upstream</b> branches.</font><br><br><font size=2 face="sans-serif">Thanks,</font><br><br><font size=2 face="sans-serif">--Doru</font><br><br><br><br><br><font size=1 color=#5f5f5f face="sans-serif">From:      
 </font><font size=1 face="sans-serif">"Finkel, Hal J."
<hfinkel@anl.gov></font><br><font size=1 color=#5f5f5f face="sans-serif">To:      
 </font><font size=1 face="sans-serif">Gheorghe-Teod Bercea
<Gheorghe-Teod.Bercea@ibm.com>, James Price <J.Price@bristol.ac.uk></font><br><font size=1 color=#5f5f5f face="sans-serif">Cc:      
 </font><font size=1 face="sans-serif">"openmp-dev@lists.llvm.org"
<openmp-dev@lists.llvm.org></font><br><font size=1 color=#5f5f5f face="sans-serif">Date:      
 </font><font size=1 face="sans-serif">03/19/2019 12:03 PM</font><br><font size=1 color=#5f5f5f face="sans-serif">Subject:    
   </font><font size=1 face="sans-serif">Re: [Openmp-dev]
Math functions when offloading to CUDA devices</font><br><hr noshade><br><br><br><font size=3>Hi, Doru,</font><p><font size=3>What's the underlying problem and how does clang-ykt fix
it? Do we have open reviews that resolve this upstream?</font><p><font size=3>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.</font><p><font size=3>Thanks again,</font><p><font size=3>Hal</font><p><font size=3>On 3/19/19 9:22 AM, Gheorghe-Teod Bercea via Openmp-dev
wrote:</font><br><font size=2 face="sans-serif">Hi James,</font><font size=3><br></font><font size=2 face="sans-serif"><br>If you're installing the compiler from source please use the following
version.</font><font size=3><br></font><font size=2 face="sans-serif"><br>This is a mirror of trunk:</font><font size=3><br></font><font size=3 color=blue><u><br></u></font><a href="https://github.com/clang-ykt"><font size=2 color=blue face="sans-serif"><u>https://github.com/clang-ykt</u></font></a><font size=3><br></font><font size=2 face="sans-serif"><br>Clone Clang, LLVM and OpenMP runtime.</font><font size=3><br></font><font size=2 color=#008000 face="sans-serif"><br>IMPORTANT: For each repo checkout <b>patched-upstream</b> branch.</font><font size=3><br></font><font size=2 face="sans-serif"><br>The Clang <b>patched-upstream</b> branch contains a patch that fixes your
problem.</font><font size=3><br></font><font size=2 face="sans-serif"><br>Thanks,</font><font size=3><br></font><font size=2 face="sans-serif"><br>--Doru<br></font><font size=3><br><br><br><br></font><font size=1 color=#5f5f5f face="sans-serif"><br>From:        </font><font size=1 face="sans-serif">James
Price via Openmp-dev </font><a href="mailto:openmp-dev@lists.llvm.org"><font size=1 color=blue face="sans-serif"><u><openmp-dev@lists.llvm.org></u></font></a><font size=1 color=#5f5f5f face="sans-serif"><br>To:        </font><a href="mailto:openmp-dev@lists.llvm.org"><font size=1 color=blue face="sans-serif"><u>"openmp-dev@lists.llvm.org"</u></font></a><font size=1 face="sans-serif"></font><a href="mailto:openmp-dev@lists.llvm.org"><font size=1 color=blue face="sans-serif"><u><openmp-dev@lists.llvm.org></u></font></a><font size=1 color=#5f5f5f face="sans-serif"><br>Date:        </font><font size=1 face="sans-serif">03/19/2019
07:51 AM</font><font size=1 color=#5f5f5f face="sans-serif"><br>Subject:        </font><font size=1 face="sans-serif">[Openmp-dev]
Math functions when offloading to CUDA devices</font><font size=1 color=#5f5f5f face="sans-serif"><br>Sent by:        </font><font size=1 face="sans-serif">"Openmp-dev"
</font><a href="mailto:openmp-dev-bounces@lists.llvm.org"><font size=1 color=blue face="sans-serif"><u><openmp-dev-bounces@lists.llvm.org></u></font></a><font size=3><br></font><hr noshade><font size=3><br><br></font><tt><font size=2><br>Hi,<br><br>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:<br><br>   fatal error: error in backend: Cannot select: 0x47b33a0: f64 =
fsin 0x47b2f90<br><br>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).<br><br>Some functions such as sqrt work fine, but I assume this is because they
map directly to NVVM intrinsics.<br><br>Cheers,<br><br>James<br><br>_______________________________________________<br>Openmp-dev mailing list</font></tt><tt><font size=2 color=blue><u><br></u></font></tt><a href="mailto:Openmp-dev@lists.llvm.org"><tt><font size=2 color=blue><u>Openmp-dev@lists.llvm.org</u></font></tt></a><font size=3 color=blue><u><br></u></font><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev"><tt><font size=2 color=blue><u>https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</u></font></tt></a><tt><font size=2><br></font></tt><font size=3><br><br><br><br></font><br><tt><font size=3>_______________________________________________<br>Openmp-dev mailing list<br></font></tt><a href="mailto:Openmp-dev@lists.llvm.org"><tt><font size=3 color=blue><u>Openmp-dev@lists.llvm.org</u></font></tt></a><tt><font size=3><br></font></tt><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev"><tt><font size=3 color=blue><u>https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</u></font></tt></a><tt><font size=3><br></font></tt><br><tt><font size=3>-- <br>Hal Finkel<br>Lead, Compiler Technology and Programming Languages<br>Leadership Computing Facility<br>Argonne National Laboratory</font></tt><br><br><BR>