NVIDIA / NVIDIA/cccl

[FEA]: [cccl.c] Enable iterators to be used as the begin and end offsets in segmented_sort

Open
#6,468 0 comments 0 reactions 1 assignee Claimed by @NaderAlAwar 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 request and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Area

cuda.compute (Python)

### Is your feature request related to a problem? Please describe.

In cccl.c, using iterators such as the step counting iterator instead of device arrays as the begin and end segment offsets in `segmented_sort` does not work currently. Enabling this use case would save a lot of device memory.

This does not work currently because we need to have a host class in cccl.c to hold the state of the iterator that the user passes. When that state is a pointer, this works fine, since `selector_state_t` holds one pointer for each of begin and end offsets. However, the user could pass an iterator that can be any size, such as a step counting iterator which contains an id and segment size members.

### Describe the solution you'd like

In order to support this, one option is to malloc a buffer of some specific size and memcpy the state of the caller's iterator to this buffer.

### Describe alternatives you've considered

_No response_

### Additional context

_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.