-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[runtime] reduce set_input and set_input_zero_copy overhead #3805
Conversation
2567891
to
e335da7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -78,18 +79,21 @@ void GraphRuntime::Init(const std::string& graph_json, | |||
ctxs_ = ctxs; | |||
this->SetupStorage(); | |||
this->SetupOpExecs(); | |||
for (size_t i = 0; i < input_nodes_.size(); i++) { | |||
uint32_t nid = input_nodes_[i]; | |||
std::string& name = nodes_[nid].name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
or just inline this into next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
e335da7
to
43693b7
Compare
@ZihengJiang, could you also take a look please? |
Two optimizations:
std::unordered_map
to reduce lookup time, which could be significant where the number of inputs is largevector
to track the corresponding input arg dltensor* so we don't need to iterate through the inputs of all notes to look them up every single time. This is a followup to [Runtime] Enable set_input_zero_copy in GraphRuntime #3416@yinghai, @tqchen please review