NVIDIA / NVIDIA/cccl

[FEA]: [CUB]: support passing in no initial values for various reduce + scan algorithms

Open
#10,942 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 request and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Area

CUB

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

#9289 exposed the no initial value option for `cub::DeviceReduce` for `run_to_run` determinism. We should extend this to other algorithms that currently expect an initial value:

- [ ] `cub::DeviceReduce`: `not_guaranteed` + `gpu_to_gpu` determinism
- [ ] `cub::DeviceScan`: `ExclusiveScan` always expects an initial value, while `InclusiveScan` does not, but has a separate `InclusiveScanInit` overload. We should deprecate this extra overload and use a similar solution to `DeviceReduce`. We should also make sure to support all determinism levels.
- [x] `cub::DeviceSegmentedReduce`
- [ ] `cub::DeviceSegmentedScan`
- [ ] `cub::DeviceScan::ExclusiveScanByKey`

### Describe the solution you'd like

An overload that allows the caller to omit the initial value for the above algorithms, without having a separate function like `InclusiveScanInit`.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the existing no-initial-value cub::DeviceReduce behavior introduced in #9289, then compare the remaining listed reduce and scan algorithms. Define consistent overload and determinism behavior, including the InclusiveScanInit transition; the work is done when the unchecked algorithms support omitted initial values without separate function names.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.