Disable profiling when `getGraphExecutorOptimize` is unset (#46479)
Summary:
`getGraphExecutorOptimize` mandates we don't do any optimizations beyond what's required to run graphs. In this scenario, we don't want to do any profiling as profiling information will not be used.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/46479
Reviewed By: ZolotukhinM
Differential Revision: D24368292
Pulled By: Krovatkin
fbshipit-source-id: a2c7618d459efca9cb0700c4d64d829b352792a8