Skip to content

[SYCL] Do not track allocation if we don't own the handle #8792

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

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

againull
Copy link
Contributor

If we don't own level zero handle of the pi_mem then we can't control deallocation of that memory so there is no point of keeping track of the memory allocation for deferred memory release. More over currently level zero context is leaked because we increase its ref count at the point where we start tracking memory but don't decrement that ref count in USMFreeHelper. This PR fixes that problem.

@againull againull requested a review from a team as a code owner March 27, 2023 22:24
@@ -3344,7 +3344,7 @@ pi_result piextMemCreateWithNativeHandle(pi_native_handle NativeHandle,
pi_platform Plt = Context->getPlatform();
std::unique_lock<pi_shared_mutex> ContextsLock(Plt->ContextsMutex,
std::defer_lock);
if (IndirectAccessTrackingEnabled) {
if (IndirectAccessTrackingEnabled && ownNativeHandle) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a source code comment why we check the ownership

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added source code comment.

@againull againull requested a review from smaslov-intel March 27, 2023 22:49
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

@againull againull temporarily deployed to aws March 27, 2023 23:39 — with GitHub Actions Inactive
@againull againull temporarily deployed to aws March 28, 2023 00:55 — with GitHub Actions Inactive
@againull againull merged commit 4bf87d2 into intel:sycl Mar 28, 2023
@againull againull deleted the ownership branch April 17, 2023 16:50
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.

2 participants