Skip to content

Commit

Permalink
Add aten::record_stream (#1047)
Browse files Browse the repository at this point in the history
- [x] record_stream
  • Loading branch information
Kanya-Mo authored Nov 6, 2024
1 parent fda86cf commit 597d8e4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/ATen/native/xpu/sycl/RecordStream.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#define TORCH_ASSERT_ONLY_METHOD_OPERATORS
#include <ATen/core/Tensor.h>
#include <c10/xpu/XPUCachingAllocator.h>

#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/NativeFunctions.h>
#else
#include <ATen/ops/record_stream_native.h>
#endif

namespace at::native {
void record_stream_xpu(Tensor& self, c10::Stream stream) {
struct c10::StreamData3 data = stream.pack3();
c10::xpu::XPUCachingAllocator::recordStream(self.storage().data_ptr(), at::xpu::XPUStream::unpack3(data.stream_id, data.device_index, data.device_type));
}
} // namespace at::native
5 changes: 5 additions & 0 deletions yaml/native/native_functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7164,6 +7164,11 @@
- func: index_copy.dimname(Tensor self, Dimname dim, Tensor index, Tensor source) -> Tensor
variants: function, method

- func: record_stream(Tensor(a!) self, Stream s) -> ()
variants: method
dispatch:
XPU: record_stream_xpu

- func: i0(Tensor self) -> Tensor
structured_delegate: i0.out
variants: function, method
Expand Down

0 comments on commit 597d8e4

Please sign in to comment.