@@ -925,7 +925,7 @@ pi_result _pi_ze_event_list_t::createAndRetainPiZeEventList(
925925 this ->PiEventList = nullptr ;
926926
927927 try {
928- if (CurQueue->isInOrderQueue ()) {
928+ if (CurQueue->isInOrderQueue () && CurQueue-> LastCommandEvent != nullptr ) {
929929 this ->ZeEventList = new ze_event_handle_t [EventListLength + 1 ];
930930 this ->PiEventList = new pi_event[EventListLength + 1 ];
931931 } else if (EventListLength > 0 ) {
@@ -972,7 +972,7 @@ pi_result _pi_ze_event_list_t::createAndRetainPiZeEventList(
972972 // For in-order queues, every command should be executed once after the
973973 // previous command has finished. The event associated with the last
974974 // enqued command is added into the waitlist to ensure in-order semantics.
975- if (CurQueue->isInOrderQueue ()) {
975+ if (CurQueue->isInOrderQueue () && CurQueue-> LastCommandEvent != nullptr ) {
976976 this ->ZeEventList [TmpListLength] = CurQueue->LastCommandEvent ->ZeEvent ;
977977 this ->PiEventList [TmpListLength] = CurQueue->LastCommandEvent ;
978978 TmpListLength += 1 ;
@@ -4815,7 +4815,7 @@ pi_result piEnqueueMemBufferMap(pi_queue Queue, pi_mem Buffer,
48154815 // For integrated devices the buffer has been allocated in host memory.
48164816 if (Buffer->OnHost ) {
48174817 // Wait on incoming events before doing the copy
4818- if (Queue->isInOrderQueue ()) {
4818+ if (Queue->isInOrderQueue () && Queue-> LastCommandEvent != nullptr ) {
48194819 PI_CALL (piEventsWait (1 , &(Queue->LastCommandEvent )));
48204820
48214821 // Lock automatically releases when this goes out of scope.
@@ -4933,7 +4933,7 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr,
49334933 // For integrated devices the buffer is allocated in host memory.
49344934 if (MemObj->OnHost ) {
49354935 // Wait on incoming events before doing the copy
4936- if (Queue->isInOrderQueue ()) {
4936+ if (Queue->isInOrderQueue () && Queue-> LastCommandEvent != nullptr ) {
49374937 PI_CALL (piEventsWait (1 , &(Queue->LastCommandEvent )));
49384938
49394939 // Lock automatically releases when this goes out of scope.
0 commit comments