-
Notifications
You must be signed in to change notification settings - Fork 789
[SYCL][L0] Fix memory leak in pi Queue #2905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Retain Queue whenever a pi_event associates a pi_queue. Release the associated pi_queue when a pi_event is released. Signed-off-by: Byoungro So <[email protected]>
…mutex Signed-off-by: Byoungro So <[email protected]>
Signed-off-by: Byoungro So <[email protected]>
@smaslov-intel Please review this PR. Thanks. |
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.
I certainly like this approach better than #2899, so please abandon that one.
Signed-off-by: Byoungro So <[email protected]>
Signed-off-by: Byoungro So <[email protected]>
Signed-off-by: Byoungro So <[email protected]>
Signed-off-by: Byoungro So <[email protected]>
Vào Th 4, 6 thg 1, 2021 lúc 23:10 smaslov-intel <[email protected]>
đã viết:
… ***@***.**** commented on this pull request.
------------------------------
In sycl/plugins/level_zero/pi_level_zero.cpp
<#2905 (comment)>:
> @@ -1995,8 +2020,7 @@ pi_result piQueueRetain(pi_queue Queue) {
pi_result piQueueRelease(pi_queue Queue) {
PI_ASSERT(Queue, PI_INVALID_QUEUE);
- // Lock automatically releases when this goes out of scope.
- std::lock_guard<std::mutex> lock(Queue->PiQueueMutex);
+ Queue->PiQueueMutex.lock();
I see. Can we maybe do smth like this:
{
need_delete = false
lock_gaurd()
if (...) {
need_delete = true
}
}
if (need_delete) delete;
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2905 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQBNS7ZTZ5OIQL6LQ7EGT3LSYSDQRANCNFSM4VAXZBQA>
.
|
Hi I am sorry, I don't understand this comments. Can you speak in English? |
Signed-off-by: Byoungro So <[email protected]>
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.
LGTM but there are fails in the tests
Thanks for approval. It could be related to the lock_guard. I will look into it today. Thanks, Sergey. |
@@ -4282,15 +4311,14 @@ pi_result piEnqueueMemBufferMap(pi_queue Queue, pi_mem Buffer, | |||
ze_fence_handle_t ZeFence = nullptr; | |||
ze_event_handle_t ZeEvent = nullptr; | |||
|
|||
// Lock automatically releases when this goes out of scope. | |||
std::lock_guard<std::mutex> lock(Queue->PiQueueMutex); | |||
|
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.
I can't move this up because piEventsWait is trying to acquire the lock. So reverting this change.
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.
you can still have this lock specially for createEventAndAssociateQueue, before line 4318
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.
Yes, that's what did. I moved it inside the { } so the lock_guard is only used for createEventAndAssociateQueue. There is a separate lock_guard in the original line below.
|
||
// Lock automatically releases when this goes out of scope. | ||
std::lock_guard<std::mutex> lock(Queue->PiQueueMutex); | ||
|
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.
Same here. I can't move the lock here because of piEventsWait below.
Signed-off-by: Byoungro So <[email protected]>
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.
LGTM
Retain Queue whenever a pi_event associates a pi_queue.
Release the associated pi_queue when a pi_event is released.
Signed-off-by: Byoungro So [email protected]