[Openmp-dev] [RFC] Device runtime library, implementing target specific functions

Jon Chesterfield via Openmp-dev openmp-dev at lists.llvm.org
Thu Aug 8 09:49:20 PDT 2019


One diff currently up uses inline free functions to implement target
specific stuff. That's not obviously a good idea so my reasoning is below.
Please let me know what you think.

No overhead means implementations need to be in headers or the nvptx cmake
needs to apply cross translation unit optimisation. I'm wary of doing the
latter without access to heavy test coverage.

In general, I like static member functions with CRTP for interfaces. No
overhead, can wire in compile time constraints. Quite a lot of boilerplate.
Probably appropriate for things like shuffle. Doesn't handle partial
implementations especially well, e.g. if only part of it is used by a
particular target.

For compatibility shims around popcount or atomicMax we probably want
overloaded free functions or templates though.

So I don't yet know what the right interface will be. It should be safe,
obvious how to implement, flexible enough to adapt to new targets. Allow
shared implementations. Classically difficult problem.

As an interim, I'd like to use free functions. They're not very safe. The
interface is implicit. I wrote the amdgcn version of target_impl by copy
then changing the bodies. Bad times. But they'll be very easy to move
behind whatever set of interfaces look like the right choice when the fog
clears. Definitely not my preferred final design.

Cheers!

Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20190808/4a305603/attachment.html>


More information about the Openmp-dev mailing list