Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multipy/runtime: fix torch.jit.trace (#141)
Summary: This fixes torch.jit.trace when used from multiple different python intepreters. There's a global registration of a method to get the Python callstack. This adds a command that after loading `torch._C` it resets it to be a noop function otherwise you end up with cross interpreter Python calls which causes a segfault. This also copies over the lldb script to load the interpreter symbols. Pull Request resolved: #141 Test Plan: Enabled torchdynamo w/ ofi backend in test_compat.py ```shell (multipy3.8.6) tristanr@tristanr-arch2 ~/D/multipy (jittrace)> multipy/runtime/build/interactive_embedded_interpreter --pyscript multipy/runtime/test_compat.py Registering torch::deploy builtin library tensorrt (idx 0) with 0 builtin modules torch::deploy builtin tensorrt contains 0 modules Registering torch::deploy builtin library cpython_internal (idx 1) with 0 builtin modules torch::deploy builtin cpython_internal contains 6 modules Registering torch::deploy builtin library tensorrt (idx 0) with 0 builtin modules torch::deploy builtin tensorrt contains 0 modules Registering torch::deploy builtin library cpython_internal (idx 1) with 0 builtin modules torch::deploy builtin cpython_internal contains 6 modules [W OperatorEntry.cpp:133] Warning: Overriding a previously registered kernel for the same operator and the same dispatch key operator: aten::get_gradients(int context_id) -> Dict(Tensor, Tensor) registered at aten/src/ATen/RegisterSchema.cpp:6 dispatch key: (catch all) previous kernel: registered at ../torch/csrc/jit/runtime/register_distributed_ops.cpp:278 new kernel: registered at ../torch/csrc/jit/runtime/register_distributed_ops.cpp:278 (function registerKernel) ..s../home/tristanr/venvs/multipy3.8.6/lib/python3.8/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Pytho n extension: libtorch_python.so: cannot open shared object file: No such file or directory warn(f"Failed to load image Python extension: {e}") . ---------------------------------------------------------------------- Ran 6 tests in 0.663s OK (skipped=1) ``` Reviewed By: anirbanr-fb-r2p Differential Revision: D39005120 Pulled By: d4l3k fbshipit-source-id: f6b71f057cdef2fcd20e8f7f320e99edc65ce471
- Loading branch information