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