@@ -305,7 +305,7 @@ static ur_result_t enqueueCommandBufferMemCopyHelper(
305
305
ur_command_t CommandType, ur_exp_command_buffer_handle_t CommandBuffer,
306
306
void *Dst, const void *Src, size_t Size, uint32_t NumSyncPointsInWaitList,
307
307
const ur_exp_command_buffer_sync_point_t *SyncPointWaitList,
308
- ur_exp_command_buffer_sync_point_t *SyncPoint ) {
308
+ ur_exp_command_buffer_sync_point_t *RetSyncPoint ) {
309
309
if (CommandBuffer->IsInOrderCmdList ) {
310
310
ZE2UR_CALL (
311
311
zeCommandListAppendMemoryCopy,
@@ -323,8 +323,12 @@ static ur_result_t enqueueCommandBufferMemCopyHelper(
323
323
LaunchEvent->CommandType = CommandType;
324
324
325
325
// Get sync point and register the event with it.
326
- *SyncPoint = CommandBuffer->GetNextSyncPoint ();
327
- CommandBuffer->RegisterSyncPoint (*SyncPoint, LaunchEvent);
326
+ ur_exp_command_buffer_sync_point_t SyncPoint =
327
+ CommandBuffer->GetNextSyncPoint ();
328
+ CommandBuffer->RegisterSyncPoint (SyncPoint, LaunchEvent);
329
+ if (RetSyncPoint) {
330
+ *RetSyncPoint = SyncPoint;
331
+ }
328
332
329
333
ZE2UR_CALL (zeCommandListAppendMemoryCopy,
330
334
(CommandBuffer->ZeCommandList , Dst, Src, Size,
@@ -346,7 +350,7 @@ static ur_result_t enqueueCommandBufferMemCopyRectHelper(
346
350
size_t DstRowPitch, size_t SrcSlicePitch, size_t DstSlicePitch,
347
351
uint32_t NumSyncPointsInWaitList,
348
352
const ur_exp_command_buffer_sync_point_t *SyncPointWaitList,
349
- ur_exp_command_buffer_sync_point_t *SyncPoint ) {
353
+ ur_exp_command_buffer_sync_point_t *RetSyncPoint ) {
350
354
351
355
uint32_t SrcOriginX = ur_cast<uint32_t >(SrcOrigin.x );
352
356
uint32_t SrcOriginY = ur_cast<uint32_t >(SrcOrigin.y );
@@ -398,8 +402,12 @@ static ur_result_t enqueueCommandBufferMemCopyRectHelper(
398
402
LaunchEvent->CommandType = CommandType;
399
403
400
404
// Get sync point and register the event with it.
401
- *SyncPoint = CommandBuffer->GetNextSyncPoint ();
402
- CommandBuffer->RegisterSyncPoint (*SyncPoint, LaunchEvent);
405
+ ur_exp_command_buffer_sync_point_t SyncPoint =
406
+ CommandBuffer->GetNextSyncPoint ();
407
+ CommandBuffer->RegisterSyncPoint (SyncPoint, LaunchEvent);
408
+ if (RetSyncPoint) {
409
+ *RetSyncPoint = SyncPoint;
410
+ }
403
411
404
412
ZE2UR_CALL (zeCommandListAppendMemoryCopyRegion,
405
413
(CommandBuffer->ZeCommandList , Dst, &ZeDstRegion, DstPitch,
@@ -420,7 +428,7 @@ static ur_result_t enqueueCommandBufferFillHelper(
420
428
void *Ptr, const void *Pattern, size_t PatternSize, size_t Size,
421
429
uint32_t NumSyncPointsInWaitList,
422
430
const ur_exp_command_buffer_sync_point_t *SyncPointWaitList,
423
- ur_exp_command_buffer_sync_point_t *SyncPoint ) {
431
+ ur_exp_command_buffer_sync_point_t *RetSyncPoint ) {
424
432
// Pattern size must be a power of two.
425
433
UR_ASSERT ((PatternSize > 0 ) && ((PatternSize & (PatternSize - 1 )) == 0 ),
426
434
UR_RESULT_ERROR_INVALID_VALUE);
@@ -451,8 +459,12 @@ static ur_result_t enqueueCommandBufferFillHelper(
451
459
LaunchEvent->CommandType = CommandType;
452
460
453
461
// Get sync point and register the event with it.
454
- *SyncPoint = CommandBuffer->GetNextSyncPoint ();
455
- CommandBuffer->RegisterSyncPoint (*SyncPoint, LaunchEvent);
462
+ ur_exp_command_buffer_sync_point_t SyncPoint =
463
+ CommandBuffer->GetNextSyncPoint ();
464
+ CommandBuffer->RegisterSyncPoint (SyncPoint, LaunchEvent);
465
+ if (RetSyncPoint) {
466
+ *RetSyncPoint = SyncPoint;
467
+ }
456
468
457
469
ZE2UR_CALL (zeCommandListAppendMemoryFill,
458
470
(CommandBuffer->ZeCommandList , Ptr, Pattern, PatternSize, Size,
@@ -615,7 +627,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
615
627
const size_t *GlobalWorkSize, const size_t *LocalWorkSize,
616
628
uint32_t NumSyncPointsInWaitList,
617
629
const ur_exp_command_buffer_sync_point_t *SyncPointWaitList,
618
- ur_exp_command_buffer_sync_point_t *SyncPoint ,
630
+ ur_exp_command_buffer_sync_point_t *RetSyncPoint ,
619
631
ur_exp_command_buffer_command_handle_t *Command) {
620
632
UR_ASSERT (CommandBuffer && Kernel && Kernel->Program ,
621
633
UR_RESULT_ERROR_INVALID_NULL_POINTER);
@@ -711,10 +723,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
711
723
!CommandBuffer->IsProfilingEnabled ));
712
724
LaunchEvent->CommandType = UR_COMMAND_KERNEL_LAUNCH;
713
725
714
- if (SyncPoint) {
715
- // Get sync point and register the event with it.
716
- *SyncPoint = CommandBuffer->GetNextSyncPoint ();
717
- CommandBuffer->RegisterSyncPoint (*SyncPoint, LaunchEvent);
726
+ // Get sync point and register the event with it.
727
+ ur_exp_command_buffer_sync_point_t SyncPoint =
728
+ CommandBuffer->GetNextSyncPoint ();
729
+ CommandBuffer->RegisterSyncPoint (SyncPoint, LaunchEvent);
730
+ if (RetSyncPoint) {
731
+ *RetSyncPoint = SyncPoint;
718
732
}
719
733
720
734
ZE2UR_CALL (zeCommandListAppendLaunchKernel,
@@ -872,7 +886,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp(
872
886
ur_exp_command_buffer_handle_t CommandBuffer, const void *Mem, size_t Size,
873
887
ur_usm_migration_flags_t Flags, uint32_t NumSyncPointsInWaitList,
874
888
const ur_exp_command_buffer_sync_point_t *SyncPointWaitList,
875
- ur_exp_command_buffer_sync_point_t *SyncPoint ) {
889
+ ur_exp_command_buffer_sync_point_t *RetSyncPoint ) {
876
890
std::ignore = Flags;
877
891
878
892
if (CommandBuffer->IsInOrderCmdList ) {
@@ -898,8 +912,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp(
898
912
LaunchEvent->CommandType = UR_COMMAND_USM_PREFETCH;
899
913
900
914
// Get sync point and register the event with it.
901
- *SyncPoint = CommandBuffer->GetNextSyncPoint ();
902
- CommandBuffer->RegisterSyncPoint (*SyncPoint, LaunchEvent);
915
+ ur_exp_command_buffer_sync_point_t SyncPoint =
916
+ CommandBuffer->GetNextSyncPoint ();
917
+ CommandBuffer->RegisterSyncPoint (SyncPoint, LaunchEvent);
918
+ if (RetSyncPoint) {
919
+ *RetSyncPoint = SyncPoint;
920
+ }
903
921
904
922
// Add the prefetch command to the command buffer.
905
923
// Note that L0 does not handle migration flags.
@@ -919,7 +937,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
919
937
ur_exp_command_buffer_handle_t CommandBuffer, const void *Mem, size_t Size,
920
938
ur_usm_advice_flags_t Advice, uint32_t NumSyncPointsInWaitList,
921
939
const ur_exp_command_buffer_sync_point_t *SyncPointWaitList,
922
- ur_exp_command_buffer_sync_point_t *SyncPoint ) {
940
+ ur_exp_command_buffer_sync_point_t *RetSyncPoint ) {
923
941
// A memory chunk can be advised with muliple memory advices
924
942
// We therefore prefer if statements to switch cases to combine all potential
925
943
// flags
@@ -969,8 +987,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
969
987
LaunchEvent->CommandType = UR_COMMAND_USM_ADVISE;
970
988
971
989
// Get sync point and register the event with it.
972
- *SyncPoint = CommandBuffer->GetNextSyncPoint ();
973
- CommandBuffer->RegisterSyncPoint (*SyncPoint, LaunchEvent);
990
+ ur_exp_command_buffer_sync_point_t SyncPoint =
991
+ CommandBuffer->GetNextSyncPoint ();
992
+ CommandBuffer->RegisterSyncPoint (SyncPoint, LaunchEvent);
993
+ if (RetSyncPoint) {
994
+ *RetSyncPoint = SyncPoint;
995
+ }
974
996
975
997
ZE2UR_CALL (zeCommandListAppendMemAdvise,
976
998
(CommandBuffer->ZeCommandList , CommandBuffer->Device ->ZeDevice ,
0 commit comments