Fix distributed autograd initialization. (#29069)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29069
Distributed autograd was initialized after RPC and this would cause a
race in some scenarios where one node might have initialized distributed
autograd, calls backward() but other nodes have not initialized distributed
autograd yet.
Moving this before `_init_rpc` fixes the problem since `_init_rpc` implicitly
has a sync between processes via the store.
ghstack-source-id: 93535922
Test Plan: waitforbuildbot
Differential Revision: D18280875
fbshipit-source-id: 739a1c22dec21df859738d074e6e497fa43257fd