intel / intel/llvm

Support .sycl file extension

Open
#15,015 8 comments 0 reactions 0 assignees View on GitHub
confirmed enhancement
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

Please, help to support dedicated `.sycl` file extension. This feature is needed to automate limiting dpc++ usage to sycl files in the projects which 1) are using non-dpc++ compiler (gcc, clang) for c/c++ source and 2) not willing to switch to dpc++ for existing c++ code. This will also help projects to stand out sycl kernels for easier search and maintenance.

Pytorch is an example of such project. Specifically, this feature is needed to help support [torch.utils.cpp_extension.load()](https://pytorch.org/docs/stable/cpp_extension.html#torch.utils.cpp_extension.load) pytorch API (see https://github.com/pytorch/pytorch/issues/132944). This API provides users a capability to build pytorch extensions containing device specific kernel code. Users can combine native c++, sycl code and cuda code. Example:
```
module = torch.utils.cpp_extension.load(
name="my_extension",
sources=[
"extension.cpp",
"cuda_extension.cu",
"xpu_extension.sycl",
]
)
```

**Workaround:** At the moment this can be handled by passing `-x c++ file.sycl` to dpc++ compiler. However, we would like to make sure that dpc++ compiler has that in plans to standardize upon `.sycl` extension to avoid divergence in the future. We are ok to consider different sycl-dedicated extensions if `.sycl` does not seem right for any reason.

These are PRs on pytorch ecosystem side which are getting use of the above WA:
* https://github.com/pytorch/pytorch/pull/132945
* https://github.com/huggingface/optimum-quanto/pull/273

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.