1#ifndef MetalContext_h
2#define MetalContext_h
3
4#include <atomic>
5
6#include <ATen/Tensor.h>
7
8namespace at {
9namespace metal {
10
11struct MetalInterface {
12 virtual ~MetalInterface() = default;
13 virtual bool is_metal_available() const = 0;
14 virtual at::Tensor& metal_copy_(at::Tensor& self, const at::Tensor& src)
15 const = 0;
16};
17
18extern std::atomic<const MetalInterface*> g_metal_impl_registry;
19
20class MetalImplRegistrar {
21 public:
22 explicit MetalImplRegistrar(MetalInterface*);
23};
24
25at::Tensor& metal_copy_(at::Tensor& self, const at::Tensor& src);
26
27} // namespace metal
28
29namespace native {
30bool is_metal_available();
31} // namespace native
32
33} // namespace at
34
35#endif /* MetalContext_h */
36