Skip to content

[SYCL] Fix PI event leak in memcpy2d device-host fallback #8878

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

Conversation

steffenlarsen
Copy link
Contributor

The fallback mechanism for memcpy2d and copy2d between host and device enqueues a number of memcpy operations to/from device and inserts a marker event to signify the convergence. Currently the intermediate events are not correctly released, causing them to leak. This commit fixes this by utilizing an existing RAII PI event managed object to manage the lifetime of these events.

The fallback mechanism for memcpy2d and copy2d between host and device
enqueues a number of memcpy operations to/from device and inserts a
marker event to signify the convergence. Currently the intermediate
events are not correctly released, causing them to leak. This commit
fixes this by utilizing an existing RAII PI event managed object to
manage the lifetime of these events.

Signed-off-by: Larsen, Steffen <[email protected]>
@steffenlarsen steffenlarsen requested a review from a team as a code owner March 30, 2023 13:06
@steffenlarsen steffenlarsen temporarily deployed to aws March 30, 2023 13:34 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws March 30, 2023 14:52 — with GitHub Actions Inactive
@@ -963,13 +964,19 @@ void MemoryManager::copy_2d_usm(const void *SrcMem, size_t SrcPitch,
#endif // NDEBUG

// The fallback in this case is to insert a copy per row.
// We keep both a vector of the raw PI events and managed objects to ensure
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, but I'd change to

  // The fallback in this case is to insert a copy per row.
  std::vector<OwnedPiEvent> CopyEventsManaged;
  CopyEventsManaged.reserve(Height);
  // We'll need continuous range of events for a wait later as well. 
  std::vector<RT::PiEvent> CopyEvents(Height);

Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
@steffenlarsen steffenlarsen temporarily deployed to aws March 31, 2023 09:20 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws March 31, 2023 09:36 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws March 31, 2023 10:22 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws March 31, 2023 10:34 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws March 31, 2023 11:15 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws March 31, 2023 12:08 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen merged commit 24ec33c into intel:sycl Mar 31, 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.

2 participants