-
Notifications
You must be signed in to change notification settings - Fork 120
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
Update spec to clarify event list contents #2195
Conversation
But how would that even be possible? From the user's perspective, it doesn't matter what they set the output event to, since it's going to be overwritten, and the adapter should never read the output event pointer anyway (because it may be uninitialized, and reading uninitialized memory is UB). So even if a user sets the output event to something that exists in the WaitList, it should not matter. From the adapter's perspective, it cannot modify the input WaitList. So it would not be able to insert the newly allocated output event handle into it. Am I missing something? |
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 thoughts on this are the same as @pbalcer , the input ur_event_handle_t
list cannot contain the output ur_event_handle_t
list, because it has not been returned yet.
I'm not sure if the intent of this wording to forbid useful like this, however I think this is could be a valid usage idiom to create a linear dependency between commands (although it would leak events without being smarter.)
ur_event_handle_t myEvent;
for (unsigned i=0; i<N; i++) {
if (i=0) {
urEnqueueFoo(0, nullptr /*no wait event*/, &myEvent /*set as output*/);
} else {
urEnqueueFoo(1, &myEvent /*wait on event*/, &myEvent /*set as output*/);
}
}
Edit: I see now you need to respect the OpenCL language for "If event_wait_list and event are not NULL, event must not refer to an element of the event_wait_list array." I'm not sure of another solution than propagating this restriction to UR
I'm not a native speaker, so maybe that's on me, but I understand this completely differently than "If phEventWaitList is specified, it must not contain phEvent.". |
Updated the spec to state that "If phEventWaitList and phEvent are not NULL, phEvent must not refer to an element of the phEventWaitList array." This is required for OpenCL, and probably makes sense for other backends as well.
2952a44
to
7bd3363
Compare
Maybe we should add a validation layer feature to detect this? |
Merging without LLVM change - this only touches the spec and comments. |
Updated the spec to state that "If phEventWaitList and phEvent
are not NULL, phEvent must not refer to an element of
the phEventWaitList array."
This is required for OpenCL, and probably makes sense for other
backends as well.