Skip to content

Fix sycl event sync for ONEMKL #1757

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Fix sycl event sync for ONEMKL #1757

wants to merge 3 commits into from

Conversation

CuiYifeng
Copy link
Contributor

No description provided.

@Copilot Copilot AI review requested due to automatic review settings June 19, 2025 15:20
@CuiYifeng CuiYifeng added windows_ci Only for Windows CI trigger mkl labels Jun 19, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes error handling for SYCL ONEMKL routines by adding an explicit wait on the returned event before checking for asynchronous queue errors.

  • Added e.wait_and_throw() to force synchronous exception delivery from the SYCL event.
  • Retained q.throw_asynchronous() to catch any queued errors after event completion.
Comments suppressed due to low confidence (1)

src/ATen/native/xpu/mkl/BatchLinearAlgebra.cpp:24

  • [nitpick] It would be helpful to add a comment explaining why both wait_and_throw() and throw_asynchronous() are used here to clarify the error-handling strategy for future maintainers.
    e.wait_and_throw();                     \

@@ -21,6 +21,7 @@ namespace at::native::xpu {
#define SYCL_ONEMKL_SUBMIT(q, routine, ...) \
{ \
auto e = (routine(__VA_ARGS__)); \
e.wait_and_throw(); \
Copy link
Preview

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

Adding a synchronous wait on the SYCL event will block the host thread for each submission, which may degrade throughput. Consider whether per-event blocking is necessary or if errors can be batched or handled asynchronously.

Suggested change
e.wait_and_throw(); \
e.wait(); \

Copilot uses AI. Check for mistakes.

@CuiYifeng CuiYifeng changed the title Fix sycl event sycl for ONEMKL Fix sycl event sync for ONEMKL Jun 19, 2025
@CuiYifeng CuiYifeng marked this pull request as draft June 22, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mkl windows_ci Only for Windows CI trigger
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants