fix-process-group-counter (#46563)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/46561
A minimal fix to issue https://github.com/pytorch/pytorch/issues/46561. Increment the global variable `_group_count` at the same time as the others so the global state remains consistent in case of a failure.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/46563
Reviewed By: zou3519
Differential Revision: D24422354
Pulled By: mrshenli
fbshipit-source-id: 32493cc2001d21ad366c396d16c303936959434e