[fx][1/2] add PassManager and refactor AFG/AGM (#74972)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74972
This diff
* adds PassManager and supporting logic
Test Plan:
CI and
```
buck test //caffe2/torch/fx/passes:test_pass_manager
```
```
Building: finished in 3.1 sec (100%) 124/124 jobs, 30/124 updated
Total time: 3.7 sec
More details at https://www.internalfb.com/intern/buck/build/4f947267-671c-48bc-ad07-190e5a731d2d
BUILD SUCCEEDED
Tpx test run coordinator for Facebook. See https://fburl.com/tpx for details.
Running with tpx session id: 1423fed7-4674-44ce-9b84-c634f28a0406
Trace available for this run at /tmp/tpx-20220309-144735.217835-1423fed7-4674-44ce-9b84-c634f28a0406/trace.log
RemoteExecution session id: reSessionID-1423fed7-4674-44ce-9b84-c634f28a0406-tpx
Started reporting to test run: https://www.internalfb.com/intern/testinfra/testrun/6473924544097816
✓ ListingSuccess: caffe2/torch/fx/passes:test_pass_manager : 3 tests discovered (0.639)
✓ Pass: caffe2/torch/fx/passes:test_pass_manager - test_these_before_those_pass_constraint (caffe2.torch.fx.passes.tests.test_pass_manager.TestPassManager) (0.335)
✓ Pass: caffe2/torch/fx/passes:test_pass_manager - test_this_before_that_pass_constraint (caffe2.torch.fx.passes.tests.test_pass_manager.TestPassManager) (0.336)
✓ Pass: caffe2/torch/fx/passes:test_pass_manager - test_pass_manager_builder (caffe2.torch.fx.passes.tests.test_pass_manager.TestPassManager) (0.344)
Summary
Pass: 3
ListingSuccess: 1
If you need help understanding your runs, please follow the wiki: https://fburl.com/posting_in_tpx_users
Finished test run: https://www.internalfb.com/intern/testinfra/testrun/6473924544097816
```
Reviewed By: yuhc, wushirong
Differential Revision: D31484770
fbshipit-source-id: 7a8cde4c23727ff612bf7bf0d7b7db5d0c47b1a9
(cherry picked from commit c281c288fe870624574d34cfc93d732d4607f7d0)