1#pragma once
2
3#include <c10/macros/Export.h>
4
5namespace c10 {
6struct TensorImpl;
7}
8
9namespace at {
10class TensorBase;
11
12// MemOverlap: Whether or not there is memory overlap
13//
14// No: Absolutely no memory overlap
15// Yes: Absolutely yes memory overlap
16// TooHard: There might be memory overlap, but it was too expensive to compute.
17//
18// NB: Please update the python test for these if you renumber them.
19enum class MemOverlap { No, Yes, TooHard };
20
21enum class MemOverlapStatus { Full, Partial, No, TooHard };
22
23TORCH_API MemOverlap has_internal_overlap(const TensorBase& t);
24TORCH_API MemOverlap has_internal_overlap(c10::TensorImpl* t);
25
26TORCH_API void assert_no_internal_overlap(const TensorBase& t);
27TORCH_API void assert_no_internal_overlap(c10::TensorImpl* t);
28
29TORCH_API MemOverlapStatus
30get_overlap_status(const TensorBase& a, const TensorBase& b);
31TORCH_API MemOverlapStatus
32get_overlap_status(c10::TensorImpl* a, c10::TensorImpl* b);
33
34TORCH_API void assert_no_partial_overlap(
35 const TensorBase& a,
36 const TensorBase& b);
37void assert_no_partial_overlap(c10::TensorImpl* a, c10::TensorImpl* b);
38
39TORCH_API void assert_no_overlap(const TensorBase& a, const TensorBase& b);
40TORCH_API void assert_no_overlap(c10::TensorImpl* a, c10::TensorImpl* b);
41
42} // namespace at
43