[JIT] Functional Graph Pass (#33020)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33020

This is a pass to create functional blocks. The other PRs in the stack help avoid some of the limitations that are are often found in graphs. It's possible that this would work well with a graph that is frozen. Follow up work items that will help this pass:

- We don't currently have any capacity in alias analysis to tell whether a Value that came from the wildcard set "re-escapes" back into the wildcard set.
- More comments on the semantics of the graph and correctness conditions
- We could consider using dynamic dag if the perf of this is a limitation.
- potential make Functional Graphs Functional Blocks instead, so that we do not repeatedly copy constants, also to make IR read easier.

Test Plan: Imported from OSS

Differential Revision: D20603188

Pulled By: eellison

fbshipit-source-id: 6822a6e65f4cc2676f8f6445fe8aa1cb858ebeeb
This commit is contained in:
Elias Ellison
2020-03-24 23:39:49 -07:00
committed by Facebook GitHub Bot
parent 01a7d6adcb
commit 5b2f8cef08
12 changed files with 362 additions and 5 deletions

View File

@ -399,6 +399,7 @@ if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
${TORCH_SRC_DIR}/csrc/jit/passes/constant_pooling.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/common_subexpression_elimination.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/create_autodiff_subgraphs.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/create_functional_graphs.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/inline_autodiff_subgraphs.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/insert_guards.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/inliner.cpp