NVIDIA / NVIDIA/cccl

Unify common functors and optionally expose them

Open
#7,455 20 comments 0 reactions 0 assignees View on GitHub
good first issue help wanted
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

We repeatedly define common functors all over CCCL, like `__return_constant` (at least 2 occurrences)., `equal_to_default_t` (4 occurrences), `always_true_predicate`, `equal_to_value`, `equal_to_t`, `always_false_t`, `always_true_t`, etc. Sometimes, the definitions are slightly different. We should pick a general enough version of those and put them somewhere central, like ``. They can remain internal, but we may also consider making them public.

The motivation is twofold: cleaner code, but also more opportunity for optmization. `cub::DeviceTransform` for example can optimize if the predicate is exactly `cub::detail::transform::always_true_predicate`. Any other predicate type (with the same definition) will not lead to an optimal code path.

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.