Skip to content

Add a standalone tutorial for integrating custom op using sycl for Intel GPU #3470

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ZhaoqiongZ
Copy link
Contributor

add a standalone tutorial for integrating custom op using sycl for Intel GPU

Copy link

pytorch-bot bot commented Jul 17, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3470

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure

As of commit 1804342 with merge base b78fc75 (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the cla signed label Jul 17, 2025
@ZhaoqiongZ ZhaoqiongZ changed the title add tutorial for integrate custom op using sycl Add a standalone tutorial for integrating custom op using sycl for Intel GPU Jul 17, 2025
@ZhaoqiongZ
Copy link
Contributor Author

@pytorchbot label "2.8"

@pytorch-bot pytorch-bot bot added the 2.8 label Jul 17, 2025
@ZhaoqiongZ
Copy link
Contributor Author

Hi @dvrogozh @albanD @malfet @svekars , could you help review this PR, this replace #3391

Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

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

one comment, otherwise lgtm

@ZhaoqiongZ ZhaoqiongZ requested a review from zou3519 July 18, 2025 02:19
Copy link
Contributor

@albanD albanD left a comment

Choose a reason for hiding this comment

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

Content sounds good to me. Will let @svekars do the final review.

If you need to compile **SYCL** code (for example, ``.sycl`` files), use `torch.utils.cpp_extension.SyclExtension <https://docs.pytorch.org/docs/stable/cpp_extension.html#torch.utils.cpp_extension.SyclExtension>`_.
The setup process is very similar to C++/CUDA, except the compilation arguments need to be adjusted for SYCL.

Using ``sycl_extension`` is as simple as writing the following ``setup.py``:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Using ``sycl_extension`` is as simple as writing the following ``setup.py``:
Using ``sycl_extension`` is as straightforward as writing the following ``setup.py``:

This is just a personal preference, but I try to avoid using words like "simple," "easy," etc, in docs - just to make sure it's inclusive and folks don't feel frustrated if something doesn't work..


Defining the custom op and adding backend implementations
---------------------------------------------------------
First, let's write a Sycl function that computes ``mymuladd``:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
First, let's write a Sycl function that computes ``mymuladd``:
First, let's write a SYCL function that computes ``mymuladd``:

let's be consistent in capitalization

}

// ==================================================
// Register Sycl Implementations to Torch Library
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Register Sycl Implementations to Torch Library
// Register SYCL Implementations to Torch Library

"ops",
]

Testing sycl extension operator
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Testing sycl extension operator
Testing SYCL extension operator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants