@@ -464,7 +464,7 @@ ur_result_t ur_context_handle_t_::getFreeSlotInExistingOrNewPool(
464
464
ze_result_t Result = ZE_CALL_NOCHECK (
465
465
zeEventPoolCreate,
466
466
(ZeContext, &ZeEventPoolDesc, ZeDevices.size (), &ZeDevices[0 ], &Pool));
467
- if (ze2urResult (Result) == UR_RESULT_ERROR_OUT_OF_RESOURCES &&
467
+ if (ze2urResult (Result) == UR_RESULT_ERROR_OUT_OF_RESOURCES && Queue &&
468
468
!Queue->isInOrderQueue ()) {
469
469
if (Queue->UsingImmCmdLists ) {
470
470
UR_CALL (CleanupEventsInImmCmdLists (Queue, true /* QueueLocked*/ ,
@@ -475,6 +475,8 @@ ur_result_t ur_context_handle_t_::getFreeSlotInExistingOrNewPool(
475
475
}
476
476
ZE2UR_CALL (zeEventPoolCreate, (ZeContext, &ZeEventPoolDesc,
477
477
ZeDevices.size (), &ZeDevices[0 ], &Pool));
478
+ } else if (ze2urResult (Result) != UR_RESULT_SUCCESS) {
479
+ return ze2urResult (Result);
478
480
}
479
481
Index = 0 ;
480
482
NumEventsAvailableInEventPool[Pool] = MaxNumEventsPerPool - 1 ;
@@ -562,7 +564,7 @@ ur_result_t ur_context_handle_t_::getFreeSlotInExistingOrNewPool(
562
564
ze_result_t Result = ZE_CALL_NOCHECK (
563
565
zeEventPoolCreate,
564
566
(ZeContext, &ZeEventPoolDesc, ZeDevices.size (), &ZeDevices[0 ], &Pool));
565
- if (ze2urResult (Result) == UR_RESULT_ERROR_OUT_OF_RESOURCES &&
567
+ if (ze2urResult (Result) == UR_RESULT_ERROR_OUT_OF_RESOURCES && Queue &&
566
568
!Queue->isInOrderQueue ()) {
567
569
if (Queue->UsingImmCmdLists ) {
568
570
UR_CALL (CleanupEventsInImmCmdLists (Queue, true /* QueueLocked*/ ,
@@ -573,6 +575,8 @@ ur_result_t ur_context_handle_t_::getFreeSlotInExistingOrNewPool(
573
575
}
574
576
ZE2UR_CALL (zeEventPoolCreate, (ZeContext, &ZeEventPoolDesc,
575
577
ZeDevices.size (), &ZeDevices[0 ], &Pool));
578
+ } else if (ze2urResult (Result) != UR_RESULT_SUCCESS) {
579
+ return ze2urResult (Result);
576
580
}
577
581
NumEventsAvailableInEventPool[*ZePool] = MaxNumEventsPerPool - 1 ;
578
582
NumEventsUnreleasedInEventPool[*ZePool] = 1 ;
0 commit comments