Skip to content

Commit 742f993

Browse files
committed
addresses review comments
1 parent 0b963f9 commit 742f993

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

cub/test/catch2_radix_sort_helper.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ using all_offset_types =
6060
template <typename OffsetT, OffsetT Step>
6161
struct segment_iterator
6262
{
63-
std::int64_t last = 0;
63+
OffsetT last = 0;
6464

6565
segment_iterator(std::int64_t last1)
6666
: last{last1}
6767
{}
6868

6969
__host__ __device__ OffsetT operator()(std::int64_t x) const
7070
{
71-
return x * Step > last ? last : x * Step;
71+
return ::cuda::std::min(last, x * Step);
7272
}
7373
};
7474

cub/test/catch2_segmented_sort_helper.cuh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class short_key_verification_helper
116116
private:
117117
using key_t = KeyT;
118118
// The histogram size of the keys being sorted for later verification
119-
static constexpr auto max_histo_size = 1ULL << (8 * sizeof(key_t));
119+
const std::int64_t max_histo_size = std::int64_t{1} << ::cuda::std::numeric_limits<key_t>::digits;
120120

121121
// Holding the histogram of the keys being sorted for verification
122122
c2h::host_vector<std::size_t> keys_histogram{};
@@ -170,28 +170,28 @@ private:
170170
c2h::host_vector<int> compute_histogram_of_series(std::size_t segment_offset, std::size_t segment_end) const
171171
{
172172
// The i-th full cycle begins after segment_offset
173-
std::size_t start_cycle = cuda::ceil_div(segment_offset, sequence_length);
173+
const auto start_cycle = cuda::ceil_div(segment_offset, sequence_length);
174174

175175
// The last full cycle ending before segment_end
176-
std::size_t end_cycle = segment_end / sequence_length;
176+
const auto end_cycle = segment_end / sequence_length;
177177

178178
// Number of full cycles repeating the sequence
179-
int full_cycles = (end_cycle > start_cycle) ? static_cast<int>(end_cycle - start_cycle) : 0;
179+
const int full_cycles = (end_cycle > start_cycle) ? static_cast<int>(end_cycle - start_cycle) : 0;
180180

181181
// Add contributions from full cycles
182182
c2h::host_vector<int> histogram(sequence_length, full_cycles);
183183

184184
// Partial cycles preceding the first full cycle
185185
for (std::size_t j = segment_offset; j < start_cycle * sequence_length; ++j)
186186
{
187-
std::size_t value = j % sequence_length;
187+
const auto value = j % sequence_length;
188188
histogram[value]++;
189189
}
190190

191191
// Partial cycles following the last full cycle
192192
for (std::size_t j = end_cycle * sequence_length; j < segment_end; ++j)
193193
{
194-
std::size_t value = j % sequence_length;
194+
const auto value = j % sequence_length;
195195
histogram[value]++;
196196
}
197197
return histogram;

0 commit comments

Comments
 (0)