@@ -817,7 +817,7 @@ pi_result _pi_ze_event_list_t::createAndRetainPiZeEventList(
817
817
return PI_SUCCESS;
818
818
}
819
819
820
- static void printZeEventList (_pi_ze_event_list_t &PiZeEventList) {
820
+ static void printZeEventList (const _pi_ze_event_list_t &PiZeEventList) {
821
821
zePrint (" NumEventsInWaitList %d:" , PiZeEventList.Length );
822
822
823
823
for (pi_uint32 I = 0 ; I < PiZeEventList.Length ; I++) {
@@ -4194,9 +4194,11 @@ enqueueMemCopyHelper(pi_command_type CommandType, pi_queue Queue, void *Dst,
4194
4194
ZeEvent = (*Event)->ZeEvent ;
4195
4195
(*Event)->WaitList = TmpWaitList;
4196
4196
4197
- ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList,
4198
- (*Event)->WaitList .Length ,
4199
- (*Event)->WaitList .ZeEventList ));
4197
+ const auto &WaitList = (*Event)->WaitList ;
4198
+ if (WaitList.Length ) {
4199
+ ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList, WaitList.Length ,
4200
+ WaitList.ZeEventList ));
4201
+ }
4200
4202
4201
4203
ZE_CALL (zeCommandListAppendMemoryCopy (ZeCommandList, Dst, Src, Size, ZeEvent,
4202
4204
0 , nullptr ));
@@ -4208,7 +4210,7 @@ enqueueMemCopyHelper(pi_command_type CommandType, pi_queue Queue, void *Dst,
4208
4210
zePrint (" calling zeCommandListAppendMemoryCopy() with\n "
4209
4211
" ZeEvent %#lx\n " ,
4210
4212
pi_cast<std::uintptr_t >(ZeEvent));
4211
- printZeEventList ((*Event)-> WaitList );
4213
+ printZeEventList (WaitList);
4212
4214
4213
4215
return PI_SUCCESS;
4214
4216
}
@@ -4249,14 +4251,15 @@ static pi_result enqueueMemCopyRectHelper(
4249
4251
ZeEvent = (*Event)->ZeEvent ;
4250
4252
(*Event)->WaitList = TmpWaitList;
4251
4253
4252
- ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList,
4253
- (*Event)->WaitList .Length ,
4254
- (*Event)->WaitList .ZeEventList ));
4255
-
4254
+ const auto &WaitList = (*Event)->WaitList ;
4255
+ if (WaitList.Length ) {
4256
+ ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList, WaitList.Length ,
4257
+ WaitList.ZeEventList ));
4258
+ }
4256
4259
zePrint (" calling zeCommandListAppendMemoryCopy() with\n "
4257
4260
" ZeEvent %#lx\n " ,
4258
4261
pi_cast<std::uintptr_t >(ZeEvent));
4259
- printZeEventList ((*Event)-> WaitList );
4262
+ printZeEventList (WaitList);
4260
4263
4261
4264
uint32_t SrcOriginX = pi_cast<uint32_t >(SrcOrigin->x_bytes );
4262
4265
uint32_t SrcOriginY = pi_cast<uint32_t >(SrcOrigin->y_scalar );
@@ -4415,10 +4418,11 @@ enqueueMemFillHelper(pi_command_type CommandType, pi_queue Queue, void *Ptr,
4415
4418
ZeEvent = (*Event)->ZeEvent ;
4416
4419
(*Event)->WaitList = TmpWaitList;
4417
4420
4418
- ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList,
4419
- (*Event)->WaitList .Length ,
4420
- (*Event)->WaitList .ZeEventList ));
4421
-
4421
+ const auto &WaitList = (*Event)->WaitList ;
4422
+ if (WaitList.Length ) {
4423
+ ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList, WaitList.Length ,
4424
+ WaitList.ZeEventList ));
4425
+ }
4422
4426
// Pattern size must be a power of two
4423
4427
PI_ASSERT ((PatternSize > 0 ) && ((PatternSize & (PatternSize - 1 )) == 0 ),
4424
4428
PI_INVALID_VALUE);
@@ -4429,7 +4433,7 @@ enqueueMemFillHelper(pi_command_type CommandType, pi_queue Queue, void *Ptr,
4429
4433
zePrint (" calling zeCommandListAppendMemoryFill() with\n "
4430
4434
" ZeEvent %#lx\n " ,
4431
4435
pi_cast<pi_uint64>(ZeEvent));
4432
- printZeEventList ((*Event)-> WaitList );
4436
+ printZeEventList (WaitList);
4433
4437
4434
4438
// Execute command list asynchronously, as the event will be used
4435
4439
// to track down its completion.
@@ -4547,10 +4551,11 @@ pi_result piEnqueueMemBufferMap(pi_queue Queue, pi_mem Buffer,
4547
4551
zeMemAllocHost (Queue->Context ->ZeContext , &ZeDesc, Size, 1 , RetMap));
4548
4552
}
4549
4553
4550
- ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList,
4551
- (*Event)->WaitList .Length ,
4552
- (*Event)->WaitList .ZeEventList ));
4553
-
4554
+ const auto &WaitList = (*Event)->WaitList ;
4555
+ if (WaitList.Length ) {
4556
+ ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList, WaitList.Length ,
4557
+ WaitList.ZeEventList ));
4558
+ }
4554
4559
ZE_CALL (zeCommandListAppendMemoryCopy (
4555
4560
ZeCommandList, *RetMap, pi_cast<char *>(Buffer->getZeHandle ()) + Offset,
4556
4561
Size, ZeEvent, 0 , nullptr ));
@@ -4634,10 +4639,11 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr,
4634
4639
// Set the commandlist in the event
4635
4640
(*Event)->ZeCommandList = ZeCommandList;
4636
4641
4637
- ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList,
4638
- (*Event)->WaitList .Length ,
4639
- (*Event)->WaitList .ZeEventList ));
4640
-
4642
+ if ((*Event)->WaitList .Length ) {
4643
+ ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList,
4644
+ (*Event)->WaitList .Length ,
4645
+ (*Event)->WaitList .ZeEventList ));
4646
+ }
4641
4647
// TODO: Level Zero is missing the memory "mapping" capabilities, so we are
4642
4648
// left to doing copy (write back to the device).
4643
4649
//
@@ -4750,10 +4756,11 @@ enqueueMemImageCommandHelper(pi_command_type CommandType, pi_queue Queue,
4750
4756
ZeEvent = (*Event)->ZeEvent ;
4751
4757
(*Event)->WaitList = TmpWaitList;
4752
4758
4753
- ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList,
4754
- (*Event)->WaitList .Length ,
4755
- (*Event)->WaitList .ZeEventList ));
4756
-
4759
+ const auto &WaitList = (*Event)->WaitList ;
4760
+ if (WaitList.Length ) {
4761
+ ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList, WaitList.Length ,
4762
+ WaitList.ZeEventList ));
4763
+ }
4757
4764
if (CommandType == PI_COMMAND_TYPE_IMAGE_READ) {
4758
4765
pi_mem SrcMem = pi_cast<pi_mem>(const_cast <void *>(Src));
4759
4766
@@ -5359,10 +5366,11 @@ pi_result piextUSMEnqueuePrefetch(pi_queue Queue, const void *Ptr, size_t Size,
5359
5366
NumEventsInWaitList, EventWaitList, Queue))
5360
5367
return Res;
5361
5368
5362
- ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList,
5363
- (*Event)->WaitList .Length ,
5364
- (*Event)->WaitList .ZeEventList ));
5365
-
5369
+ const auto &WaitList = (*Event)->WaitList ;
5370
+ if (WaitList.Length ) {
5371
+ ZE_CALL (zeCommandListAppendWaitOnEvents (ZeCommandList, WaitList.Length ,
5372
+ WaitList.ZeEventList ));
5373
+ }
5366
5374
// TODO: figure out how to translate "flags"
5367
5375
ZE_CALL (zeCommandListAppendMemoryPrefetch (ZeCommandList, Ptr, Size));
5368
5376
0 commit comments