Skip to content

Commit c49eeda

Browse files
authored
[SYCL] Queue has to be released later than event (#7225)
1 parent cac4727 commit c49eeda

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6026,20 +6026,25 @@ static pi_result piEventReleaseInternal(pi_event Event) {
60266026
PI_CALL(piEventReleaseInternal(Event->HostVisibleEvent));
60276027
}
60286028

6029-
// We intentionally incremented the reference counter when an event is
6030-
// created so that we can avoid pi_queue is released before the associated
6031-
// pi_event is released. Here we have to decrement it so pi_queue
6032-
// can be released successfully.
6033-
if (Event->Queue) {
6034-
PI_CALL(piQueueReleaseInternal(Event->Queue));
6035-
}
6036-
6029+
// Save pointer to the queue before deleting/resetting event.
6030+
// When we add an event to the cache we need to check whether profiling is
6031+
// enabled or not, so we access properties of the queue and that's why queue
6032+
// must released later.
6033+
auto Queue = Event->Queue;
60376034
if (DisableEventsCaching || !Event->OwnZeEvent) {
60386035
delete Event;
60396036
} else {
60406037
Event->Context->addEventToCache(Event);
60416038
}
60426039

6040+
// We intentionally incremented the reference counter when an event is
6041+
// created so that we can avoid pi_queue is released before the associated
6042+
// pi_event is released. Here we have to decrement it so pi_queue
6043+
// can be released successfully.
6044+
if (Queue) {
6045+
PI_CALL(piQueueReleaseInternal(Queue));
6046+
}
6047+
60436048
return PI_SUCCESS;
60446049
}
60456050

0 commit comments

Comments
 (0)