[FEA]: Add the possibility for variable length (length provided through int pointer) sort
- 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.
One particular use case is a collision detection pipeline of a physics engine or any other application that uses graph capture on an algorithm that needs to process variable array length quantities every timestep (you cannot know the number of active contacts per frame in advance). Re-capturing the graph is not an option since it adds too much performance overhead.
### Describe the solution you'd like
Support for sort and (inclusive and exclusive) scan that can take the length of the array to process as a single element gpu array would be very useful. Since graph capture is a must to get good performance, the only practical solution is currently to always schedule sort or scan for the maximal number of elements that could be present which is wasteful in many cases.
### Describe alternatives you've considered
We currently always scan/sort for the worst case length. We also tried a custom implementation for scan and sort but as expected, we cannot match the performance of Cub and rewriting such standard algorithms feels like reinventing he wheel.
### Additional context
The phyiscs engine in question is Newton (https://github.com/newton-physics/newton). Since the kernel launches are scheduled from Python, graph capture and reusing the graph is even more important due to the massive overhead of running Python code.
Contributor guide
Assessment
This issue has not been assessed yet.