libcudacxx icon indicating copy to clipboard operation
libcudacxx copied to clipboard

When building with NVC++, build everything in the libcu++ binary library for host and device

Open brycelelbach opened this issue 3 years ago • 0 comments

Right now, when we build libcu++ as standalone C++ Standard Library (e.g. std::) for NVC++, I believe we don't hijack the inline visibility macro to make everything __host__ __device__; More importantly, the things in the libc++ binary (e.g. the .cpp files) are not annotated with the inline visibility macro. Instead we rely on execution space inference. This will work for most things, because most of the library is in headers which will be compiled by users, and thus will be annotated host/device based on use.

However, for functions that are compiled into the libcu++ binary, we can't rely on execution space inference.

For example, a lot of std::string is in the binary library.

Solutions:

  1. Annotate all the functions we need, either by hijacking the inline visibility macros or adding annotations.
  2. Move all the functionality into headers.
  3. Add a mechanism that lets us tell the compiler to assume everything in a TU needs to be built for host and device.
  4. Add a mechanism for applying execution space annotations to everything in a namespace or class scope.

brycelelbach avatar Mar 29 '21 18:03 brycelelbach