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 broken bounds checks #388

Merged
merged 5 commits into from
Nov 19, 2019
Merged

Fix broken bounds checks #388

merged 5 commits into from
Nov 19, 2019

Conversation

upsj
Copy link
Member

@upsj upsj commented Nov 18, 2019

As #387 explains, we have some bounds checks that should rather be checks for equality, unless we want to allow our Arrays to over-allocate memory, e.g. for SIMD purposes or similar.

This pull request replaces all GKO_ENSURE_IN_BOUNDS by equivalent or more strict GKO_ASSERT_EQ

@upsj upsj added is:bug Something looks wrong. 1:ST:ready-for-review This PR is ready for review labels Nov 18, 2019
Copy link
Member

@tcojean tcojean left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@tcojean tcojean left a comment

Choose a reason for hiding this comment

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

Actually, GKO_ASSERT_EQ is not tested like it should be in core/test/base/exception_helpers.cpp. Please add tests there.

Copy link
Member

@thoasm thoasm left a comment

Choose a reason for hiding this comment

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

LGTM!

@thoasm
Copy link
Member

thoasm commented Nov 18, 2019

@upsj I forgot to point you towards the How to merge entry in our wiki.
Usually, the first step is to rebase against develop (so all your changes appear behind one another), followed by writing the commit message, which is described in the already mentioned "How to merge" wiki entry. Here, the most important parts are that the title should be descriptive and to always include the full link to the PR page at the very end (usually with Related PR: <link>).

@tcojean tcojean added 1:ST:ready-to-merge This PR is ready to merge. 1:ST:ready-for-review This PR is ready for review and removed 1:ST:ready-for-review This PR is ready for review 1:ST:ready-to-merge This PR is ready to merge. labels Nov 18, 2019
@tcojean
Copy link
Member

tcojean commented Nov 18, 2019

Some tests are failing due to changing to GKO_ASSERT_EQ, the ASSERT_THROW in tests should have a different value (OutOfBoundsError becomes ValueMismatch).

@tcojean tcojean self-requested a review November 18, 2019 20:09
@upsj
Copy link
Member Author

upsj commented Nov 19, 2019

There were two types of failures: Mismatching exception types as @tcojean mentioned and some bounds checks indeed need to use GKO_ENSURE_IN_BOUNDS as they concern submatrices of dense matrices. I fixed these now.

@tcojean tcojean added 1:ST:ready-to-merge This PR is ready to merge. and removed 1:ST:ready-for-review This PR is ready for review labels Nov 19, 2019
Copy link
Member

@pratikvn pratikvn left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -240,9 +240,7 @@ class SparsityCsr
auto tmp = Array<value_type>{exec->get_master(), 1};
tmp.get_data()[0] = value;
value_ = Array<value_type>{exec, std::move(tmp)};
GKO_ENSURE_IN_BOUNDS(col_idxs_.get_num_elems() - 1,
Copy link
Member

Choose a reason for hiding this comment

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

Well, 🤷‍♂️

@upsj upsj merged commit cc3cc45 into develop Nov 19, 2019
@tcojean tcojean deleted the fix_bounds_checks branch November 27, 2019 11:26
@tcojean tcojean mentioned this pull request Nov 27, 2019
4 tasks
tcojean added a commit that referenced this pull request Dec 2, 2019
This version of Ginkgo provides a few fixes in Ginkgo's core routines. The
supported systems and requirements are unchanged from version 1.1.0.

### Fixes
+ Improve Ginkgo's installation and fix the `test_install` step ([#406](#406)),
+ Fix some documentation issues ([#406](#406)),
+ Fix multiple code issues reported by sonarqube ([#406](#406)),
+ Update the git-cmake-format repository ([#399](#399)),
+ Improve the global update header script ([#390](#390)),
+ Fix broken bounds checks ([#388](#388)),
+ Fix CSR strategies and improve performance ([#379](#379)),
+ Fix a small typo in the stencil examples ([#381](#381)),
+ Fix ELL error on small matrices ([#375](#375)),
+ Fix SellP read function ([#374](#374)),
+ Add factorization support in `create_new_algorithm.sh`  ([#371](#371)).
tcojean added a commit that referenced this pull request Dec 3, 2019
Minor release v1.1.1

This version of Ginkgo provides a few fixes in Ginkgo's core routines. The
supported systems and requirements are unchanged from version 1.1.0.

### Fixes
+ Fix the `test_install` step with `HIP` ([#409](#409)),
+ Improve Ginkgo's installation and fix the `test_install` step ([#406](#406)),
+ Fix some documentation issues ([#406](#406)),
+ Fix multiple code issues reported by sonarqube ([#406](#406)),
+ Update the git-cmake-format repository ([#399](#399)),
+ Improve the global update header script ([#390](#390)),
+ Fix broken bounds checks ([#388](#388)),
+ Fix CSR strategies and improve performance ([#379](#379)),
+ Fix a small typo in the stencil examples ([#381](#381)),
+ Fix ELL error on small matrices ([#375](#375)),
+ Fix SellP read function ([#374](#374)),
+ Add factorization support in `create_new_algorithm.sh`  ([#371](#371))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1:ST:ready-to-merge This PR is ready to merge. is:bug Something looks wrong.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants