@@ -1403,7 +1403,13 @@ ur_result_t ur_queue_handle_t_::synchronize() {
1403
1403
return UR_RESULT_SUCCESS;
1404
1404
1405
1405
// wait for all commands previously submitted to this immediate command list
1406
- ZE2UR_CALL (zeCommandListHostSynchronize, (ImmCmdList->first , UINT64_MAX));
1406
+ if (UrL0QueueSyncNonBlocking) {
1407
+ Queue->Mutex .unlock ();
1408
+ ZE2UR_CALL (zeCommandListHostSynchronize, (ImmCmdList->first , UINT64_MAX));
1409
+ Queue->Mutex .lock ();
1410
+ } else {
1411
+ ZE2UR_CALL (zeCommandListHostSynchronize, (ImmCmdList->first , UINT64_MAX));
1412
+ }
1407
1413
1408
1414
// Cleanup all events from the synced command list.
1409
1415
CleanupEventListFromResetCmdList (ImmCmdList->second .EventList , true );
@@ -1417,7 +1423,13 @@ ur_result_t ur_queue_handle_t_::synchronize() {
1417
1423
// zero handle can have device scope, so we can't synchronize the last
1418
1424
// event.
1419
1425
if (isInOrderQueue () && !LastCommandEvent->IsDiscarded ) {
1420
- ZE2UR_CALL (zeHostSynchronize, (LastCommandEvent->ZeEvent ));
1426
+ if (UrL0QueueSyncNonBlocking) {
1427
+ this ->Mutex .unlock ();
1428
+ ZE2UR_CALL (zeHostSynchronize, (LastCommandEvent->ZeEvent ));
1429
+ this ->Mutex .lock ();
1430
+ } else {
1431
+ ZE2UR_CALL (zeHostSynchronize, (LastCommandEvent->ZeEvent ));
1432
+ }
1421
1433
1422
1434
// clean up all events known to have been completed as well,
1423
1435
// so they can be reused later
@@ -1444,8 +1456,15 @@ ur_result_t ur_queue_handle_t_::synchronize() {
1444
1456
UR_CALL (syncImmCmdList (this , ImmCmdList));
1445
1457
} else {
1446
1458
for (auto &ZeQueue : QueueGroup.second .ZeQueues )
1447
- if (ZeQueue)
1448
- ZE2UR_CALL (zeHostSynchronize, (ZeQueue));
1459
+ if (ZeQueue) {
1460
+ if (UrL0QueueSyncNonBlocking) {
1461
+ this ->Mutex .unlock ();
1462
+ ZE2UR_CALL (zeHostSynchronize, (ZeQueue));
1463
+ this ->Mutex .lock ();
1464
+ } else {
1465
+ ZE2UR_CALL (zeHostSynchronize, (ZeQueue));
1466
+ }
1467
+ }
1449
1468
}
1450
1469
}
1451
1470
}
0 commit comments