[FEA]: A forwarding call wrapper that proclaims a pure function
- 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
libcu++
### Is your feature request related to a problem? Please describe.
We are currently modifying many device algorithms to be able to work with functors that have side effects that depend on assumptions on what will be passed to these functors (See e.g. #5017, #5504). Making this possible oftentimes negatively impacts performance. If it does we opt to avoid these overheads by keeping the old behavior for known functors and types like `cuda::std::plus<>` on `int`s. Most user-defined functors or classes with operator-overloads do not have side effects so it would be good to provide a way for the user to tell us that we can fall back to the "fast path" (there is no guarantee it will be faster, the user will have to benchmark to make sure).
### Describe the solution you'd like
I think a `cuda::proclaim_pure` or `cuda::proclaim_side_effect_free` similar to the existing `cuda::proclaim_copyable_arguments` would make sense here.
### Describe alternatives you've considered
Alternatively one could add the switch between old and new behavior to the new env-based API, but that would probably add more complexity.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.