Skip to content

Old Thrust copy of CUB reduce is mostly deadcode and should be removed, but is still used by extrema functions #4475

@brycelelbach

Description

@brycelelbach

Many years ago we switched thrust::reduce/thrust::reduce_by_key to use CUB directly instead of using Thrust's old copy of CUB. This was done because of perf issues in the old copy of CUB reduce.

However, the old copy of CUB (which can be found here) was kept around, because some other algorithms used it. The hope was that we'd move those algorithms over next, then delete the deadcode. That doesn't seem to have happened.

I tried deleting this code, and it looks like at least the extrema functions (min_element, max_element, and minmax_element) use it. I think we could probably just not specialize these functions for the CUDA backend of Thrust, and instead have them go through the generic layer that will implement them in terms of reduce. However, CUB does have specific variants for min/max (but not minmax), so we may want to hook that up.

I'm not sure if those CUB variants are for perf or not - CUB should recognize the thrust::max/thrust::min function objects and dispatch to the fastpath.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions