Add fence. (#45148)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/45148
Test Plan: Imported from OSS
Reviewed By: IvanKobzarev
Differential Revision: D23906774
Pulled By: AshkanAliabadi
fbshipit-source-id: 93fe923bbd59d6e8bf3f13372217bd998856e8d7