Skip to content
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

[BACKEND] Added sycl backend support #234

Merged
merged 45 commits into from
Jan 26, 2024
Merged

Conversation

Sarbojit2019
Copy link
Contributor

@Sarbojit2019 Sarbojit2019 commented Jan 11, 2024

[Phase-1]

  1. Change brings SYCL backend used in troch. This will help triton workloads get sync with torch.
  2. Change is addressing open issue [FE]: Use SYCL runtime rather than L0 in Triton FE/driver #150

There is a phase-2 change planed which will cleanup / remove level-zero codes.

@Sarbojit2019 Sarbojit2019 marked this pull request as draft January 11, 2024 04:49
@vlad-penkin vlad-penkin added the enhancement New feature or request label Jan 11, 2024
@whitneywhtsang whitneywhtsang linked an issue Jan 11, 2024 that may be closed by this pull request
@Sarbojit2019
Copy link
Contributor Author

Current error/failures look to me as environmental issues. @vlad-penkin @whitneywhtsang Can any of maintainer please confirm?

image

@whitneywhtsang
Copy link
Contributor

Current error/failures look to me as environmental issues. @vlad-penkin @whitneywhtsang Can any of maintainer please confirm?

image

It is no longer failing with libmkl_sycl_blas.so.4, the new failure looks like

>       self.context = mod.init_context(torch.xpu.current_stream().sycl_queue)
E       ValueError: PyCapsule_GetPointer called with invalid PyCapsule object

/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/triton/runtime/driver.py:792: ValueError

@Sarbojit2019
Copy link
Contributor Author

@whitneywhtsang
Copy link
Contributor

@whitneywhtsang
Copy link
Contributor

@Sarbojit2019 Now that #239 is merged, please rebase your PR.
A general comment, don't think we need to keep the old code IMO, as we can get a copy from git log if needed.

@Sarbojit2019 Sarbojit2019 marked this pull request as ready for review January 18, 2024 09:44
Copy link
Contributor

@kurapov-peter kurapov-peter left a comment

Choose a reason for hiding this comment

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

The PR needs some general cleanup, but I'd like us to explicitly articulate how we solve the problem and what are the next steps.

We bring in the sycl runtime, get the necessary handles from pytorch to queues, device, etc, and generate the same kernel/module via L0. Finally, we bundle the kernel into a "sycl program", create a sycl kernel and transfer the ownership to the sycl runtime. We then submit a sycl kernel to a sycl queue so that any consumer of the queue would be able to wait on the event in that queue (by querying outstanding events).

Could you please extend this with the phase 2 as you named it?

python/triton/compiler/compiler.py Outdated Show resolved Hide resolved
third_party/xpu/backend/driver.c Outdated Show resolved Hide resolved
third_party/xpu/backend/driver.c Outdated Show resolved Hide resolved
third_party/xpu/backend/driver.c Outdated Show resolved Hide resolved
third_party/xpu/backend/driver.c Outdated Show resolved Hide resolved
third_party/xpu/backend/driver.c Outdated Show resolved Hide resolved
third_party/xpu/backend/driver.c Outdated Show resolved Hide resolved
third_party/xpu/backend/driver.py Outdated Show resolved Hide resolved
third_party/xpu/backend/driver.py Outdated Show resolved Hide resolved
third_party/xpu/backend/driver.c Outdated Show resolved Hide resolved
@kurapov-peter
Copy link
Contributor

Also, a general question. Have we considered simply wrapping a level zero event handle into a sycl object and putting it into the queue? What is the downside of such an approach? In other words, why do we want to redo the launcher all everything instead?

third_party/intel/backend/driver.c Outdated Show resolved Hide resolved
third_party/intel/backend/driver.py Outdated Show resolved Hide resolved
third_party/intel/backend/driver.py Outdated Show resolved Hide resolved
Sarbojit2019 and others added 2 commits January 26, 2024 07:33
Signed-off-by: Whitney Tsang <whitney.tsang@intel.com>
@whitneywhtsang whitneywhtsang merged commit 28c6247 into llvm-target Jan 26, 2024
3 checks passed
@whitneywhtsang whitneywhtsang deleted the sycl-backend branch January 26, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FE]: Use SYCL runtime rather than L0 in Triton FE/driver
5 participants