[resubmit] Move profiler to a dispatch wrapper (#36766)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36766
Original commit changeset: dcb41d243369
ghstack-source-id: 102614215
Test Plan: waitforsadcastle
Differential Revision: D21076029
fbshipit-source-id: c2461c57cfd364bd23ff99bc2cb5572d22e23391