Skip to content

[SYCL] Adding SYCL backend to support for Intel XPUs - #215

Open
abagusetty wants to merge 12 commits into
PASSIONLab:mainfrom
abagusetty:xpu-support
Open

abagusetty wants to merge 12 commits into
PASSIONLab:mainfrom
abagusetty:xpu-support

Conversation

@abagusetty

@abagusetty abagusetty commented Sep 3, 2026

Copy link
Copy Markdown

Major changes:

  • Added feature support to target Intel GPUs (on ANL Aurora) via SYCL backend and generalize device selection so CUDA, HIP and SYCL are handled seamlessly

@vbharadwaj-bk

Copy link
Copy Markdown
Member

Great feature, thanks! This will take some time to review and test - so bear with us, but with some back and forth we'll see where we land.

Kernels are generated as SYCL free functions and compiled at runtime through
the oneAPI kernel compiler. The Jinja templates are shared with CUDA and HIP
via templates/sycl_compat.cuh; the backend is now a string rather than an
is_hip boolean, and JITKernel::execute also takes argument sizes.
Mirrors the CUDA job. GitHub offers no Intel GPU runner, so only the build is
exercised.
The stable-ABI headers the extension includes are not all present before 2.10,
which the precompiled-extension check in extlib has required all along. The
SYCL guard now enforces the same floor.
Upstream PASSIONLab#217 replaced HIP's __threadfence_block() with the amdgcn wave
barrier, so no template emits the token any more.
@vbharadwaj-bk

Copy link
Copy Markdown
Member

Got a review in progress for this, about 20/50 files in; thanks for the patience, it's going

@abagusetty

Copy link
Copy Markdown
Author

Got a review in progress for this, about 20/50 files in; thanks for the patience, it's going

Thanks @vbharadwaj-bk Appreciate for going through this. Not a small PR!

@vbharadwaj-bk vbharadwaj-bk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@abagusetty I read every one of the + 1375 -270 line diff 😅 actually, I think this will work nicely with our current setup and I have left comments in the files. Much of this is mechanical; high-level, so you can have an LLM take care of some of this

  1. LLMs tend to leave a lot of inline / block comments. Let's remove 99% of them, I think there were only one or two comments throughout the entire diff that I felt were necessary to understand something.

  2. Let's roll back the changes to group_mm / symmetric contraction, as there is another PR in the queue to address the BLAS dependency and this should no longer be required. Or worst case, we won't support symmetric contraction on SYCL just yet.

  3. There are just a few requests for code logic changes in certain files.

  4. Let's hold off on the README / changelog things for now, we'll work with you on those once this batch of changes is in.

I didn't see any big logical gaps, but I also haven't tested this for regression on the existing backends; I will do that once this round of edits is done. In case there are bugs filed specifically for the SYCL backend, we will probably refer them to you to address, since we don't have Intel hardware. Are you ok with this, at least for a little while?

^^ Once this round of edits is done, and if we can refer bugs to you for some period of time, then I think with one more review, we can merge this.

Comment thread .github/workflows/requirements_sycl_ci.txt Outdated
Comment thread .github/workflows/verify_extension_build.yml Outdated
Comment thread .github/workflows/verify_extension_build.yml
Comment thread docs/index.rst Outdated
Comment thread openequivariance/openequivariance/_torch/extlib/__init__.py Outdated
Builds the Jinja environment used to render the kernel templates.

:param backend: one of ``"cuda"``, ``"hip"`` or ``"sycl"``.
:param warp_size: size of a warp / wavefront / sub-group. Only consulted by

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm - warp size is needed by HIP as well.. but maybe that's a separate bug we need to address.

Comment thread openequivariance/openequivariance/templates/macros.jinja Outdated
Comment thread openequivariance/CMakeLists.txt Outdated
Comment thread openequivariance/openequivariance/templates/sycl_compat.cuh Outdated
Comment thread openequivariance/openequivariance/templates/sycl_compat.cuh Outdated

@vbharadwaj-bk vbharadwaj-bk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the thorough revision @abagusetty - things look good, added just a couple more --nodocuments (pesky, sorry), but there are no more logic changes remaining so I started the CUDA / HIP regression testing on our end.

Remaining items:

  • CUDA / HIP regression testing
  • Resolution of these last --nodocuments (in parallel)
  • (strictly after the last two) CI-ready label
  • Merge


class GroupMM:
def __init__(self, dtype, num_elements, batch_size):
# group_gemm is not built for SYCL, so the operator does not exist there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--nodocument, redundant

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done



if extlib.BUILT_EXTENSION:
# group_gemm is not built for SYCL, so the operator does not exist there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--nodocument

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

else:
from torch.profiler import ProfilerActivity, profile, record_function

# Profiler activity is per-accelerator.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--nodocument

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

namespace syclex = sycl::ext::oneapi::experimental;
namespace twi = sycl::ext::oneapi::this_work_item;

// The sub-group size is fixed to the warp size the schedule was generated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--nodocument

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done


#define __launch_bounds__(...)

// All generated kernels are launched as 1D nd_ranges, so only .x is meaningful.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--nodocument

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

return ref.fetch_add(val);
}

// Templated on both operands to keep the mixed-width call sites working.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--nodocument

}

/*
* Registered after the first compile, not at static init: libsycl-jit is

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--nodocument, got it, I think this actually becomes pretty clear just reading the code.

@vbharadwaj-bk

Copy link
Copy Markdown
Member

Update: regression tests pass; with the short round of edits above, should be good to go.

@abagusetty

Copy link
Copy Markdown
Author

Appreciate for the keen eye @vbharadwaj-bk, will go through rest of them. I was sure, I didnt address all of your comments :)

Happy to take on any bugs related to SYCL and `ll try to host a CI on intel hardware on our end or will just fall back to manual testing

@abagusetty

Copy link
Copy Markdown
Author

@vbharadwaj-bk Thanks again for your time. I did manage to resolve most, please let me know if anything get missed

This branch has not been deployed

No deployments
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