Skip to content

Move function deletion from the stack to the heap.#11611

Closed
resistor wants to merge 1 commit intopytorch:masterfrom
resistor:deleter
Closed

Move function deletion from the stack to the heap.#11611
resistor wants to merge 1 commit intopytorch:masterfrom
resistor:deleter

Conversation

@resistor
Copy link
Contributor

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.

@resistor
Copy link
Contributor Author

Will rebase past the revert once it makes it to GitHub

@resistor
Copy link
Contributor Author

Will do perf measurement soon

@resistor resistor force-pushed the deleter branch 2 times, most recently from 050b8ec to 44ba7b9 Compare September 13, 2018 00:12
@resistor
Copy link
Contributor Author

Rebased.

@resistor
Copy link
Contributor Author

@pytorchbot retest this please

@resistor resistor force-pushed the deleter branch 2 times, most recently from 03b2fe0 to eb854cb Compare September 13, 2018 05:10
@resistor
Copy link
Contributor Author

New performance results:

MASTER:
Time to build graph (s):
0.001078948974609375
Time to free graph (s):
0.00015817642211914064

Time to build graph (s):
0.0010588359832763672
Time to free graph (s):
0.00015884828567504884

WITH PR:
Time to build graph (s):
0.0009531970024108887
Time to free graph (s):
0.0001594715118408203

Time to build graph (s):
0.0009731245040893555
Time to free graph (s):
0.00015877246856689454

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@apaszke
Copy link
Contributor

apaszke commented Sep 13, 2018

@resistor is it the small benchmark or the big benchmark?

@resistor
Copy link
Contributor Author

resistor commented Sep 13, 2018 via email

@ezyang
Copy link
Contributor

ezyang commented Sep 14, 2018

@pytorchbot retest this please

@resistor
Copy link
Contributor Author

@pytorchbot retest this please

@resistor
Copy link
Contributor Author

@apaszke Ready for another pass when you have a chance.

@ezyang
Copy link
Contributor

ezyang commented Sep 18, 2018

has spurious submodule change again

@resistor
Copy link
Contributor Author

has spurious submodule change again

Fixed now.

Copy link
Contributor

@apaszke apaszke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This comment was marked as off-topic.

This comment was marked as off-topic.

@resistor
Copy link
Contributor Author

@apaszke I meant to do that (check use_count == 1).

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@resistor
Copy link
Contributor Author

@apaszke @goldsborough OK to land?

Copy link
Contributor

@goldsborough goldsborough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resistor is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@resistor Does this mean any function with a use_count > 1 is ignored?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants