NVIDIA / NVIDIA/cccl

[FEA]: Annotate cub device functions with `nodiscard`.

Open
#5,604 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
487
Avg merge
2d 7h
Merged PRs (30d)
296

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.

It's easy for me to forget about checking the return status `cudaErrort_t` from cub device functions like `cub::DeviceSegmentedReduce::Sum`, and most of the [snippets](https://nvidia.github.io/cccl/cub/api/structcub_1_1DeviceReduce.html#id1) in the documents don't check the return. It would be great if cub could annotate its device functions with `[[nodiscard]]`.

### Describe the solution you'd like

- Annotate the device functions with `[[nodiscard]]`
- Update document snippets to check the return, or at least indicate there's a return value.

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