-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[MXNET-703] Minor refactor of TensorRT code #13311
[MXNET-703] Minor refactor of TensorRT code #13311
Conversation
3162e57
to
b422b7d
Compare
@mxnet-label-bot add [pr-awaiting-review] |
@larroy @lebeg @marcoabreu for review |
@@ -434,7 +435,7 @@ Executor *TrtGraphExecutor::TensorRTBind(nnvm::Symbol symbol, | |||
std::unordered_map<std::string, NDArray> *shared_buffer, | |||
Executor *shared_exec) { | |||
auto exec = new exec::TrtGraphExecutor(); | |||
exec->Init(symbol, default_ctx, group2ctx, | |||
exec->Init(std::move(symbol), default_ctx, group2ctx, |
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.
Is Init accepting an rvalue reference?
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.
It's a good question I wanted to dive into a little. My understanding is that the Init function can bind its variable to either an lvalue or an rvalue when passing by value. You don't have to create an overload or anything to determine which one it expects. Here's an example:
https://gist.github.com/KellenSunderland/d431119580a116410c672b9535d85170
Which is using code borrowed from:
https://www.chromium.org/rvalue-references?tmpl=%2Fsystem%2Fapp%2Ftemplates%2Fprint%2F&showPrintDialog=1
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.
Well the question if the move is doing anything, because I don't know if there's an Init signature accepting an rvalue reference to a symbol, that was the original question.
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.
Yeah I was also curious about this. The example shows a similar pattern and it does save a copy.
@KellenSunderland thanks for your contribution, ping for update and fix CI failure. |
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, just had a minor comment about rvalue reference.
@KellenSunderland - Can you please rebase? |
@KellenSunderland can you please rebase and resolve the merge conflicts? |
32dd73f
to
46f5193
Compare
I've rebased and I believe most comments are closed out. Could you have a quick look and see if anything else is needed @anirudh2290 or @sandeep-krishnamurthy. |
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
46f5193
to
8d2d15d
Compare
Rebased and fixed the last nit about static_cast. I believe this can be merged if a committer could do a quick review. |
8d2d15d
to
247c322
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.
Thanks looks good to me.
Description
[MXNET-703] Minor refactor of TensorRT code
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.