Context.h 673 B

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