-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL][CUDA] Use cuEventQuery to check event completion status #3544
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
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.
Thank you for fixing this and great find! You have potentially spared someone a headache (hopefully not at the cost of having one yourself.)
} | ||
if (ret == CUDA_ERROR_NOT_READY) { | ||
return false; | ||
} |
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 believe we can safely set isCompleted_
to true
here. Will allow it to take a slightly faster path in case this check is made again.
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.
Done! I've changed both _pi_event::is_completed
and _pi_event::get_execution_status
to non-const
.
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.
Oh, now I get the comment you made in the summary. It should be fine as non-const
, but if it goes against your better judgement I am okay with you reverting it and keeping is_completed
as const
. I will leave that up to you.
Either way, LGTM! 😄 👍
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'm going to go on a limb and say once the status is complete
, users aren't likely to query it again, so optimizing this shouldn't be necessary. Reverted ;-).
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.
This would leave the "_pi_event" object in a malformed state where the isCompleted_
is false for a completed event. Light +1 for making this non-const.
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.
Another option is to rename it to hasBeenWaitedOn_
or the like. To my knowledge, isCompleted_
is only used for this.
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.
@smaslov-intel You are right, that is no good either. I'm still feeing a bit iffy about making an is_*
function non-const though.
I like the idea of hasBeenWaitedOn_
as well. If there are no objections, I will move forward with this in a couple of hours!
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.
Done!
30a0087
to
39485a3
Compare
Previously the completion status of a PI CUDA event (returned by a `get_info` query for `info::event::command_execution_status`) would only be changed to `command_execution_status::complete` once the event had been waited upon. This changes the mechanism to query the underlying event's execution status using `cuEventQuery` if the event has not been waited upon.
39485a3
to
eb7b20d
Compare
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
/summary:run |
Previously the completion status of a PI CUDA event (returned by a
get_info
query forinfo::event::command_execution_status
) would only be changed tocommand_execution_status::complete
once the event had been waited upon.This changes the mechanism to query the underlying event's execution status using
cuEventQuery
if the event has not been waited upon. I didn't memoize the result of the query asis_completed()
is markedconst
(and makingisCompleted_
amutable
member also doesn't seem right).I've created a corresponding PR for the SYCL CTS that tests for this.