libcudacxx icon indicating copy to clipboard operation
libcudacxx copied to clipboard

Feature: clang CUDA (device compilation) support

Open MatthiasKohl opened this issue 2 years ago • 5 comments

This issue is similar to this one in cuCollections: https://github.com/NVIDIA/cuCollections/issues/128

While working on RAFT (primitives for RADPIS, PR: https://github.com/rapidsai/raft/pull/424), I noticed that libcudacxx doesn't support having its device code compiled with clang.

It would be great to support this, if possible. If test coverage is good enough, it's usually good enough to simply transform nvcc commands to clang for which I have a somewhat usable script in the above mentioned PR for RAFT, and apply those commands to the entire test suite.

MatthiasKohl avatar Dec 16 '21 20:12 MatthiasKohl

We'll place this on a milestone once we get gpuCI, that's a prerequisite to this as we don't have the capacity on DVS.

wmaxey avatar Dec 17 '21 01:12 wmaxey

This was supported a year ago. @MatthiasKohl what error are you encountering?

gonzalobg avatar May 10 '22 11:05 gonzalobg

Responded with PM, the error comes from using cuCollections and in particular, the static map implementation.

MatthiasKohl avatar May 10 '22 12:05 MatthiasKohl

I am having the same kind of issue trying to compile cuDF with clang as device compiler. The specific error I'm observing occurs in type_traits:

In file included from /home/tribizel/cudf/cpp/build/_deps/libcudacxx-src/include/cuda/std/limits:16:
In file included from /home/tribizel/cudf/cpp/build/_deps/libcudacxx-src/include/cuda/std/type_traits:24:
/home/tribizel/cudf/cpp/build/_deps/libcudacxx-src/include/cuda/std/detail/libcxx/include/type_traits:520:12: error: CUDA device code does not support variadic functions
false_type __sfinae_test_impl(...);
           ^
/home/tribizel/cudf/cpp/build/_deps/libcudacxx-src/include/cuda/std/detail/libcxx/include/type_traits:1059:69: error: CUDA device code does not support variadic functions
    template <class _Tp> _LIBCUDACXX_INLINE_VISIBILITY static __two __test(...);
                                                                    ^
/home/tribizel/cudf/cpp/build/_deps/libcudacxx-src/include/cuda/std/detail/libcxx/include/type_traits:1171:5: error: CUDA device code does not support variadic functions
    __any(...);
    ^
/home/tribizel/cudf/cpp/build/_deps/libcudacxx-src/include/cuda/std/detail/libcxx/include/type_traits:1848:16: error: CUDA device code does not support variadic functions
   static void __test(...);
               ^
/home/tribizel/cudf/cpp/build/_deps/libcudacxx-src/include/cuda/std/detail/libcxx/include/type_traits:2272:18: error: CUDA device code does not support variadic functions
    static __two __test (...);
                 ^
/home/tribizel/cudf/cpp/build/_deps/libcudacxx-src/include/cuda/std/detail/libcxx/include/type_traits:4332:16: error: CUDA device code does not support variadic functions
  static __nat __try_call(...);

This is running clang 14.0.6 compiled using spack based on CUDA 10.2

upsj avatar Jul 06 '22 14:07 upsj

For clang you probably need to enable the use of variadic functions with -fcuda-allow-variadic-functions

maddyscientist avatar Jul 06 '22 22:07 maddyscientist