@@ -925,7 +925,7 @@ pi_result _pi_ze_event_list_t::createAndRetainPiZeEventList(
925
925
this ->PiEventList = nullptr ;
926
926
927
927
try {
928
- if (CurQueue->isInOrderQueue ()) {
928
+ if (CurQueue->isInOrderQueue () && CurQueue-> LastCommandEvent != nullptr ) {
929
929
this ->ZeEventList = new ze_event_handle_t [EventListLength + 1 ];
930
930
this ->PiEventList = new pi_event[EventListLength + 1 ];
931
931
} else if (EventListLength > 0 ) {
@@ -972,7 +972,7 @@ pi_result _pi_ze_event_list_t::createAndRetainPiZeEventList(
972
972
// For in-order queues, every command should be executed once after the
973
973
// previous command has finished. The event associated with the last
974
974
// enqued command is added into the waitlist to ensure in-order semantics.
975
- if (CurQueue->isInOrderQueue ()) {
975
+ if (CurQueue->isInOrderQueue () && CurQueue-> LastCommandEvent != nullptr ) {
976
976
this ->ZeEventList [TmpListLength] = CurQueue->LastCommandEvent ->ZeEvent ;
977
977
this ->PiEventList [TmpListLength] = CurQueue->LastCommandEvent ;
978
978
TmpListLength += 1 ;
@@ -4815,7 +4815,7 @@ pi_result piEnqueueMemBufferMap(pi_queue Queue, pi_mem Buffer,
4815
4815
// For integrated devices the buffer has been allocated in host memory.
4816
4816
if (Buffer->OnHost ) {
4817
4817
// Wait on incoming events before doing the copy
4818
- if (Queue->isInOrderQueue ()) {
4818
+ if (Queue->isInOrderQueue () && Queue-> LastCommandEvent != nullptr ) {
4819
4819
PI_CALL (piEventsWait (1 , &(Queue->LastCommandEvent )));
4820
4820
4821
4821
// Lock automatically releases when this goes out of scope.
@@ -4933,7 +4933,7 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr,
4933
4933
// For integrated devices the buffer is allocated in host memory.
4934
4934
if (MemObj->OnHost ) {
4935
4935
// Wait on incoming events before doing the copy
4936
- if (Queue->isInOrderQueue ()) {
4936
+ if (Queue->isInOrderQueue () && Queue-> LastCommandEvent != nullptr ) {
4937
4937
PI_CALL (piEventsWait (1 , &(Queue->LastCommandEvent )));
4938
4938
4939
4939
// Lock automatically releases when this goes out of scope.
0 commit comments