-
Notifications
You must be signed in to change notification settings - Fork 407
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
Validate storage level argument passed to TeamPolicy::set_scratch_size() #3098
Conversation
Retest this please. |
Codecov Report
@@ Coverage Diff @@
## develop #3098 +/- ##
=========================================
- Coverage 85.7% 85.7% -0.1%
=========================================
Files 122 122
Lines 10385 10394 +9
=========================================
+ Hits 8906 8911 +5
- Misses 1479 1483 +4
Continue to review full report at Codecov.
|
Retest this please |
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.
Apart from the typo that looks good to me.
Co-authored-by: Daniel Arndt <arndtd@ornl.gov>
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.
LGTM, but could be a little better probably.
core/src/Kokkos_ExecPolicy.hpp
Outdated
std::stringstream ss; | ||
ss << "TeamPolicy::set_scratch_size(/*level*/ " << level | ||
<< ", ...) storage level argument must be 1 or 2 to be valid\n"; | ||
Impl::throw_runtime_exception(ss.str()); |
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.
Suggestion: move this to a function named throw_invalid_storage_exception(level)
or something like that and move it's implementation to Kokkos_ExecPolicy.hpp
. Then remove #include <sstream>
from this header file (it's just a start, but we have to start somewhere. Throwing invalid scratch size policy exceptions isn't performance-sensitive enough that it needs to be inlined.)
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.
(IMHO, the if
statement itself should stay in a header file, since inlining it doesn't require any additional header files and it's used far more than the body of the if statement)
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.
I turned it into a free function and move the implementation to impl/Kokkos_ExecPolicy.cpp
.
I decided to keep the if-statement because it did not feel right to separate things after I realized the error message said "must be 1 or 2" instead of "0 or 1"
…lementation out of the header Co-Authored-By: D. S. Hollman <dshollm@sandia.gov>
Fix #3097