-
Notifications
You must be signed in to change notification settings - Fork 918
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
Add compile time check to ensure the counting_iterator
type in counting_transform_iterator
fits in size_type
#17118
Add compile time check to ensure the counting_iterator
type in counting_transform_iterator
fits in size_type
#17118
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good change, even if it is a bit breaking. Reminds me of the surprising return value type in std::accumulate
, which is determined using the initial value, rather than the type that the binaryOp takes or returns.
I think this is worth a PSA, to make sure the size_type
conversion is not actually a desired feature.
The intention was to use the transform iterator with thrust and since we only use the 32-bit bound thrust/cub calls, this was a good reminder/check not to use more than |
I see. Yeah it makes sense in that case.
I agree but perhaps we should add some compile-time check as well in addition to documenting it? |
start
argument to counting_transform_iterator
start
argument to counting_transform_iterator
fits in size_type
start
argument to counting_transform_iterator
fits in size_type
counting_iterator
type in counting_transform_iterator
fits in size_type
Co-authored-by: Yunsong Wang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Left a comment about using static_assert
.
/merge |
Description
This PR adds a compile time check to enforce that the
start
argument tocudf::detail::counting_transform_iterator
, which is used to determine the type ofcounting_iterator
, is of a type that fits inint32_t
(akasize_type
). The PR also modifies the instances ofcounting_transform_iterator
that need to work withcounting_iterators
of type >int32_t
to manually createdcounting_transform_iterators
using thrust.More context in this comment.
Checklist