@@ -2525,7 +2525,7 @@ static ur_result_t SetKernelParamsAndLaunch(
2525
2525
property_list.size (), property_list.data (), RawEvents.size (),
2526
2526
RawEvents.empty () ? nullptr : &RawEvents[0 ],
2527
2527
OutEventImpl ? &UREvent : nullptr );
2528
- if (OutEventImpl) {
2528
+ if ((Error == UR_RESULT_SUCCESS) && OutEventImpl) {
2529
2529
OutEventImpl->setHandle (UREvent);
2530
2530
}
2531
2531
return Error;
@@ -3421,15 +3421,21 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
3421
3421
3422
3422
ur_bool_t NativeCommandSupport = false ;
3423
3423
assert (MQueue && " Native command should have an associated queue" );
3424
- MQueue->getAdapter ()->call <UrApiKind::urDeviceGetInfo>(
3424
+ auto &Adapter = MQueue->getAdapter ();
3425
+ Adapter->call <UrApiKind::urDeviceGetInfo>(
3425
3426
detail::getSyclObjImpl (MQueue->get_device ())->getHandleRef (),
3426
3427
UR_DEVICE_INFO_ENQUEUE_NATIVE_COMMAND_SUPPORT_EXP,
3427
3428
sizeof (NativeCommandSupport), &NativeCommandSupport, nullptr );
3428
3429
assert (NativeCommandSupport && " ext_codeplay_enqueue_native_command is not "
3429
3430
" supported on this device" );
3430
- MQueue->getAdapter ()->call <UrApiKind::urEnqueueNativeCommandExp>(
3431
- MQueue->getHandleRef (), InteropFreeFunc, &CustomOpData, ReqMems.size (),
3432
- ReqMems.data (), nullptr , RawEvents.size (), RawEvents.data (), Event);
3431
+ if (auto Result =
3432
+ Adapter->call_nocheck <UrApiKind::urEnqueueNativeCommandExp>(
3433
+ MQueue->getHandleRef (), InteropFreeFunc, &CustomOpData,
3434
+ ReqMems.size (), ReqMems.data (), nullptr , RawEvents.size (),
3435
+ RawEvents.data (), Event);
3436
+ Result != UR_RESULT_SUCCESS)
3437
+ return Result;
3438
+
3433
3439
SetEventHandleOrDiscard ();
3434
3440
return UR_RESULT_SUCCESS;
3435
3441
}
@@ -3449,8 +3455,12 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
3449
3455
const AdapterPtr &Adapter = MQueue->getAdapter ();
3450
3456
if (MEvent != nullptr )
3451
3457
MEvent->setHostEnqueueTime ();
3452
- Adapter->call <UrApiKind::urEnqueueEventsWaitWithBarrierExt>(
3453
- MQueue->getHandleRef (), &Properties, 0 , nullptr , Event);
3458
+ if (auto Result =
3459
+ Adapter->call_nocheck <UrApiKind::urEnqueueEventsWaitWithBarrierExt>(
3460
+ MQueue->getHandleRef (), &Properties, 0 , nullptr , Event);
3461
+ Result != UR_RESULT_SUCCESS)
3462
+ return Result;
3463
+
3454
3464
SetEventHandleOrDiscard ();
3455
3465
return UR_RESULT_SUCCESS;
3456
3466
}
@@ -3479,9 +3489,13 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
3479
3489
const AdapterPtr &Adapter = MQueue->getAdapter ();
3480
3490
if (MEvent != nullptr )
3481
3491
MEvent->setHostEnqueueTime ();
3482
- Adapter->call <UrApiKind::urEnqueueEventsWaitWithBarrierExt>(
3483
- MQueue->getHandleRef (), &Properties, UrEvents.size (), &UrEvents[0 ],
3484
- Event);
3492
+ if (auto Result =
3493
+ Adapter->call_nocheck <UrApiKind::urEnqueueEventsWaitWithBarrierExt>(
3494
+ MQueue->getHandleRef (), &Properties, UrEvents.size (),
3495
+ &UrEvents[0 ], Event);
3496
+ Result != UR_RESULT_SUCCESS)
3497
+ return Result;
3498
+
3485
3499
SetEventHandleOrDiscard ();
3486
3500
return UR_RESULT_SUCCESS;
3487
3501
}
@@ -3493,6 +3507,10 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
3493
3507
ur_event_handle_t *TimestampDeps = nullptr ;
3494
3508
size_t NumTimestampDeps = 0 ;
3495
3509
3510
+ // TO DO - once the following WA removed: to change call to call_nocheck and
3511
+ // return operation result to Command::enqueue (see other CG types). Set
3512
+ // UREvent to EventImpl only for successful case.
3513
+
3496
3514
// If the queue is not in-order, the implementation will need to first
3497
3515
// insert a marker event that the timestamp waits for.
3498
3516
ur_event_handle_t PreTimestampMarkerEvent{};
@@ -3581,15 +3599,18 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
3581
3599
static_cast <CGExecCommandBuffer *>(MCommandGroup.get ());
3582
3600
if (MEvent != nullptr )
3583
3601
MEvent->setHostEnqueueTime ();
3584
- ur_result_t Err =
3585
- MQueue->getAdapter ()
3586
- ->call_nocheck <UrApiKind::urCommandBufferEnqueueExp>(
3587
- CmdBufferCG->MCommandBuffer , MQueue->getHandleRef (),
3588
- RawEvents.size (), RawEvents.empty () ? nullptr : &RawEvents[0 ],
3589
- Event);
3602
+ if (auto Result =
3603
+ MQueue->getAdapter ()
3604
+ ->call_nocheck <UrApiKind::urCommandBufferEnqueueExp>(
3605
+ CmdBufferCG->MCommandBuffer , MQueue->getHandleRef (),
3606
+ RawEvents.size (),
3607
+ RawEvents.empty () ? nullptr : &RawEvents[0 ], Event);
3608
+ Result != UR_RESULT_SUCCESS)
3609
+ return Result;
3610
+
3590
3611
SetEventHandleOrDiscard ();
3591
3612
3592
- return Err ;
3613
+ return UR_RESULT_SUCCESS ;
3593
3614
}
3594
3615
case CGType::CopyImage: {
3595
3616
CGCopyImage *Copy = (CGCopyImage *)MCommandGroup.get ();
@@ -3614,11 +3635,11 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
3614
3635
const detail::AdapterPtr &Adapter = MQueue->getAdapter ();
3615
3636
auto OptWaitValue = SemWait->getWaitValue ();
3616
3637
uint64_t WaitValue = OptWaitValue.has_value () ? OptWaitValue.value () : 0 ;
3617
- Adapter->call <UrApiKind::urBindlessImagesWaitExternalSemaphoreExp>(
3618
- MQueue->getHandleRef (), SemWait->getExternalSemaphore (),
3619
- OptWaitValue.has_value (), WaitValue, 0 , nullptr , nullptr );
3620
3638
3621
- return UR_RESULT_SUCCESS;
3639
+ return Adapter
3640
+ ->call_nocheck <UrApiKind::urBindlessImagesWaitExternalSemaphoreExp>(
3641
+ MQueue->getHandleRef (), SemWait->getExternalSemaphore (),
3642
+ OptWaitValue.has_value (), WaitValue, 0 , nullptr , nullptr );
3622
3643
}
3623
3644
case CGType::SemaphoreSignal: {
3624
3645
assert (MQueue &&
@@ -3628,11 +3649,10 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
3628
3649
auto OptSignalValue = SemSignal->getSignalValue ();
3629
3650
uint64_t SignalValue =
3630
3651
OptSignalValue.has_value () ? OptSignalValue.value () : 0 ;
3631
- Adapter->call <UrApiKind::urBindlessImagesSignalExternalSemaphoreExp>(
3632
- MQueue->getHandleRef (), SemSignal->getExternalSemaphore (),
3633
- OptSignalValue.has_value (), SignalValue, 0 , nullptr , nullptr );
3634
-
3635
- return UR_RESULT_SUCCESS;
3652
+ return Adapter
3653
+ ->call_nocheck <UrApiKind::urBindlessImagesSignalExternalSemaphoreExp>(
3654
+ MQueue->getHandleRef (), SemSignal->getExternalSemaphore (),
3655
+ OptSignalValue.has_value (), SignalValue, 0 , nullptr , nullptr );
3636
3656
}
3637
3657
case CGType::None: {
3638
3658
if (RawEvents.empty ()) {
@@ -3644,11 +3664,14 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
3644
3664
assert (MQueue && " Empty node should have an associated queue" );
3645
3665
const detail::AdapterPtr &Adapter = MQueue->getAdapter ();
3646
3666
ur_event_handle_t Event;
3647
- ur_result_t Result = Adapter->call_nocheck <UrApiKind::urEnqueueEventsWait>(
3648
- MQueue->getHandleRef (), RawEvents.size (),
3649
- RawEvents.size () ? &RawEvents[0 ] : nullptr , &Event);
3667
+ if (auto Result = Adapter->call_nocheck <UrApiKind::urEnqueueEventsWait>(
3668
+ MQueue->getHandleRef (), RawEvents.size (),
3669
+ RawEvents.size () ? &RawEvents[0 ] : nullptr , &Event);
3670
+ Result != UR_RESULT_SUCCESS)
3671
+ return Result;
3672
+
3650
3673
MEvent->setHandle (Event);
3651
- return Result ;
3674
+ return UR_RESULT_SUCCESS ;
3652
3675
}
3653
3676
}
3654
3677
return UR_RESULT_ERROR_INVALID_OPERATION;
0 commit comments