pytorch/c10/xpu
Jiang, Zhiwei 9e106019f6 [XPU] Add an implict conversion from XPUStream to sycl::queue* (#148646)
# Motivation

Currently, in Pytorch XPU, `cudaStream_t` is mapped to `sycl::queue&`, so an implicit cast from `XPUStream` to `sycl::queue&` is provided just like `CUDAStream` has an implicit cast to `cudaStream_t`.

But on the SYCLomatic side, we migrate `cudaStream_t` to `sycl::queue*` but not `sycl::queue&` (One reason is that `cudaStream_t` is actually a pointer so users can do anything with that integer. Another reason is that the early `sycl::queue` was not impl-ed by a pointer, so copy by value is not desirable.)

Without this PR:
```
cudaStream_t a = getCurrentCUDAStream();
cudaStream_t b = getCurrentCUDAStream().stream();
```
need be migrated to:
```
queue_ptr a = &(sycl::queue&)getCurrentXPUStream();
queue_ptr b = &(getCurrentXPUStream().queue());
```
With this PR:
```
queue_ptr a = getCurrentXPUStream();
queue_ptr b = &(getCurrentXPUStream().queue());
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/148646
Approved by: https://github.com/guangyey, https://github.com/EikanWang
2025-04-03 08:12:38 +00:00
..
impl Improve error message for CUDAGuardImpl, MPSGuardImpl, XPUGuardImpl (#149838) 2025-03-25 07:29:53 +00:00
test [XPU] Add an implict conversion from XPUStream to sycl::queue* (#148646) 2025-04-03 08:12:38 +00:00
CMakeLists.txt Use torch_compile_options for c10 libraries (#147821) 2025-03-18 01:54:23 +00:00
XPUCachingAllocator.cpp Enable misc-use-internal-linkage check and apply fixes (#148948) 2025-03-12 14:22:56 +00:00
XPUCachingAllocator.h [Intel GPU] Add XPU memory-related APIs (#129919) 2024-09-07 11:15:17 +00:00
XPUDeviceProp.h Add architecture to XPU device property (#138186) 2024-11-13 03:35:13 +00:00
XPUException.h
XPUFunctions.cpp Filter out iGPU if dGPU is found on XPU (#144378) 2025-01-29 15:53:16 +00:00
XPUFunctions.h Fix torch.accelerator api abort when passing invaild device (#143550) 2024-12-23 03:44:22 +00:00
XPUMacros.h Build SYCL kernels for ATen XPU ops on Native Windows (take 2) (#127390) 2024-06-06 01:41:06 +00:00
XPUStream.cpp Add low priority XPU Stream (#141119) 2024-12-31 11:15:45 +00:00
XPUStream.h [XPU] Add an implict conversion from XPUStream to sycl::queue* (#148646) 2025-04-03 08:12:38 +00:00