[FEA]: Guarantee monotonic-increating temp_storage_bytes (for d_temp_storage) wrt num_items
- 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.
For many of my algorithms I will be executing a series of cub functions with varying num_items values and it is cost-prohibitive to allocate d_temp_storage each time. I cannot predict ahead-of-time what num_items will be but I can guarantee a tight bound on the max value. I currently query temp_storage_bytes with this bound value and allocate a block of memory of the queried size to use for all subsequent cub functions. This works in practice but so far as I can tell, is not formally guaranteed to work.
### Describe the solution you'd like
Guarantee that (for the same function and same template parameters), the output temp_storage_bytes value is a non-strict monotonic increasing function of num_items.
### Describe alternatives you've considered
Nvidians: don't suggest workarounds and alternative solutions before reading internal discussion on Slack cdd-cub.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.