NVIDIA / NVIDIA/cccl

[FEA]: Provide interface and implementation for in-place `thrust::copy_if`

Open
#1,799 3 comments 0 reactions 0 assignees View on GitHub
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

Thrust

### Is your feature request related to a problem? Please describe.

Our `thrust::copy_if` interfaces do not support in-place stream compaction. The performance measurements in https://github.com/NVIDIA/cccl/pull/1782#issuecomment-2133809012 and https://github.com/NVIDIA/cccl/pull/1782#issuecomment-2133809012 have highlighted that there is notable performance downside associated with adding precautions (i.e., memory barriers) required to support in-place stream compaction in `thrust::copy_if`. As a result we want to provide in-place stream compaction via its own interface using a specialized code path.

### Describe the solution you'd like

To avoid unwanted ambiguity between existing overloads and the in-place version, we probably want to expose that functionality via a new name (e.g., `thrust::inplace_copy_if`) rather than another set of overloads of `thrust::copy_if`.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.