Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass ownership of Module to HostManager #2572

Merged
merged 1 commit into from Apr 2, 2019

Conversation

jackm321
Copy link
Contributor

Description:
Make it so that HostManager and runtime owns the Module. HostManager will take ownership of Module in addNetwork and keeps the PlaceHolders around internally.

Testing:
ninja check
Run resnet-runtime example

Documentation:
comments
Fixes #2567

DAG dag;
// list of placeholders owned by the NetworkData.
PlaceholderList placeholders;

Copy link
Contributor

Choose a reason for hiding this comment

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

So why constants won't be needed in this struct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gcatron
Copy link
Contributor

gcatron commented Mar 22, 2019

Why do we need to keep the placeholders and module around after loading the network? It seems storing the placeholders is partially duplicating what the runtimeBundle does.

@jackm321
Copy link
Contributor Author

Module is not kept around it gets thrown out at the end of addNetwork() but the Placeholders were owned by the Module so those need to get kept or else they'll be freed with the Module as well. Where does RuntimeBundle keep Placeholders?

@jackm321
Copy link
Contributor Author

Oh I see it allocates symbols out of them. How would that actually work when the Context that's created for each run is created by code that only has original placeholders from compile time?

@jackm321
Copy link
Contributor Author

Discussed this offline with @gcatron, we will keep the Placeholders around during runtime for now as keys into the RuntimeBundle's allocations for the placeholders. In the longer term though, we should switch to replacing placeholders with just their names throughout the runtime since there's no reason to actually keep the placeholders around from compilation other than as a unique identifier.

}

modules_.push_back(std::move(module));
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to store the module here? If so when do we free it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes good catch, we shouldn't need this now.

@stale
Copy link

stale bot commented Mar 30, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

Copy link
Contributor

@gcatron gcatron left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks for tackling this!

@jackm321 jackm321 merged commit 46bd1bc into pytorch:master Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants