Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will call the "cleanup" of an event that wasn't explicitly waited with piEventsWait?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently nothing will call cleanup in this case no matter with or without proposed change.
Per our current implementation if event is not waited then it's refcount is not zero, so we won't go through check on line 5546 in this case.
And per current implementation cleanup is supposed to be called for event which was waited. It looks like it was done intentionally to not release/reset resources like associated kernel/commandlist if event was not waited.
We can change this behavior obviously and cleanup everything even if associated work is not finished. But I am not sure if it is going to be correct,
As for me proposed change is needed anyway, this call to cleanup() under RefCount == 0 check is incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That we cannot do, otherwise we might destroy some L0 resources that are still being used and result in a segfault or even worse. But we must cleanup everything after waiting for everything is completed. If we aren't cleaning up, this means we have memory leaks, right?
I don't disagree to that, but want to understand better why this was needed before.