[FEA]: Design operator specialization for cuda.parallel / C Parallel
- 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
cuda.parallel (Python)
### Is your feature request related to a problem? Please describe.
Currently, cuda.parallel only provides generic version of parallel reduction:
https://github.com/NVIDIA/cccl/blob/83b10c27884dad6006280f6c9b14234f413da704/python/cuda_parallel/cuda/parallel/experimental/algorithms/reduce.py#L167-L172
On the C++ end, we have specialized code paths for some operators:
https://github.com/NVIDIA/cccl/blob/83b10c27884dad6006280f6c9b14234f413da704/cub/cub/warp/specializations/warp_reduce_shfl.cuh#L610-L625
cuda.parallel doesn't use these optimizations, because generic operators are not classified as, say, `cuda::std::plus`.
### Describe the solution you'd like
cuda.parallel should have a way of recognizing standard operators and mapping them to underlying C++ concepts.
### Describe alternatives you've considered
This problem can be split into the interface and implementation components.
On the interface end, one way to achieve that would be through different overloads https://github.com/NVIDIA/cccl/issues/2542.
But we can also consider introspecting the operator, or recognizing built-in functions like `sum` on Python end.
Regardless, before addressing the interface question, we need a machinery to support it on the implementation end.
This issue can be closed by a prototype of an operator specialization machinery that'd allow cuda.parallel to request standard operators like `cuda::std::plus`, `cuda::minimum`, `cuda::maximum`, etc.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.