[DDP] Log unused param names under DETAIL debug mode. (#62209)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/62209
When `TORCH_DISTRIBUTED_DEBUG=DETAIL` is set, log names and indices of unused parameters when searching for them.
Motivation is that we have seen a couple of issues occasionally when there are errors related to parameter possibly being marked as unused when it shouldn't, this can help narrow down the root cause by explicitly logging param names that are marked as unused.
ghstack-source-id: 134541461
Test Plan: CI
Reviewed By: mrshenli
Differential Revision: D29916085
fbshipit-source-id: d84cf637cbbd811521e6264ffd6c50ca8a79595b