Back out Dispatcher change that makes Messenger Desktop crash on M1 devices (#77414)

Summary:
This change causes Messenger Dekstop to crash on M1 devices when the user enables background during the call. The change apparently causes the compiler to emit AVX instructions that are not supported by Rosetta.

This is a surgical backout that only backs out the changes in C++ side,
and not Python bindings which I believe are not shipped with Workplace Chat.

Test Plan:
Run the application and make sure that it doesn't crash when the background is enabled
https://pxl.cl/23VSH

Reviewed By: ezyang

Differential Revision: D36358832

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77414
Approved by: https://github.com/bigfootjon
This commit is contained in:
Anjali Chourdia 2022-05-13 17:33:53 +00:00 committed by PyTorch MergeBot
parent 2fc1725938
commit 2c1de3aa47
3 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@ namespace torch {
namespace { namespace {
// TODO: Consider representing debug info as a struct instead so you // TODO: Consider representing debug info as a struct instead so you
// don't have to allocate strings all the time // don't have to allocate strings all the time
std::string debugString(const std::string& file, uint32_t line) { std::string debugString(const char* file, uint32_t line) {
#ifdef STRIP_ERROR_MESSAGES #ifdef STRIP_ERROR_MESSAGES
return std::string(); return std::string();
#else #else
@ -15,7 +15,7 @@ namespace {
#endif #endif
} }
std::string debugString(std::string debug, const std::string& file, uint32_t line) { std::string debugString(std::string debug, const char* file, uint32_t line) {
#ifdef STRIP_ERROR_MESSAGES #ifdef STRIP_ERROR_MESSAGES
return std::string(); return std::string();
#else #else

View File

@ -166,7 +166,7 @@ void initDispatchBindings(PyObject* module) {
parseKind(kind), parseKind(kind),
std::move(name), std::move(name),
std::string(dispatch) == "" ? c10::nullopt : c10::make_optional(c10::parseDispatchKey(dispatch)), std::string(dispatch) == "" ? c10::nullopt : c10::make_optional(c10::parseDispatchKey(dispatch)),
file, "<unknown>", // temporary workaround
linenum); linenum);
END_HANDLE_TH_ERRORS_PYBIND END_HANDLE_TH_ERRORS_PYBIND
}, "", py::arg("kind"), py::arg("name"), py::arg("dispatch"), py::arg("file")="/dev/null", py::arg("linenum")=0) }, "", py::arg("kind"), py::arg("name"), py::arg("dispatch"), py::arg("file")="/dev/null", py::arg("linenum")=0)

View File

@ -557,7 +557,7 @@ class TORCH_API Library final {
Library& operator=(const Library&) = delete; Library& operator=(const Library&) = delete;
Library(Library&&) = default; Library(Library&&) = default;
Library& operator=(Library&&) = default; Library& operator=(Library&&) = default;
// TODO: add gen_python_error boolean flag
// Some notes about the API design here. We had the following constraints: // Some notes about the API design here. We had the following constraints:
// //
// - We need to support multiple "types" of arguments for schema and // - We need to support multiple "types" of arguments for schema and
@ -802,7 +802,7 @@ class TORCH_API Library final {
Kind kind_; Kind kind_;
c10::optional<std::string> ns_; c10::optional<std::string> ns_;
c10::optional<c10::DispatchKey> dispatch_key_; c10::optional<c10::DispatchKey> dispatch_key_;
std::string file_; const char* file_;
uint32_t line_; uint32_t line_;
std::vector<c10::RegistrationHandleRAII> registrars_; std::vector<c10::RegistrationHandleRAII> registrars_;