value-based mark and sweep DCE (#14910)
authorMichael Suo <suo@fb.com>
Sat, 15 Dec 2018 09:14:45 +0000 (01:14 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 15 Dec 2018 09:16:44 +0000 (01:16 -0800)
commit2b57bd4107fc0b1f5e1fddca1e80d86e69aaabda
tree9f30244e335a46aca5f8083e25ce1628a5927783
parentdf614371c7e5cc6788863606841f2a97834aa616
value-based mark and sweep DCE (#14910)

Summary:
This makes DCE more granular by tracking live values/aliases through the graph (rather than just nodes). So we can be more aggressive in DCE around control flow blocks. For example, in:
```
%a0 = aten::foo()
%b = aten::foo()
%a2, %b2 = prim::If(%cond) {
  block0() {
    %a1 = aten::foo(%.0)
    %b1 = aten::foo(%b)
  } -> (%a1, %b1)
}
return (%a2)
```
we will now dce all the `%b` stuff.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14910

Differential Revision: D13476445

Pulled By: suo

fbshipit-source-id: 2bf5db19711c07dde946697a4f4b270bd8baf791
12 files changed:
test/cpp/jit/tests.h
test/expect/TestFuser.test_milstm_cuda-backward.expect
test/expect/TestFuser.test_milstm_cuda-forward.expect
test/expect/TestJit.test_cpp_cuda.expect
torch/csrc/jit/autodiff.cpp
torch/csrc/jit/ir.cpp
torch/csrc/jit/ir_views.h
torch/csrc/jit/passes/alias_analysis.cpp
torch/csrc/jit/passes/alias_analysis.h
torch/csrc/jit/passes/dead_code_elimination.cpp
torch/csrc/jit/passes/dead_code_elimination.h
torch/csrc/jit/passes/shape_analysis.cpp