Skip to content

[SYCL] Fix handling of host-side memory in 2D memops #8359

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

@steffenlarsen steffenlarsen commented Feb 15, 2023

The current implementation of 2D USM memory operations will launch a kernel as a fallback mechanism. However, these interfaces are also intended to accept pointers to USM and non-USM host memory. To allow this, the implementation now picks different fallback mechanisms depending on the type of pointer passed.

For fill/memset this means:

  1. Use a host-task with a fill per row if the pointer is to host memory.
  2. Use backend-defined interface if available.
  3. Use auxiliary fill kernel if pointer is to device memory.

For memcpy/copy this means:

  1. Use a host-task to copy memory when both pointers are to host memory.
  2. Use backend-defined interface if available.
  3. Enqueue a USM memcpy per row if one pointer is to in host memory and the other pointer is in device memory.
  4. Use auxiliary copy kernel if both pointers are to device memory.

The current implementation of 2D USM memory operations will launch a
kernel as a fallback mechanism. However, these interfaces are also
intended to accept pointers USM and non-USM host memory. To allow this,
the implementation now picks different fallback mechanisms depending
on the type of pointer passed.

For fill/memset this means:
 1. Always use backend-defined interface if available.
 2. Use auxiliary fill kernel if pointer is to device memory.
 3. Use a host-task with a fill per row if the pointer is to host
memory.

For memcpy/copy this means:
 1. Always use backend-defined interface if available.
 2. Use auxiliary copy kernel if both pointers are to device memory.
 3. Use a host-task with a copy per row if both pointer are to host
memory.
 4. Enqueue a USM memcpy per row if one pointer is to in host memory and
the other pointer is in device memory.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1597

@steffenlarsen steffenlarsen temporarily deployed to aws February 15, 2023 20:04 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 17, 2023 12:24 — with GitHub Actions Inactive
@steffenlarsen
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1597

@steffenlarsen steffenlarsen temporarily deployed to aws February 22, 2023 11:12 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 22, 2023 13:22 — with GitHub Actions Inactive
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen steffenlarsen temporarily deployed to aws February 22, 2023 20:25 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 22, 2023 20:58 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen marked this pull request as ready for review February 24, 2023 12:28
@steffenlarsen steffenlarsen requested a review from a team as a code owner February 24, 2023 12:28
@steffenlarsen
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1597

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1597

@steffenlarsen steffenlarsen temporarily deployed to aws February 24, 2023 17:14 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 24, 2023 18:14 — with GitHub Actions Inactive
@steffenlarsen
Copy link
Contributor Author

@intel/llvm-reviewers-runtime - Friendly ping.

@dm-vodopyanov dm-vodopyanov merged commit 2dcc581 into intel:sycl Mar 6, 2023
@dm-vodopyanov
Copy link
Contributor

@steffenlarsen there is ABI test failure on Windows: https://github.com/intel/llvm/actions/runs/4344793318/jobs/7588612300, can you please take a look?

@steffenlarsen
Copy link
Contributor Author

@steffenlarsen there is ABI test failure on Windows: https://github.com/intel/llvm/actions/runs/4344793318/jobs/7588612300, can you please take a look?

Thank you, @dm-vodopyanov ! Fixed in #8547.


// Do the following:
// 1. If both are host, use host_task to copy.
// 2. If either pointer is host or of the backend supports native memcpy2d,
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "or OF the backend"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in #8553.

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.

3 participants