[clang] [CUDA][HIP] Fix std::is_invocable (PR #70369)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 10:40:32 PDT 2023


================
@@ -283,12 +283,18 @@ set(cuda_wrapper_files
   cuda_wrappers/cmath
   cuda_wrappers/complex
   cuda_wrappers/new
+  cuda_wrappers/type_traits
 )
 
 set(cuda_wrapper_bits_files
   cuda_wrappers/bits/shared_ptr_base.h
   cuda_wrappers/bits/basic_string.h
   cuda_wrappers/bits/basic_string.tcc
+  cuda_wrappers/bits/move.h
+)
+
+set(cuda_wrapper_utility_files
+  cuda_wrappers/__utility/swap.h
----------------
Artem-B wrote:

> Basically <type_traits> declares swap, which becomes host device. But it is defined in . To avoid conflict, we have to wrap up . However, includes and .

Looks like some words/references got dropped, but I think I see what's going on.

In general, such a piecemeal approach will inherently rely on the implementation details of the library headers and that may change at any point in time. 

I'm more and more leaning towards adding a knob that would allow *all* functions without explicit target attributes to be treated as host-device. That will likely break existing code, but this may make it possible to interoperate with the existing c++ code much better. We already have postponed diags for HD code, so compiling generic C++ code for the GPU would become a best-effort for non-CUDA code. If it works,. great. If not, then it would be up to user to port it, but the main advantage is that we will not need to chase the implementation details and would only need to handle the cases that really need porting and that will likely be a much smaller subset of the code we'll see.


https://github.com/llvm/llvm-project/pull/70369


More information about the cfe-commits mailing list