mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Adds
- `torch::stable::accelerator::DeviceGuard`: `std::unique_ptr` to `DeviceGuardOpauqe` mostly copied from the below (but made generic)
50eac811a6/torch/csrc/inductor/aoti_runtime/utils_cuda.h (L30-L46)
- constructor `DeviceGuard(DeviceIndex)` (**this matches aoti but defers from the actual c10 DeviceGuard constructor that takes in device**)
- `set_index(DeviceIndex)`
- `torch::stable::accelerator::Stream`: `std::shared_ptr` to `StreamOpaque`
- constructor `Stream(StreamHandle stream)` (similar to torch::stable::Tensor)
- `id() -> StreamId`
- `getCurrentStream(DeviceIndex device_index) -> stable::accelerator::Stream`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159679
Approved by: https://github.com/guangyey, https://github.com/janeyx99