-
Notifications
You must be signed in to change notification settings - Fork 769
[UR] [L0 v2] Enable wait lists and signal events for command buffer in L0 adapter v2 #18442
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
@@ -128,6 +131,8 @@ struct ur_event_handle_t_ : ur_object { | |||
ur_command_t commandType = UR_COMMAND_FORCE_UINT32; | |||
ur_device_handle_t hDevice = nullptr; | |||
|
|||
// tells if event has been enqueued in some way (e.g. by appending to a queue) | |||
bool isEventInUse = true; |
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.
Hm, this might be a bit error-prone, especially if you're not setting it for regular operations. Could we use resetQueueAndCommand instead and query if we have ommandType set?
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.
It is true that this may be error prone, however I don't think that your suggestion does what is required - we need to mark events that are signaled by command buffers, and not use them until the command buffer is enqueued. In that case the commandType is still set, and I don't think this is the way to distinguish events created by queue, from these created by command buffer
@@ -158,6 +192,10 @@ ur_result_t ur_exp_command_buffer_handle_t_::applyUpdateCommands( | |||
|
|||
return UR_RESULT_SUCCESS; | |||
} | |||
void ur_exp_command_buffer_handle_t_::registerEvent(ur_event_handle_t event) { | |||
addedEvents.push_back(event); |
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.
what are the addedEvents used for?
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.
It is used to enable all events of command buffer when it is enqueued.
@@ -45,7 +50,7 @@ struct ur_context_handle_t_ : ur_object { | |||
const v2::raii::ze_context_handle_t hContext; | |||
const std::vector<ur_device_handle_t> hDevices; | |||
v2::command_list_cache_t commandListCache; | |||
v2::event_pool_cache eventPoolCache; | |||
v2::event_pool_cache eventPoolCacheImmediate, eventPoolCacheRegular; |
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.
nit: for consistency, please define the variables in separate lines
@@ -232,6 +237,14 @@ ur_result_t urEventRelease(ur_event_handle_t hEvent) try { | |||
ur_result_t urEventWait(uint32_t numEvents, | |||
const ur_event_handle_t *phEventWaitList) try { | |||
for (uint32_t i = 0; i < numEvents; ++i) { | |||
if (!phEventWaitList[i]->getIsEventInUse()) { | |||
// TODO: This is a workaround for the underlying inconsistency |
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.
So what's the state of regular and counter-based events by default right now? Is it that regular events are not signaled? If so, could we just signal them manually?
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.
As far as I understand, when regular event is signaled by command buffer that has not been enqueued, it is signaled. However, as soon as command buffer gets enqueued the event becomes not signaled, and waits for command buffer execution. However, that is not the case for counter-based events, what causes issues - if we use counter-based event, the event that is signaled by not enqueued command buffer is not signaled by default.
Maybe @pbalcer can explain it clearer.
Closing this PR, since it has some functionality that does not seem to work properly with L0 driver. |
No description provided.