Skip to content

[SYCL] Remove OwnZeMemHandle from USMAllocator #7853

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 1 commit into from
Mar 24, 2023

Conversation

igchor
Copy link
Member

@igchor igchor commented Dec 20, 2022

OwnZeMemHandle is used to track whether an allocation should be freed by the runtime or not.

There is no point in passing this flag to USMAllocator and then to USMFreeHelper since the allocation cannot come from the USMAllocator (it can only be from zeMemAlloc*).

I've thought about moving the memory allocation code to UR first, but there are a lot of dependencies: we would have to move the implementation of context, device, event, and queue at least. It seemed that doing this small change first made more sense.

@igchor igchor requested review from a team as code owners December 20, 2022 21:46
@igchor igchor requested a review from againull December 20, 2022 21:46
@igchor
Copy link
Member Author

igchor commented Dec 20, 2022

I'm not entirely sure if doing RefCount.decrementAndTest for a MemAlloc Context which does not own the memory makes sense here: https://github.com/intel/llvm/pull/7853/files#diff-15dd1eb076d2164bd9e87d9057f05f652a716498e8cdf5975e564c65309a0985R8403) or if it would be better to just skip calling USMFreeHelper at all but for now, I just left it as it is for consistency.

@igchor
Copy link
Member Author

igchor commented Jan 18, 2023

@smaslov-intel could you please take a look at this PR?

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

Copy link
Contributor

@jandres742 jandres742 left a comment

Choose a reason for hiding this comment

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

+1

@igchor igchor force-pushed the usm_allocator_remove_flag branch from b48835b to 62936e5 Compare January 30, 2023 20:41
@igchor igchor temporarily deployed to aws January 30, 2023 21:07 — with GitHub Actions Inactive
@igchor igchor temporarily deployed to aws January 30, 2023 21:47 — with GitHub Actions Inactive
@igchor
Copy link
Member Author

igchor commented Jan 30, 2023

@intel/llvm-gatekeepers I've just rebased the PR - I think it's ready for merge.

@igchor igchor temporarily deployed to aws January 31, 2023 09:56 — with GitHub Actions Inactive
@igchor igchor temporarily deployed to aws January 31, 2023 11:06 — with GitHub Actions Inactive
@igchor
Copy link
Member Author

igchor commented Feb 3, 2023

@intel/llvm-gatekeepers @againull @smaslov-intel is there something pending to merge this?

@bader
Copy link
Contributor

bader commented Feb 3, 2023

@igchor, review from @intel/llvm-reviewers-runtime is missing.

@aelovikov-intel
Copy link
Contributor

@igchor, review from https://github.com/orgs/intel/teams/llvm-reviewers-runtime is missing.

But why is it needed? Should we change codeowner for the Unified Runtime directories?

@igchor
Copy link
Member Author

igchor commented Feb 3, 2023

@igchor, review from https://github.com/orgs/intel/teams/llvm-reviewers-runtime is missing.

But why is it needed? Should we change codeowner for the Unified Runtime directories?

I think the idea was that the common part of Unified Runtime (including usm_allocator) would be eventually owned by Codeplay and the Intel UR team (people from https://github.com/orgs/oneapi-src/teams/unified-runtime-maintain)

@smaslov-intel
Copy link
Contributor

@igchor, review from https://github.com/orgs/intel/teams/llvm-reviewers-runtime is missing.

But why is it needed? Should we change codeowner for the Unified Runtime directories?

I think the idea was that the common part of Unified Runtime (including usm_allocator) would be eventually owned by Codeplay and the Intel UR team (people from https://github.com/orgs/oneapi-src/teams/unified-runtime-maintain)

I suggest that we keep current ownership until https://github.com/intel/llvm/tree/sycl/sycl/plugins/unified_runtime/ur is moved into a separate repo, where the new ownership would be more natural. ETA EoQ1'23

@igchor
Copy link
Member Author

igchor commented Feb 6, 2023

@igchor, review from https://github.com/orgs/intel/teams/llvm-reviewers-runtime is missing.

But why is it needed? Should we change codeowner for the Unified Runtime directories?

I think the idea was that the common part of Unified Runtime (including usm_allocator) would be eventually owned by Codeplay and the Intel UR team (people from https://github.com/orgs/oneapi-src/teams/unified-runtime-maintain)

I suggest that we keep current ownership until https://github.com/intel/llvm/tree/sycl/sycl/plugins/unified_runtime/ur is moved into a separate repo, where the new ownership would be more natural. ETA EoQ1'23

Do you think it would make sense to move just the usm_allocator to the UR repo before EoQ1? We already moved the core UMA abstractions there. This would minimize changes required in the llvm repo - (we would only need to integrate L0 adapter with UMA)

@smaslov-intel
Copy link
Contributor

@igchor, review from https://github.com/orgs/intel/teams/llvm-reviewers-runtime is missing.

But why is it needed? Should we change codeowner for the Unified Runtime directories?

I think the idea was that the common part of Unified Runtime (including usm_allocator) would be eventually owned by Codeplay and the Intel UR team (people from https://github.com/orgs/oneapi-src/teams/unified-runtime-maintain)

I suggest that we keep current ownership until https://github.com/intel/llvm/tree/sycl/sycl/plugins/unified_runtime/ur is moved into a separate repo, where the new ownership would be more natural. ETA EoQ1'23

Do you think it would make sense to move just the usm_allocator to the UR repo before EoQ1? We already moved the core UMA abstractions there. This would minimize changes required in the llvm repo - (we would only need to integrate L0 adapter with UMA)

Yeah, let's do that.

@bader
Copy link
Contributor

bader commented Mar 24, 2023

@igchor, could you resolve merge conflicts, please?

OwnZeMemHandle is used to track whether an allocation
should be freed by the runtime or not.

There is no point in passing this flag to USMAllocator
and then to USMFreeHelper since the allocation cannot
come from the USMAllocator (it can only be from zeMemAlloc*).
@igchor igchor force-pushed the usm_allocator_remove_flag branch from 62936e5 to d56ca08 Compare March 24, 2023 17:35
@igchor
Copy link
Member Author

igchor commented Mar 24, 2023

@igchor, could you resolve merge conflicts, please?

Sure, done.

@igchor igchor temporarily deployed to aws March 24, 2023 18:46 — with GitHub Actions Inactive
@igchor igchor temporarily deployed to aws March 24, 2023 19:33 — with GitHub Actions Inactive
@bader
Copy link
Contributor

bader commented Mar 24, 2023

Failed Tests (1):
SYCL :: XPTI/kernel/basic.cpp

This issue was caused by 18899cc, which was reverted in 01511a3.

@bader bader merged commit 00ae1e7 into intel:sycl Mar 24, 2023
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.

5 participants