[llvm-dev] NVPTX codegen for llvm.sin (and friends) (original) (raw)

Artem Belevich via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 10 12:38:38 PST 2021


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 nvcos, 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>



More information about the llvm-dev mailing list