NVIDIA / NVIDIA/cccl

[BUG]: cub::DeviceSegmentedReduce algorithms are not tested for when offsets are passed with Thrust custom iterators.

Open
#1,510 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [X] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Type of Bug

Silent Failure

### Component

CUB

### Describe the bug

The `cub::DeviceSegmentedReduce` set of algorithms is not tested against thrust iterators (e.g. `thrust::device_vector::iterator`) as offset inputs. We only test them for when offsets are passed as raw pointers.

In the corresponding test https://github.com/NVIDIA/cccl/blob/main/cub/test/catch2_test_device_segmented_reduce_iterators.cu we should be also checking for when offsets are passed as thrust iterators beyond just raw pointers.

This is related to #1509.

### How to Reproduce

This code should be tested and pass:

```c++
thrust::device_vector d_offsets = {0, 1, 2};
thrust::device_vector d_in{0, 1, 2};
thrust::device_vector d_out(3);
void* d_temp_storage = nullptr;
size_t temp_storage_bytes = 0;

cub::DeviceSegmentedReduce::Sum(
d_temp_storage,
temp_storage_bytes,
d_in.begin(),
d_out.begin(),
3,
d_offsets.begin(),
d_offsets.end());
```

### Expected behavior

`cub::DeviceSegmentedReduce` should accept any custom thrust iterators as offset iterator types.

### Reproduction link

_No response_

### Operating System

_No response_

### nvidia-smi output

_No response_

### NVCC version

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.