Add support for the ONNX Runtime Eager Mode backend (#58248)
authorAaron Bockover <abock@microsoft.com>
Fri, 20 Aug 2021 18:11:47 +0000 (11:11 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 20 Aug 2021 18:17:13 +0000 (11:17 -0700)
commitc78ab28441f5616899d363d57317f4de29147e5c
tree591efb2debdf036a220942a8aca1ea108651bac5
parentb95ce1591d56d545391ad5651f17ceb3b398a666
Add support for the ONNX Runtime Eager Mode backend (#58248)

Summary:
This PR implements the necessary hooks/stubs/enums/etc for complete ONNX Runtime (ORT) Eager Mode integration. The actual extension will live out of tree at https://github.com/pytorch/ort.

We have been [working on this at Microsoft](https://github.com/microsoft/onnxruntime-pytorch/tree/eager-ort/torch_onnxruntime) for the last few months, and are finally ready to contribute the PyTorch core changes upstream (nothing major or exciting, just the usual boilerplate for adding new backends).

The ORT backend will allow us to ferry [almost] all torch ops into granular ONNX kernels that ORT will eagerly execute against any devices it supports (therefore, we only need a single ORT backend from a PyTorch perspective).

Pull Request resolved: https://github.com/pytorch/pytorch/pull/58248

Reviewed By: astaff

Differential Revision: D30344992

Pulled By: albanD

fbshipit-source-id: 69082b32121246340d686e16653626114b7714b2
38 files changed:
aten/src/ATen/Context.h
aten/src/ATen/Version.cpp
aten/src/ATen/core/aten_interned_strings.h
aten/src/ATen/core/op_registration/README.md
aten/src/ATen/detail/ORTHooksInterface.cpp [new file with mode: 0644]
aten/src/ATen/detail/ORTHooksInterface.h [new file with mode: 0644]
aten/src/ATen/templates/TensorBody.h
aten/src/ATen/test/extension_backend_test.cpp
c10/core/Backend.h
c10/core/Device.cpp
c10/core/DeviceType.cpp
c10/core/DeviceType.h
c10/core/DispatchKey.cpp
c10/core/DispatchKey.h
c10/core/DispatchKeySet.cpp
c10/core/DispatchKeySet.h
c10/core/TensorImpl.h
c10/core/TensorOptions.h
caffe2/proto/caffe2.proto
caffe2/proto/caffe2_pb2.pyi
test/cpp_extensions/ort_extension.cpp [moved from test/cpp_extensions/msnpu_extension.cpp with 78% similarity]
test/cpp_extensions/setup.py
test/test_cpp_extensions_aot.py
test/test_gen_backend_stubs.py
test/test_torch.py
tools/build_variables.bzl
tools/codegen/model.py
tools/pyi/gen_pyi.py
torch/_C/_autograd.pyi
torch/_tensor.py
torch/_utils.py
torch/csrc/Device.h
torch/csrc/autograd/init.cpp
torch/csrc/autograd/python_variable.cpp
torch/csrc/jit/frontend/sugared_value.cpp
torch/csrc/jit/runtime/register_prim_ops.cpp
torch/library.h
torch/overrides.py