Skip to content

Commit ece1e2c

Browse files
nrspruitkbenzie
authored andcommitted
[L0] Fix timestamp event evict after delete
Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent ea00936 commit ece1e2c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

source/adapters/level_zero/event.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,15 +1014,7 @@ ur_result_t urEventReleaseInternal(ur_event_handle_t Event) {
10141014
}
10151015

10161016
// Save pointer to the queue before deleting/resetting event.
1017-
// When we add an event to the cache we need to check whether profiling is
1018-
// enabled or not, so we access properties of the queue and that's why queue
1019-
// must released later.
10201017
auto Queue = Event->UrQueue;
1021-
if (DisableEventsCaching || !Event->OwnNativeHandle) {
1022-
delete Event;
1023-
} else {
1024-
Event->Context->addEventToContextCache(Event);
1025-
}
10261018

10271019
// If the event was a timestamp recording, we try to evict its entry in the
10281020
// queue.
@@ -1041,6 +1033,15 @@ ur_result_t urEventReleaseInternal(ur_event_handle_t Event) {
10411033
}
10421034
}
10431035

1036+
// When we add an event to the cache we need to check whether profiling is
1037+
// enabled or not, so we access properties of the queue and that's why queue
1038+
// must released later.
1039+
if (DisableEventsCaching || !Event->OwnNativeHandle) {
1040+
delete Event;
1041+
} else {
1042+
Event->Context->addEventToContextCache(Event);
1043+
}
1044+
10441045
// We intentionally incremented the reference counter when an event is
10451046
// created so that we can avoid ur_queue_handle_t is released before the
10461047
// associated ur_event_handle_t is released. Here we have to decrement it so

0 commit comments

Comments
 (0)