NVIDIA / NVIDIA/cccl

[FEA]: Add tests that verify Thrust/CUB algorithms satisfy necessary requirements about how many times they access inputs/outputs

Open
#1,662 3 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

General CCCL

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

As a user of Thrust/CUB algorithms, I want to be sure that they satisfy any explicit/implicit requirements about how many times elements in the input/output range are dereferenced.

For example, `for_each` must guarantee that each input is only dereferenced exactly once to allow the operator to have side-effects. We don't actually test that today.

### Describe the solution you'd like

We should add testing utilities that verify input/output iterators are dereferenced only once and use those in the appropriate algorithms (e.g., `for_each`).

### Describe alternatives you've considered

_No response_

### Additional context

Today, `for_each` is the only algorithm where we fundamentally require the input elements are only dereferenced once. However, there is interest in potentially expanding this to other algorithms as needed or as possible.

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.