Johannes Doerfert via llvm-dev
2021-Mar-10 19:41 UTC
[llvm-dev] NVPTX codegen for llvm.sin (and friends)
Artem, Justin, I am running into a problem and I'm curious if I'm missing something or if the support is simply missing. Am I correct to assume the NVPTX backend does not deal with `llvm.sin` and friends? This is what I see, with some variations: https://godbolt.org/z/PxsEWs If this is missing in the backend, is there a plan to get this working, I'd really like to have the intrinsics in the middle end rather than __nv_cos, not to mention that -ffast-math does emit intrinsics and crashes. ~ Johannes -- ─────────────────── ∽ Johannes (he/his)
Artem Belevich via llvm-dev
2021-Mar-10 20:38 UTC
[llvm-dev] NVPTX codegen for llvm.sin (and friends)
On Wed, Mar 10, 2021 at 11:41 AM Johannes Doerfert < johannesdoerfert at gmail.com> wrote:> Artem, Justin, > > I am running into a problem and I'm curious if I'm missing something or > if the support is simply missing. > Am I correct to assume the NVPTX backend does not deal with `llvm.sin` > and friends? >Correct. It can't deal with anything that may need to lower to a standard library call.> > This is what I see, with some variations: https://godbolt.org/z/PxsEWs > > If this is missing in the backend, is there a plan to get this working, > I'd really like to have the > intrinsics in the middle end rather than __nv_cos, not to mention that > -ffast-math does emit intrinsics > and crashes. >It all boils down to the fact that PTX does not have the standard libc/libm which LLVM could lower the calls to, nor does it have a 'linking' phase where we could link such a library in, if we had it. Libdevice bitcode does provide the implementations for some of the functions (though with a __nv_ prefix) and clang links it in in order to avoid generating IR that LLVM can't handle, but that's a workaround that does not help LLVM itself. --Artem> > ~ Johannes > > > -- > ─────────────────── > ∽ Johannes (he/his) > >-- --Artem Belevich -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210310/07f048e4/attachment.html>