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.
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
[SYCL] Fix uncaught exceptions and null dereference #15173
[SYCL] Fix uncaught exceptions and null dereference #15173
Changes from all commits
75593ba
5b3a48f
3a9dae9
bad3d36
4b7c116
fe889a1
6fa25b6
72347dc
cb9e162
c4c36d6
0ee614e
29c500b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Changes like this look weird to me and I think that we may need some spec changes here to avoid them. Tagging @gmlueck here for awareness/feedback.
The only meaningful exception I would expect to see from
range::size()
is something likeoverflow_error
, but at the same time we expect this type to be used on device (as a return type of variousnd_item
/group
-related APIs) and exceptions are not supported in there.Changing definition of the method between host and device compilation seems hacky, so I assume that the SYCL spec can only have one definition. And I think that that definition should be
noexcept
.Reason behind our implementation throwing from
range::size()
:range
inherits fromdetail::common_array
to store datarange::size
usesdetail::common_array::operator[]
to access that datadetail::common_array::operator[]
contains a call tocheck_dimensions
which throws if index is out of range[0..2]
, but does that only on hostI would also explore if we should turn runtime check in
detail::common_array::check_dimensions
into anassert
. Even though values we pass there could pass directly from user (viaid::operator[]
for example), the SYCL spec is not clear what happens if we use an invalid dimension here. KhronosGroup/SYCL-Docs#551 is related, but there is no conclusion.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 change here seems unnecessary. Even without this change, if an exception is thrown in the body of
size
, the application will terminate. That's the semantics of thenoexcept
keyword. See cppreference: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.
My understanding is that one of our code coverage tools complains about
throw
innoexcept
function and we are unable to ignore that by some reason. It is probably a good notification for us to review associated code to see if we can actually make itnoexcept
, but otherwise I don't think that its the end of the world. All thosecatch
block should almost always be unreachable as I understand it.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've submitted KhronosGroup/SYCL-Docs#626 to see if we want to mark all methods of
range
/id
/other similar classes asnoexcept
in the SYCL spec so that we can clean up our code here.