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
Rewrite Dimension::overlap_ratio
to remove overflow, underflow, and divide by zero
#2304
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Minor (non-fix) changes to overlap_ratio. Most importantly, add an assert() to verify the postcondition. Add helpers-dimension.h with some utility functions. Fix an iteration error in a caller of overlap_ratio. Fix typos.
… before. Added some test tags. Reverted a change in subarray.cc
…loating point, not the minimum-positive element.
KiterLuc
approved these changes
Jun 2, 2021
KiterLuc
reviewed
Jun 4, 2021
@@ -469,10 +469,10 @@ class Dimension { | |||
template <class T> | |||
static bool overlap(const Range& r1, const Range& r2); | |||
|
|||
/** Return ratio of the overalp of the two input 1D ranges over `r2`. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one of those too in domain.h while you're at it :)
Now that the overlap ratio is correct, we get proper size estimation and the partitioner doesn't do an unnecessary split of the results anymore.
…tio' into eh/fix-defect-overlap-ratio
clang-format
github-actions bot
pushed a commit
that referenced
this pull request
Jun 14, 2021
… divide by zero (#2304) * Add tests for overflow defects in overlap_ratio. Minor (non-fix) changes to overlap_ratio. Most importantly, add an assert() to verify the postcondition. Add helpers-dimension.h with some utility functions. Fix an iteration error in a caller of overlap_ratio. Fix typos. * Rewrote Dimension::overlap_ratio to pass all the tests it was failing before. Added some test tags. Reverted a change in subarray.cc * clang format * More clang-format * Use the limits function that returns the actual minimum element for floating point, not the minimum-positive element. * Fix Hilbert test now that size estimate is correct Now that the overlap ratio is correct, we get proper size estimation and the partitioner doesn't do an unnecessary split of the results anymore. * Comment changes. clang-format Co-authored-by: Luc Rancourt <lucrancourt@gmail.com>
Shelnutt2
pushed a commit
that referenced
this pull request
Jun 14, 2021
… divide by zero (#2304) (#2349) * Add tests for overflow defects in overlap_ratio. Minor (non-fix) changes to overlap_ratio. Most importantly, add an assert() to verify the postcondition. Add helpers-dimension.h with some utility functions. Fix an iteration error in a caller of overlap_ratio. Fix typos. * Rewrote Dimension::overlap_ratio to pass all the tests it was failing before. Added some test tags. Reverted a change in subarray.cc * clang format * More clang-format * Use the limits function that returns the actual minimum element for floating point, not the minimum-positive element. * Fix Hilbert test now that size estimate is correct Now that the overlap ratio is correct, we get proper size estimation and the partitioner doesn't do an unnecessary split of the results anymore. * Comment changes. clang-format Co-authored-by: Luc Rancourt <lucrancourt@gmail.com> Co-authored-by: eric-hughes-tiledb <82400964+eric-hughes-tiledb@users.noreply.github.com> Co-authored-by: Luc Rancourt <lucrancourt@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dimension::overlap_ratio
was full of possible ways to overflow and give nonsense results. The tests added in this PR all (but one) failed in the old code, including some divide-by-zero triggered by overflow. The new code accounts for all the possibilities of overflow.TYPE: BUG
DESC: Rewrite
Dimension::overlap_ratio