Add locks to fallback register/deregister. (#36628)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36628
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Differential Revision: D21029702
Pulled By: ezyang
fbshipit-source-id: 2322094338ad896653b2db43ff74a8ab1593b3e1