-
Notifications
You must be signed in to change notification settings - Fork 787
Commit 4c619e9
authored
[SYCL] Prework before protecting access to the event objects with a mutex (#6179)
* Currently resetCommandList() calls cleanup() and vice versa which makes it difficult to guard access to pi_objects processed by these functions leading to locks of mutexes in different order (causing dead lock). So, don't call resetCommandList from event->cleanup(), we can call resetCommandLists() from piEventsWait() directly instead. Also, remove VM_BIND workaround which is incorrect because currently we perform batching of the copy command lists.
* Remove pointer to command list (ZeCommandList) from pi_event. Command list references event as well and this introduces difficulty: we need to lock a queue and then an event to be able to process events in the command list. And vice versa to lock an event and then a queue to update ZeCommandList when cleaning up an event.
* Perform cleanup and release of events outside of queue lock. Callers of cleanup and EventRelease must no lock any mutexes. As a related change remove LockedQueue parameter from cleanup functions. Currently LockedQueue parameter is used several functions for cleaning resources. It specifies which queue is locked in the caller of these functions to not lock it twice. Problem is that some of the functions internally process events in a loop which can be from different queues and these queues are locked as part of this processing. It leads to the problem that we can have nested locks of different queues and this is a classic deadlock situation.
* Make cleanup() and resetCommandLists() functions free. The resetCommandLists() function performs release of events in command lists and we release the queue if event's refcount reaches 0, so it is possible that queue can be destructed inside this function. That's why it should be free function and not a method of the queue. Same for cleanup().1 parent e8bff05 commit 4c619e9Copy full SHA for 4c619e9
File tree
Expand file treeCollapse file tree
2 files changed
+181
-184
lines changedFilter options
- sycl/plugins/level_zero
Expand file treeCollapse file tree
2 files changed
+181
-184
lines changed
0 commit comments