mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
# 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 |
||
|---|---|---|
| .. | ||
| impl | ||
| test | ||
| CMakeLists.txt | ||
| XPUCachingAllocator.cpp | ||
| XPUCachingAllocator.h | ||
| XPUDeviceProp.h | ||
| XPUException.h | ||
| XPUFunctions.cpp | ||
| XPUFunctions.h | ||
| XPUMacros.h | ||
| XPUStream.cpp | ||
| XPUStream.h | ||