Skip to content

Support a custom comparison operator in DeviceReduce::ArgMin#8285

Open
bernhardmgruber wants to merge 4 commits intoNVIDIA:mainfrom
bernhardmgruber:ref_argmin
Open

Support a custom comparison operator in DeviceReduce::ArgMin#8285
bernhardmgruber wants to merge 4 commits intoNVIDIA:mainfrom
bernhardmgruber:ref_argmin

Conversation

@bernhardmgruber
Copy link
Copy Markdown
Contributor

Fixes: #6123

@bernhardmgruber bernhardmgruber requested review from a team as code owners April 2, 2026 23:09
@github-project-automation github-project-automation bot moved this to Todo in CCCL Apr 2, 2026
@cccl-authenticator-app cccl-authenticator-app bot moved this from Todo to In Review in CCCL Apr 2, 2026
@bernhardmgruber bernhardmgruber changed the title Support a custom comparison predicate in DeviceReduce::ArgMin Support a custom comparison operator in DeviceReduce::ArgMin Apr 2, 2026
Comment on lines +1041 to +1043
// TODO(bgruber): this constraint is not accurate, since the implementation will compare the value types of
// ExtremumOutIteratorT, which is wrong IMO
::cuda::std::enable_if_t<::cuda::std::indirectly_comparable<InputIteratorT, InputIteratorT, CompareOpT>, int> = 0>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of InputIteratorT we should use non_void_value_t<ExtremumOutIteratorT, it_value_t<InputIteratorT>>, but that just "feels" wrong here. But this is what the implementation does. What do the reviewers think?

I think the implementation should actually be changed to compare the input values, not the converted ones.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

😬 CI Workflow Results

🟥 Finished in 1h 57m: Pass: 59%/249 | Total: 7d 12h | Max: 1h 27m | Hits: 61%/126688

See results here.

Copy link
Copy Markdown
Contributor

@NaderAlAwar NaderAlAwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: the issue being closed mentions ArgMax as well in the title, but this PR only appears to add public custom-comparator overloads and
test coverage for ArgMin. The internal refactor is more general, but DeviceReduce::ArgMax still seems to expose only the old no-comparator API. I would either create a separate issue for ArgMax or expose the custom comparator overload as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

Support a custom comparison predicate in cub::DeviceReduce::ArgMin|Max.

2 participants