Skip to content

Commit 7a5dfbe

Browse files
[L0] Fixed urQueueRelease from urEventReleaseInternal
Signed-off-by: Winston Zhang <winston.zhang@intel.com>
1 parent 9e4c7e3 commit 7a5dfbe

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

source/adapters/level_zero/event.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -833,11 +833,8 @@ urEventRetain(ur_event_handle_t Event ///< [in] handle of the event object
833833
ur_result_t
834834
urEventRelease(ur_event_handle_t Event ///< [in] handle of the event object
835835
) {
836-
if (--Event->RefCountExternal == 0 && Event->CounterBasedEventsEnabled) {
837-
Event->Context->addEventToContextCache(Event);
838-
} else {
839-
UR_CALL(urEventReleaseInternal(Event));
840-
}
836+
Event->RefCountExternal--;
837+
UR_CALL(urEventReleaseInternal(Event));
841838
return UR_RESULT_SUCCESS;
842839
}
843840

@@ -1057,7 +1054,8 @@ ur_result_t urEventReleaseInternal(ur_event_handle_t Event) {
10571054
// When we add an event to the cache we need to check whether profiling is
10581055
// enabled or not, so we access properties of the queue and that's why queue
10591056
// must released later.
1060-
if (DisableEventsCaching || !Event->OwnNativeHandle) {
1057+
if ((Event->RefCountExternal > 0 && !Event->CounterBasedEventsEnabled) &&
1058+
(DisableEventsCaching || !Event->OwnNativeHandle)) {
10611059
delete Event;
10621060
} else {
10631061
Event->Context->addEventToContextCache(Event);

0 commit comments

Comments
 (0)