Skip to content

Conversation

@bso-intel
Copy link
Contributor

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]

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]>
@bso-intel bso-intel marked this pull request as ready for review December 24, 2020 20:43
@bso-intel
Copy link
Contributor Author

@smaslov-intel Please review this PR. Thanks.

Copy link
Contributor

@smaslov-intel smaslov-intel left a 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]>
@daoviethoang0793
Copy link

daoviethoang0793 commented Jan 6, 2021 via email

@bso-intel
Copy link
Contributor Author

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_guardstd::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?

smaslov-intel
smaslov-intel previously approved these changes Jan 6, 2021
Copy link
Contributor

@smaslov-intel smaslov-intel left a 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

@bso-intel
Copy link
Contributor Author

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.


// Lock automatically releases when this goes out of scope.
std::lock_guard<std::mutex> lock(Queue->PiQueueMutex);

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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);

Copy link
Contributor Author

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.

Copy link
Contributor

@smaslov-intel smaslov-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pvchupin pvchupin merged commit 051e140 into intel:sycl Jan 8, 2021
@bso-intel bso-intel deleted the retain-queue branch January 8, 2021 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants