[DOC]: Document impact of NumItemsT in CUB::DeviceReduce
- 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 bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)
### Is this for new documentation, or an update to existing docs?
Update
### Describe the incorrect/future/missing documentation
The `temp_storage_bytes` deduced varies depending on `NumItemsT`. I have not found references / warnings about this behavior in the CUB documentation. This can create unexpected bugs when working with CUB. I am unaware if this is a documentation issue or a propper bug.
```cpp
#include
#include
int main() {
void *d_temp_storage = nullptr;
float *d_in = nullptr;
float *d_out = nullptr;
size_t num_items = 320 * 512;
{
size_t temp_storage_bytes = 0;
cub::DeviceReduce::Min(d_temp_storage, temp_storage_bytes,
d_in, d_out, (size_t)num_items);
std::cout << "Required temp storage (size_t): "
<< temp_storage_bytes << " bytes\n";
}
{
size_t temp_storage_bytes = 0;
cub::DeviceReduce::Min(d_temp_storage, temp_storage_bytes,
d_in, d_out, (int)num_items);
std::cout << "Required temp storage (int): "
<< temp_storage_bytes << " bytes\n";
}
}
```
```sh
Required temp storage (size_t): 14079 bytes
Required temp storage (int): 20735 bytes
```
### If this is a correction, please provide a link to the incorrect documentation. If this is a new documentation request, please link to where you have looked.
https://nvidia.github.io/cccl/cub/api/structcub_1_1DeviceReduce.html#
Contributor guide
Assessment
This issue has not been assessed yet.