Repository navigation
64-bit indexing for DeviceSegmentedReduce - #414
Conversation
* Added NumSegmentsT parameter to methods, so now num_segments can be of any integral type * Added OffsetT type resolution in a manner similar to DeviceReduce: set to std::common_type_t of BeginOffsetIterT::value_type and EndOffsetIterT::value_type. (see detail/choose_offset.cuh) * In a manner similar to DeviceReduce, we use static_cast to convert num_segments to OffsetT before dispatching * OffsetT type resolution uses std::common_type_t, std::void_t, and one inline constexpr variable (is_iterator_v).
|
Hi, should I create an Issue and add it to the description? I originally submitted this PR to the old Cub repository. |
gevtushenko
left a comment
There was a problem hiding this comment.
Thank you for the contribution! I've left a few comments, but before proceeding with the review, we'll need a test case that covers 64-bit problem sizes. Could you please add one? In order to keep moderate memory usage, you could try to rely on counting or constant iterators instead of actually allocating huge inputs.
Thank you for the feedback! Yes, sure thing. I'll write a quick test using some kind of counter iterator- or constant iterator-based approach. |
miscco
left a comment
There was a problem hiding this comment.
Thanks a lot for the contribution, I am so sorry about our support situation
* Removed NumSegmentsT portion * Added catch2 test * Modified previous test slightly to use correct type for num_segments * Made type deduction SFINAE-friendly
|
@miscco @senior-zero Ready. (I hope.) I walked back 64-bit num_segments. I hope to submit that in a new Pull Request in the near future. For the test, I simply copied the previous test and modified it slightly. |
|
/ok to test |
|
Whoops! I deleted the offending lines and ran C++11 tests on my end. Everything seems to work now. Getting your code to be compliant with several standards is tricky business. |
Device reduce 64bit
|
/ok to test |
|
@senior-zero I added you as a collaborator on my fork in case you'd like to make more changes. |
|
/ok to test |
|
@senior-zero @miscco Thank you both so much for your excellent feedback and for guiding me through the process! I learned a lot from this experience. It's my first time submitting a pull request to a public project like this. And thank you for teaching me about the "forbidden fruit" hidden within |
|
@jecs thank you for the contribution! |
- Retain offset_t/SegmentSizeT comments across all fixed-size env overloads - Retain PR NVIDIA#414 breaking-change comments in ArgMin/ArgMax env overloads - Refactor fixed-size ArgMin/ArgMax into shared private helpers (fixed_size_arg_min_dispatch, fixed_size_arg_max_dispatch) to reduce duplication between env and non-env overloads
- Retain offset_t/SegmentSizeT comments across all fixed-size env overloads - Retain PR NVIDIA#414 breaking-change comments in ArgMin/ArgMax env overloads - Refactor fixed-size ArgMin/ArgMax into shared private helpers (fixed_size_arg_min_dispatch, fixed_size_arg_max_dispatch) to reduce duplication between env and non-env overloads
- Retain offset_t/SegmentSizeT comments across all fixed-size env overloads - Retain PR NVIDIA#414 breaking-change comments in ArgMin/ArgMax env overloads - Refactor fixed-size ArgMin/ArgMax into shared private helpers (fixed_size_arg_min_dispatch, fixed_size_arg_max_dispatch) to reduce duplication between env and non-env overloads
- Retain offset_t/SegmentSizeT comments across all fixed-size env overloads - Retain PR NVIDIA#414 breaking-change comments in ArgMin/ArgMax env overloads - Refactor fixed-size ArgMin/ArgMax into shared private helpers (fixed_size_arg_min_dispatch, fixed_size_arg_max_dispatch) to reduce duplication between env and non-env overloads
- Retain offset_t/SegmentSizeT comments across all fixed-size env overloads - Retain PR NVIDIA#414 breaking-change comments in ArgMin/ArgMax env overloads - Refactor fixed-size ArgMin/ArgMax into shared private helpers (fixed_size_arg_min_dispatch, fixed_size_arg_max_dispatch) to reduce duplication between env and non-env overloads
* Add fixed-size segment env overloads for DeviceSegmentedReduce * Fix critical issues plus<> specilization * feedback address - Retain offset_t/SegmentSizeT comments across all fixed-size env overloads - Retain PR #414 breaking-change comments in ArgMin/ArgMax env overloads - Refactor fixed-size ArgMin/ArgMax into shared private helpers (fixed_size_arg_min_dispatch, fixed_size_arg_max_dispatch) to reduce duplication between env and non-env overloads * Refactor * More refactoring * Refactor: unify fixed-size ArgMin/ArgMax dispatch into a single function * Make using offset_t = int explicit * Substitute cudaStream_t with cuda::stream and use always stream.sync() but outside of the literalinclude guards * Guard Sum with sfinae * Sfinae operator<<(os,...) for cuda::std::pairs * Do not specialize std::plus<> --------- Co-authored-by: Bernhard Manfred Gruber <bernhardmgruber@gmail.com>
…A#8097) * Add fixed-size segment env overloads for DeviceSegmentedReduce * Fix critical issues plus<> specilization * feedback address - Retain offset_t/SegmentSizeT comments across all fixed-size env overloads - Retain PR NVIDIA#414 breaking-change comments in ArgMin/ArgMax env overloads - Refactor fixed-size ArgMin/ArgMax into shared private helpers (fixed_size_arg_min_dispatch, fixed_size_arg_max_dispatch) to reduce duplication between env and non-env overloads * Refactor * More refactoring * Refactor: unify fixed-size ArgMin/ArgMax dispatch into a single function * Make using offset_t = int explicit * Substitute cudaStream_t with cuda::stream and use always stream.sync() but outside of the literalinclude guards * Guard Sum with sfinae * Sfinae operator<<(os,...) for cuda::std::pairs * Do not specialize std::plus<> --------- Co-authored-by: Bernhard Manfred Gruber <bernhardmgruber@gmail.com>
Description
Checklist