-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std::is_trivially_copy_constructible requirement for kernel parameters still too strong #551
Comments
To justify your suggestion, please disprove my logic for choosing this trait: An argument of a kernel does not get "copy-constructed" in GPU global memory; it is copied as raw bytes. Thus, if it cannot be copy-constructed by trivial copying - it cannot be assumed to be a valid constructed object of the relevant type. |
Well, in theory In practice I can't update my research group's codebases written by @codecircuit using cuda-api-wrappers 0.4.x to use >=0.5. And in practice I expect a C++ library for CUDA programming to be composable with Thrust iterators. I don't expect the Thrust team to change their working public API for this Maybe a preprocessor switch to turn off that |
I can't go on what a type should be "in theory". If you write:
I can't accept your struct, since the compiler doesn't "know" that this is equivalent to trivial copy construction. And that copy ctor could, in principle, say, flip x and y if we're on the device side and not flip them on the host side. ... but - now that you mention it, I did a bit of DDG'ing, and I'm wondering whether |
I just chose It is a bit hard to decipher the source due to multiple layers of CRTP ( #if THRUST_CPP_DIALECT >= 2011
counting_iterator & operator=(const counting_iterator &) = default;
#endif What I know is that all these iterator types are supposed to be safe in regards to passing them as kernel parameters. |
Let's say I'm willing to accept it on faith that these types are safe for passing. So, shall I hard-code somehow for all the thrust iterator types you tell me about? That doesn't sound right (if it's at all doable). But if I don't hard-code, and instead just remove the restriction - who's to say users won't pass a "I know it should be safe" is not a criterion I can work with... how about you open a bug report against thrust (or the unified CCCL) about this, and post a link here? I'm willing to have a discussion about this with the developers there. Maybe there's an option I'm failing to consider. |
@pauleonix : Do you think there'll be any traction from the NVIDIA side? |
I don't see what's the big deal in just fixing the iterators on their side. |
What I know is that they are working on ranges, so I expect some kind of |
So, we can close this. But - note I am considering strengthening the requirements further: #642 . |
Even the most basic "fancy iterator" from Thrust
thrust::constant_iterator
thrust::counting_iterator
doesn't fulfill the requirement making algorithms written using cuda-api-wrappers for launching kernels less flexible.constant_iterator
constructorSee
Compiler ExplorerCompiler Explorer.The text was updated successfully, but these errors were encountered: