pytorch/test/cpp_extensions
Dmitry Rogozhkin d27ecf85db xpu: support sycl with torch.utils.cpp_extension APIs (#132945)
This patch adds support for sycl kernels build via `torch.utils.cpp_extension.load`, `torch.utils.cpp_extension.load_inline` and (new) `class SyclExtension` APIs. Files having `.sycl` extension are considered to have sycl kernels and are compiled with `icpx` (dpc++ sycl compiler from Intel). Files with other extensions, `.cpp`, `.cu`, are handled as before. API supports building sycl along with other file types into single extension.

Note that `.sycl` file extension is a PyTorch convention for files containing sycl code which I propose to adopt. We did follow up with compiler team to introduce such file extension in the compiler, but they are opposed to this. At the same time discussion around sycl file extension and adding sycl language support into such tools as cmake is ongoing. Eventually cmake also considers to introduce some file extension convention for sycl. I hope we can further influence cmake and compiler communities to broader adopt `.sycl` file extension.

By default SYCL kernels are compiled for all Intel GPU devices for which pytorch native aten SYCL kernels are compiled. At the moment `pvc,xe-lpg`. This behavior can be overridden by setting `TORCH_XPU_ARCH_LIST` environment variables to the comma separated list of desired devices to compile for.

Fixes: #132944

CC: @gujinghui @EikanWang @fengyuan14 @guangyey @jgong5

Pull Request resolved: https://github.com/pytorch/pytorch/pull/132945
Approved by: https://github.com/albanD, https://github.com/guangyey, https://github.com/malfet

Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
2025-02-16 16:50:59 +00:00
..
no_python_abi_suffix_test [BE][Easy][7/19] enforce style for empty lines in import segments in test/[a-c]*/ and test/[q-z]*/ (#129758) 2024-07-31 10:54:03 +00:00
open_registration_extension OpenReg: fix issue of pin_memory (#145046) 2025-01-28 09:41:04 +00:00
python_agnostic_extension Set -DPy_LIMITED_API flag for py_limited_api=True extensions (#145764) 2025-01-28 20:11:05 +00:00
self_compiler_include_dirs_test
torch_test_cpp_extension
cpp_c10d_extension.cpp
cpp_c10d_extension.hpp
cpp_frontend_extension.cpp
cublas_extension.cpp
cuda_dlink_extension_add.cu
cuda_dlink_extension_add.cuh
cuda_dlink_extension_kernel.cu
cuda_dlink_extension.cpp
cuda_extension_kernel.cu
cuda_extension_kernel2.cu
cuda_extension.cpp
cuda_extension.cu
cudnn_extension.cpp
cusolver_extension.cpp
dangling_impl_extension.cpp
doubler.h
extension.cpp
identity.cpp
jit_extension.cpp
jit_extension2.cpp
maia_extension.cpp
mps_extension.mm [BE] Use helper functions in mps_extension (#137313) 2024-10-04 00:26:38 +00:00
mtia_extension.cpp Make Context to be Device-agnostic Step by Step (1/N) (#136519) (#138155) 2024-10-17 20:58:56 +00:00
open_registration_extension.cpp [1/N] OpenReg: Replace open_registration_extension.cpp with openreg (#141815) 2025-01-14 15:59:00 +00:00
rng_extension.cpp
setup.py xpu: support sycl with torch.utils.cpp_extension APIs (#132945) 2025-02-16 16:50:59 +00:00
torch_library.cu
xpu_extension.sycl xpu: support sycl with torch.utils.cpp_extension APIs (#132945) 2025-02-16 16:50:59 +00:00