pytorch
0b8931fe - [torch][JIT] Predicate uses of RPC APIs on `torch.distributed.rpc.is_available()` (#58887)

Commit
3 years ago
[torch][JIT] Predicate uses of RPC APIs on `torch.distributed.rpc.is_available()` (#58887) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/58887 There are some callsites of `torch.distributed.rpc.XXX` APIs that are compiled or not based on `USE_RPC`. However, `torch::deploy`, at least for now, is compiled with `USE_RPC=1`, but the `torch.distributed.rpc.XXX` APIs used by the aforementioned pieces of code are not available (i.e. `torch.distributed.rpc.is_available()` returns `False`). This can cause Torchscript compilation to fail, even if the code being compiled doesn't use RPC. This commit fixes this problem (at least temporarily) by predicating the use all thse `torch.distributed.rpc` APIs on the value of `torch.distributed.rpc.is_available()`. Test Plan: Ran packaged XLM-R model with C++ benchmark. Reviewed By: suo Differential Revision: D28660925 fbshipit-source-id: fbff7c7ef9596549105e79f702987a53b04ba6f9
Author
Meghan Lele
Parents
Loading