From cab5ef20b45ff6083d998ef52ad78e51000b4a33 Mon Sep 17 00:00:00 2001 From: Gabe Schwartz Date: Thu, 10 Aug 2023 11:54:36 -0700 Subject: [PATCH] Clarify docstring for num_items parameter of DeviceSegmentedRadixSort In the case where the user specifies non-contiguous segments (segments which do not cover the entirety of `d_keys_in`), the `num_items` parameter must include non-covered items. It should be the length of the total range to sort, from the start of the first segment to the end of the last, inclusive of any unused elements. --- .../device/device_segmented_radix_sort.cuh | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/cub/cub/device/device_segmented_radix_sort.cuh b/cub/cub/device/device_segmented_radix_sort.cuh index 9c59e59fd8..8620e8a237 100644 --- a/cub/cub/device/device_segmented_radix_sort.cuh +++ b/cub/cub/device/device_segmented_radix_sort.cuh @@ -182,7 +182,10 @@ struct DeviceSegmentedRadixSort * sequence of associated value items * * @param[in] num_items - * The total number of items to sort (across all segments) + * The total number of items to sort (across all segments). If segments + * are non-contiguous, this should include unused items in between + * segments, namely all items between the start of the first and end + * of the last segment. * * @param[in] num_segments * The number of segments that comprise the sorting data @@ -408,7 +411,10 @@ struct DeviceSegmentedRadixSort * to the sorted output values * * @param[in] num_items - * The total number of items to sort (across all segments) + * The total number of items to sort (across all segments). If segments + * are non-contiguous, this should include unused items in between + * segments, namely all items between the start of the first and end + * of the last segment. * * @param[in] num_segments * The number of segments that comprise the sorting data @@ -615,7 +621,10 @@ struct DeviceSegmentedRadixSort * sequence of associated value items * * @param[in] num_items - * The total number of items to sort (across all segments) + * The total number of items to sort (across all segments). If segments + * are non-contiguous, this should include unused items in between + * segments, namely all items between the start of the first and end + * of the last segment. * * @param[in] num_segments * The number of segments that comprise the sorting data @@ -843,7 +852,10 @@ struct DeviceSegmentedRadixSort * to the sorted output values * * @param[in] num_items - * The total number of items to sort (across all segments) + * The total number of items to sort (across all segments). If segments + * are non-contiguous, this should include unused items in between + * segments, namely all items between the start of the first and end + * of the last segment. * * @param[in] num_segments * The number of segments that comprise the sorting data @@ -1040,7 +1052,10 @@ struct DeviceSegmentedRadixSort * Device-accessible pointer to the sorted output sequence of key data * * @param[in] num_items - * The total number of items to sort (across all segments) + * The total number of items to sort (across all segments). If segments + * are non-contiguous, this should include unused items in between + * segments, namely all items between the start of the first and end + * of the last segment. * * @param[in] num_segments * The number of segments that comprise the sorting data @@ -1240,7 +1255,10 @@ struct DeviceSegmentedRadixSort * point to the sorted output keys * * @param[in] num_items - * The total number of items to sort (across all segments) + * The total number of items to sort (across all segments). If segments + * are non-contiguous, this should include unused items in between + * segments, namely all items between the start of the first and end + * of the last segment. * * @param[in] num_segments * The number of segments that comprise the sorting data @@ -1431,7 +1449,10 @@ struct DeviceSegmentedRadixSort * Device-accessible pointer to the sorted output sequence of key data * * @param[in] num_items - * The total number of items to sort (across all segments) + * The total number of items to sort (across all segments). If segments + * are non-contiguous, this should include unused items in between + * segments, namely all items between the start of the first and end + * of the last segment. * * @param[in] num_segments * The number of segments that comprise the sorting data @@ -1630,7 +1651,10 @@ struct DeviceSegmentedRadixSort * point to the sorted output keys * * @param[in] num_items - * The total number of items to sort (across all segments) + * The total number of items to sort (across all segments). If segments + * are non-contiguous, this should include unused items in between + * segments, namely all items between the start of the first and end + * of the last segment. * * @param[in] num_segments * The number of segments that comprise the sorting data