Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in blockRankedReduce #2226

Merged
merged 5 commits into from
Mar 19, 2024

Conversation

akifcorduk
Copy link
Member

There was a bug appearing for negative floating point numbers with a max reduce operation. The std::numeric_limits<T>::min() is greater than the negative floating point values whereas we want it to be smaller than all representable values.

This PR replaces the min with the lowest.

@akifcorduk akifcorduk requested a review from a team as a code owner March 14, 2024 10:48
Copy link

copy-pr-bot bot commented Mar 14, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions bot added the cpp label Mar 14, 2024
@akifcorduk akifcorduk added bug Something isn't working non-breaking Non-breaking change and removed cpp labels Mar 14, 2024
@akifcorduk
Copy link
Member Author

/ok to test

1 similar comment
@cjnolet
Copy link
Member

cjnolet commented Mar 14, 2024

/ok to test

cpp/include/raft/util/reduction.cuh Outdated Show resolved Hide resolved
cpp/include/raft/util/reduction.cuh Outdated Show resolved Hide resolved
@github-actions github-actions bot added the cpp label Mar 15, 2024
@akifcorduk
Copy link
Member Author

@bdice @tfeher i addressed your comments. Please let me know if you have any other suggestions.

Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

One suggestion, but the bug is fixed so I’ll approve.

: std::numeric_limits<T>::min();
// get the lower_bound of the type if it is a max op,
// get the upper bound of the type if it is a min op
val = reduce_op(lower_bound<T>(), upper_bound<T>()) == lower_bound<T>() ? upper_bound<T>()
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like the identity should be known at compile time rather than evaluating a max/min operation to determine the identity for the given operation.

@tfeher
Copy link
Contributor

tfeher commented Mar 18, 2024

/ok to test

Copy link
Contributor

@tfeher tfeher left a comment

Choose a reason for hiding this comment

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

Thanks Akif for the fix, LGTM.

It looks like that invalid values are flagged with -1 idx and lower or upper bound value. It would be good to extend the docstring with this expected behavior. But let's not hold the fix with this.

@tfeher
Copy link
Contributor

tfeher commented Mar 18, 2024

/ok to test

@tfeher
Copy link
Contributor

tfeher commented Mar 19, 2024

/merge

@rapids-bot rapids-bot bot merged commit e53aa0c into rapidsai:branch-24.04 Mar 19, 2024
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cpp non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants