Skip to content

Enable dpclang sycl compiler#3287

Open
dvrogozh wants to merge 1 commit intointel:mainfrom
dvrogozh:intel-llvm-2
Open

Enable dpclang sycl compiler#3287
dvrogozh wants to merge 1 commit intointel:mainfrom
dvrogozh:intel-llvm-2

Conversation

@dvrogozh
Copy link
Copy Markdown
Contributor

@dvrogozh dvrogozh commented Apr 8, 2026

dpclang compiler is an open source version of the closed source Intel DPC++ compiler. dpclang is being supported by Intel in the https://github.com/intel/llvm public repository and got recently packaged into upcoming Ubuntu 26.04 LTS.

This commit enables minimal support of dpclang compiler in PyTorch building towards fully open source PyTorch stack on Linux. Limitations:

  • Kineto, XCCL and oneMKL paths were not enabled and might require additional work
  • SYCL-TLA, oneDNN and Pytorch itself might require additional changes to properly handle dpclang compiler as it does not support __INTEL_LLVM_COMPILER macro

We will address above limitations in the follow up patches. At the moment the following procedure can be used to build PyTorch for XPU with dpclang compiler on Ubuntu 26.04:

  • Do NOT activate oneAPI environment
  • Install open source DPC++ compiler, OpenCL and few other tools with:
apt-get install dpclang-6 ocl-icd-opencl-dev pkg-config libze-dev
  • Build PyTorch as follows:
XPU_SYCL_COMPILER=dpclang USE_KINETO=0 USE_ONEMKL_XPU=0 \
  python3 setup.py develop

The dependency from pytorch/pytorch#179763 is weak in a sense that the change is transparent to the current production build of the PyTorch for XPU using oneAPI DL Essentials. The change in torch-xpu-ops is only required for the build with the dpclang.

Needs: pytorch/pytorch#179763

CC: @guangyey @EikanWang @chuanqi129 @frenchwr

`dpclang` compiler is an open source version of the closed source Intel
DPC++ compiler. `dpclang` is being supported by Intel in the https://github.com/intel/llvm
public repository and got recently packaged into upcoming Ubuntu 26.04 LTS.

This commit enables minimal support of `dpclang` compiler in PyTorch building
towards fully open source PyTorch stack on Linux. Limitations:

* Kineto, XCCL and oneMKL paths were not enabled and might require additional work
* SYCL-TLA, oneDNN and Pytorch itself might require additional changes to properly
  handle dpclang compiler as it does not support `__INTEL_LLVM_COMPILER` macro

We will address above limitations in the follow up patches. At the moment
the following procedure can be used to build PyTorch for XPU with `dpclang`
compiler on Ubuntu 26.04:

* Do NOT activate oneAPI environment
* Install open source DPC++ compiler, OpenCL and few other tools with:
```
apt-get install dpclang-6 ocl-icd-opencl-dev pkg-config libze-dev
```
* Build PyTorch as follows:

```
XPU_SYCL_COMPILER=dpclang USE_KINETO=0 USE_ONEMKL_XPU=0 \
  python3 setup.py develop
```

Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
dvrogozh added a commit to dvrogozh/pytorch that referenced this pull request Apr 8, 2026
`dpclang` compiler is an open source version of the closed source Intel
DPC++ compiler. `dpclang` is being supported by Intel in the https://github.com/intel/llvm
public repository and got recently packaged into upcoming Ubuntu 26.04 LTS.

This commit enables minimal support of `dpclang` compiler in PyTorch building
towards fully open source PyTorch stack on Linux. Limitations:

* Kineto, XCCL and oneMKL paths were not enabled and might require additional work
* SYCL-TLA, oneDNN and Pytorch itself might require additional changes to properly
  handle dpclang compiler as it does not support `__INTEL_LLVM_COMPILER` macro

We will address above limitations in the follow up patches. At the moment
the following procedure can be used to build PyTorch for XPU with `dpclang`
compiler on Ubuntu 26.04:

* Do NOT activate oneAPI environment
* Install open source DPC++ compiler, OpenCL and few other tools with:
```
apt-get install dpclang-6 ocl-icd-opencl-dev pkg-config libze-dev
```
* Build PyTorch as follows:

```
XPU_SYCL_COMPILER=dpclang USE_KINETO=0 USE_ONEMKL_XPU=0 \
  python3 setup.py develop
```

The dependency from intel/torch-xpu-ops#3287 is weak in
a sense that the change is transparent to the current production build of the
PyTorch for XPU using oneAPI DL Essentials. The change in torch-xpu-ops is only
required for the build with the `dpclang`.

Needs: intel/torch-xpu-ops#3287
Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
@dvrogozh dvrogozh requested review from EikanWang and guangyey April 9, 2026 15:13
@tsocha
Copy link
Copy Markdown
Contributor

tsocha commented Apr 10, 2026

@dvrogozh
USE_KINETO is enabled by default in pytorch.
Could you recompile it with it enabled?
It's better to know issues as fast as possible.

@dvrogozh
Copy link
Copy Markdown
Contributor Author

@tsocha, USE_KINETO for XPU requires PTI library to be available, but it was not yet enabled with the dpclang compiler. We are working on that. If someone will attempt to build pytorch with the USE_KINETO=1 he will get the straightforward configuration error that PTI was not found. Thus, at the moment there are no issues we can identify on pytorch side related to profiling path when we build with dpclang compiler. We will start see these errors once PTI will get enabled and we will have a chance to start enabling profiling path in pytorch when it is compiled with dpclang.

I will file an issue today to start tracking tasks required for enabling pytorch build against Linux provided dependencies instead of oneAPI and break down the planned steps in there.

  CMake Error at third_party/kineto/libkineto/src/plugin/xpupti/CMakeLists.txt:23 (find_package):
    By not providing "FindPti.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "Pti", but
    CMake did not find one.

    Could not find a package configuration file provided by "Pti" with any of
    the following names:

      Pti.cps
      pti.cps
      PtiConfig.cmake
      pti-config.cmake

    Add the installation prefix of "Pti" to CMAKE_PREFIX_PATH or set "Pti_DIR"
    to a directory containing one of the above files.  If "Pti" provides a
    separate development package or SDK, be sure it has been installed.

@guangyey
Copy link
Copy Markdown
Contributor

@EikanWang WDYT

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.

4 participants