You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix queue locking behavior when creating event lists
This fixes a race when creating queue events without acquiring
the appropriate locks, and also fixes a deadlock when acquiring
multiple queue locks.
The deadlock scenario is roughly this:
queue1 = ...;
queue2 = ...;
for (;;) {
queue1_event = urEnqueueKernelLaunch(queue1, ...);
// lock order: queue2->Mutex, queue1->Mutex
urEnqueueEventsWait(queue2, 1, [queue1_event], nullptr);
}
T2:
for (;;) {
queue2_event = urEnqueueKernelLaunch(queue2, ...);
// lock order: queue1->Mutex, queue2->Mutex
urEnqueueEventsWait(queue1, 1, [queue2_event], nullptr);
}
The solution in this patch is the simplest possible fix I managed
to figure out, but I strongly believe this code requires a substantial
refactor to better structure the synchronization logic. Right now
it's a minefield.
0 commit comments