Conversation
|
I wanted to start a discussion for some time to add such a trait, but I would really keep this feature internally for now until it is sufficiently baked. I would really like this feature to make |
davebayer
left a comment
There was a problem hiding this comment.
I am not a fan of this trait. We bend C++ rules to fix poorly designed nvfp types. We would have to basically change every use of is_trivially_copyable and is_trivially_copy_constructible to this trait to make it work consistently in libcu++.
I don't think this is a good idea, we should rather insist of the nvfp types being fixed.
docs/libcudacxx/extended_api/type_traits/is_trivially_copyable_relaxed.rst
Outdated
Show resolved
Hide resolved
| Users may specialize ``cuda::is_trivially_copyable_relaxed`` for their own types whose memory representation is safe to copy | ||
| with ``memcpy`` but that the compiler does not consider trivially copyable. |
There was a problem hiding this comment.
not for the types that we care about. Said that, the user could provide an object that triggers UB. I can highlight this point in the documentation but we cannot do anything to explicitly prevent it.
Integrated and extended the tests that you point out. Everything works |
the actual issue is that the user can extend the trait to custom types. It needs to be public |
there are no plan for that. nvfp types are not trivially copyable for optimization purposes. |
This isn't going to happen and we shouldn't delude ourselves into thinking it ever will. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
😬 CI Workflow Results🟥 Finished in 1h 18m: Pass: 90%/99 | Total: 1d 03h | Max: 1h 12m | Hits: 99%/231754See results here. |
Description
Followup of the discussion in
warp_shuffleoriginal behavior (revert #8210) #8254The PR introduces
cuda::is_trivially_copyable_relaxedto support types that are actually trivially copyable but not recognized by the C++std::is_trivially_copyabletype trait.The new trait supports:
cuda::std::array.cuda::std::pair.cuda::std::tuple.Potentially affected paths by
std::is_trivially_copyableunsupported cases:
cuda/std/__atomic/types/base.h:39cuda/std/__atomic/types/reference.h:39cuda/__memcpy_async/memcpy_async_barrier.h:61cuda/__memcpy_async/memcpy_async_tx.h:58cuda/__container/buffer.h:111cuda/__algorithm/copy.h:73cuda/__algorithm/fill.h:42cuda/std/string_view:147fallback to slower path:
cuda/std/__algorithm/copy.h:102cuda/std/__algorithm/copy_backward.h:50cuda/std/__algorithm/move.h:54cuda/std/__algorithm/move_backward.h:53cuda/std/__bit/bit_cast.h:55cub/device/dispatch/kernels/kernel_histogram.cuh:81cub/detail/uninitialized_copy.cuh:33thrust/type_traits/is_trivially_relocatable.h:213cudax/include/cuda/experimental/__kernel/kernel_ref.cuh:54