File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
source/adapters/level_zero Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -833,11 +833,8 @@ urEventRetain(ur_event_handle_t Event ///< [in] handle of the event object
833
833
ur_result_t
834
834
urEventRelease (ur_event_handle_t Event // /< [in] handle of the event object
835
835
) {
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));
841
838
return UR_RESULT_SUCCESS;
842
839
}
843
840
@@ -1057,7 +1054,8 @@ ur_result_t urEventReleaseInternal(ur_event_handle_t Event) {
1057
1054
// When we add an event to the cache we need to check whether profiling is
1058
1055
// enabled or not, so we access properties of the queue and that's why queue
1059
1056
// must released later.
1060
- if (DisableEventsCaching || !Event->OwnNativeHandle ) {
1057
+ if ((Event->RefCountExternal > 0 && !Event->CounterBasedEventsEnabled ) &&
1058
+ (DisableEventsCaching || !Event->OwnNativeHandle )) {
1061
1059
delete Event;
1062
1060
} else {
1063
1061
Event->Context ->addEventToContextCache (Event);
You can’t perform that action at this time.
0 commit comments