mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
Revert "[MPS] Add Python Module Bindings for the MPS backend (#94417)"
This reverts commit beb4f5bf396ec2d53defa73c81aac48c38360544.
Reverted https://github.com/pytorch/pytorch/pull/94417 on behalf of https://github.com/huydhn due to Sorry for reverting your PR, but it seems to break MacOS test in trunk bae397ec63
This commit is contained in:
@ -60,7 +60,6 @@
|
||||
#include <torch/csrc/jit/serialization/pickler.h>
|
||||
#include <torch/csrc/lazy/python/init.h>
|
||||
#include <torch/csrc/monitor/python_init.h>
|
||||
#include <torch/csrc/mps/Module.h>
|
||||
#include <torch/csrc/multiprocessing/init.h>
|
||||
#include <torch/csrc/onnx/init.h>
|
||||
#include <torch/csrc/profiler/python/init.h>
|
||||
@ -88,6 +87,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_MPS)
|
||||
#include <ATen/mps/MPSDevice.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_VALGRIND)
|
||||
#include <callgrind.h>
|
||||
#endif
|
||||
@ -1268,7 +1271,6 @@ PyObject* initModule() {
|
||||
THPUtils_addPyMethodDefs(methods, DataLoaderMethods);
|
||||
THPUtils_addPyMethodDefs(methods, torch::autograd::python_functions());
|
||||
THPUtils_addPyMethodDefs(methods, torch::multiprocessing::python_functions());
|
||||
THPUtils_addPyMethodDefs(methods, torch::mps::python_functions());
|
||||
#ifdef USE_CUDA
|
||||
THPUtils_addPyMethodDefs(methods, THCPModule_methods());
|
||||
#endif
|
||||
@ -1591,6 +1593,15 @@ Call this whenever a new thread is created in order to propagate values from
|
||||
|
||||
ASSERT_TRUE(set_module_attr("has_cuda", has_cuda));
|
||||
ASSERT_TRUE(set_module_attr("has_mps", has_mps));
|
||||
py_module.def("_is_mps_available", []() { return at::hasMPS(); });
|
||||
py_module.def("_is_mps_on_macos_13_or_newer", []() {
|
||||
#ifdef USE_MPS
|
||||
return at::mps::is_macos_13_or_newer();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
});
|
||||
|
||||
ASSERT_TRUE(
|
||||
set_module_attr("has_mkldnn", at::hasMKLDNN() ? Py_True : Py_False));
|
||||
|
||||
|
Reference in New Issue
Block a user