Skip to content

Commit 7b8c809

Browse files
committed
fix initialization of lastCommandEvent.
Signed-off-by: rbegam <[email protected]>
1 parent 6a4bb7b commit 7b8c809

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

sycl/plugins/level_zero/pi_level_zero.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ struct _pi_queue : _pi_object {
335335
// this queue. this is used to add dependency with the last command to add
336336
// in-order semantics and updated with the latest event each time a new
337337
// command is enqueued.
338-
pi_event LastCommandEvent;
338+
pi_event LastCommandEvent = nullptr;
339339

340340
// Open command list field for batching commands into this queue.
341341
ze_command_list_handle_t ZeOpenCommandList = {nullptr};

0 commit comments

Comments
 (0)