Add a Constant Propagation Pass to the JIT#8808
Add a Constant Propagation Pass to the JIT#8808eellison wants to merge 2 commits intopytorch:masterfrom
Conversation
|
There are probably files that we don't want to put in the PR. Can we rebase onto master, run |
apaszke
left a comment
There was a problem hiding this comment.
Mostly LGTM, but has some accidental checkins that will need to be removed
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@apaszke Thanks for your comments! I will resubmit with the changes requested |
|
@apaszke all the requested changes have been made. @jamesr66a I ran git submodule init & force pushed, but it looks like third_party/onnx is still in the pull request. ps: sorry about the commit clutter 😬 First time using git in a while, next pull request will be cleaner. |
|
This looks good, but we need to remove the changes to thirdy_party/onnx in the diff. |
|
in Convnet models, it's common for the final layer to have a This shows up in the trace like this: Since traces are already specialized on sizes (i.e. we know the size of %1871), it'll be good to fold these instructions in the Constant Folding pass. There's a "just enough done" pass on doing this by @asuhan at https://github.com/asuhan/pytorch/blob/master/torch/csrc/jit/passes/constant_folding.cpp |
|
@eellison Could you rebase this onto current master? It should fix the |
|
@eellison can we get this merged? It is going to start blocking other PR very soon. |
683c3fd to
20b30ff
Compare
|
@pytorchbot retest this please |
1 similar comment
|
@pytorchbot retest this please |
64fd978 to
9e5fc58
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
@eellison has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@pytorchbot retest this please |
6 similar comments
|
@pytorchbot retest this please |
|
@pytorchbot retest this please |
|
@pytorchbot retest this please |
|
@pytorchbot retest this please |
|
@pytorchbot retest this please |
|
@pytorchbot retest this please |
|
this error looks real: |
583b149 to
f2dbfd5
Compare
|
@pytorchbot retest this please |
|
@pytorchbot retest this please |
|
@pytorchbot retest this please |
|
This is failing because it needs to be rebased and its expect tests need to be |
facebook-github-bot
left a comment
There was a problem hiding this comment.
eellison has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: Adding a constant propagation pass to the JIT. I have added examples to the expect files. There are a couple of special cases which have not been implemented here. IF nodes with constant conditions can be inlined with the correct block. WHILE nodes can be removed if the condition is false. I have added a test for each case in test_jit.py file as expected failures. To be consistent with DCE, python ops & CPP ops are treated as not having side-effects. Pull Request resolved: pytorch#8808 Reviewed By: wanchaol Differential Revision: D8906770 Pulled By: eellison fbshipit-source-id: 10ad796d89f80b843566c9ddad6a0abd1f3dc74c
Summary: Adding a constant propagation pass to the JIT. I have added examples to the expect files. There are a couple of special cases which have not been implemented here. IF nodes with constant conditions can be inlined with the correct block. WHILE nodes can be removed if the condition is false. I have added a test for each case in test_jit.py file as expected failures. To be consistent with DCE, python ops & CPP ops are treated as not having side-effects. Pull Request resolved: pytorch#8808 Reviewed By: wanchaol Differential Revision: D8906770 Pulled By: eellison fbshipit-source-id: 10ad796d89f80b843566c9ddad6a0abd1f3dc74c
Adding a constant propagation pass to the JIT. I have added examples to the expect files.
There are a couple of special cases which have not been implemented here. IF nodes with constant conditions can be inlined with the correct block. WHILE nodes can be removed if the condition is false. I have added a test for each case in test_jit.py file as expected failures.
To be consistent with DCE, python ops & CPP ops are treated as not having side-effects.