-
Notifications
You must be signed in to change notification settings - Fork 797
[SYCL] Add validation + exception handling to SYCL_PARALLEL_FOR_RANGE_ROUNDING_PARAMS #19381
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
base: sycl
Are you sure you want to change the base?
Conversation
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.
We should have a test added for the change
@intel/llvm-reviewers-runtime PR ready for review, thanks in advance! |
size_t &MinRange) { | ||
static const char *RoundParams = BaseT::getRawValue(); | ||
size_t &MinRange, bool ForceUpdate = false) { | ||
const char *RoundParams = BaseT::getRawValue(); |
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.
Do we want to remove static
from the declaration of *RoundParams ?
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 initially removed it because I figured the variable should be re-read every time, but in hindsight this whole statement should be moved elsewhere to avoid this being called everytime the function is ran...
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.
In hindsight's hindsight, if the env variable is empty getRawValue returns null; in which it actually makes sense the check is where it is
if (Pos != std::string::npos) { | ||
MF = std::stoi(Params.substr(0, Pos)); | ||
if (Pos != std::string::npos && GuardedStoi(MF, Params.substr(0, Pos)) && | ||
MF > 0) { |
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.
should this be MF >= 0
( GTE instead of GT) ? 0 is a valid return from GuardedStoi
, no? Or maybe 0 should not be valid in GuardedStoi.
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.
The way we currently have range rounding, MF=0 results in a division by zero error: This PR helps prevent the crash that would happen as a result.
I don't think it makes sense anyway, as according to https://github.com/intel/llvm/blob/970e2ef386e6287202cbaf69ff3871889bed5959/sycl/doc/EnvironmentVariables.md, the minimum factor is the "range that the rounded range should be a multiple of (Default 16)": Rounding parallel_for ranges to a multiple of 0 should probably not be possible. Thus, I have a test case to explicitly check that MF=0 should not be accepted.
No description provided.