Move function deletion from the stack to the heap.#11611
Move function deletion from the stack to the heap.#11611resistor wants to merge 1 commit intopytorch:masterfrom
Conversation
|
Will rebase past the revert once it makes it to GitHub |
|
Will do perf measurement soon |
050b8ec to
44ba7b9
Compare
|
Rebased. |
|
@pytorchbot retest this please |
03b2fe0 to
eb854cb
Compare
|
New performance results:
|
torch/csrc/autograd/function.cpp
Outdated
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.
|
@resistor is it the small benchmark or the big benchmark? |
|
@pytorchbot retest this please |
|
@pytorchbot retest this please |
|
@apaszke Ready for another pass when you have a chance. |
|
has spurious submodule change again |
Fixed now. |
apaszke
left a comment
There was a problem hiding this comment.
I'm not sure why gatherFunctions looks like that. I thought of pushing the use_count check to still happen before we push anything onto the function stack.
torch/csrc/autograd/function.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/autograd/function.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@apaszke I meant to do that (check use_count == 1). |
torch/csrc/autograd/function.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/autograd/function.cpp
Outdated
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.
torch/csrc/autograd/function.cpp
Outdated
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.
torch/csrc/autograd/function.cpp
Outdated
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 @goldsborough OK to land? |
facebook-github-bot
left a comment
There was a problem hiding this comment.
resistor is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
There was a problem hiding this comment.
resistor has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This eliminates the need for any heuristics regarding stack size limits. This is a re-do pytorch#11534 with a fix to properly handle cases where multiple edges exist between a pair of functions.
facebook-github-bot
left a comment
There was a problem hiding this comment.
resistor has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
| func->release_variables(); | ||
|
|
||
| for (auto& edge : func->next_edges()) { | ||
| if (edge.function.use_count() == 1) { |
There was a problem hiding this comment.
@resistor Does this mean any function with a use_count > 1 is ignored?

This eliminates the need for any heuristics regarding stack size limits.
This is a re-do #11534 with a fix to properly handle cases where
multiple edges exist between a pair of functions.