-
Notifications
You must be signed in to change notification settings - Fork 630
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
Refactoring in Pipeline, old Executor + name lookup improvement in old OpGraph. #5495
Conversation
Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
CI MESSAGE: [15531112]: BUILD STARTED |
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
CI MESSAGE: [15531112]: BUILD FAILED |
@@ -113,7 +114,7 @@ TensorNode& OpGraph::PlaceNewTensor() { | |||
} | |||
|
|||
|
|||
void OpGraph::AddOp(const OpSpec &spec, const std::string &op_name) { | |||
OpNode &OpGraph::AddOp(const OpSpec &spec, const std::string &op_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.
This is necessary in a follow-up PR.
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
CI MESSAGE: [15531540]: BUILD STARTED |
for (auto &node : op_nodes_) { | ||
if (node.instance_name == name) { | ||
return node; | ||
} | ||
} | ||
DALI_FAIL("Operator node with name " + name + " not found."); | ||
DALI_FAIL(make_string("Operator node with name ", name, " not found.")); |
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.
For very dubious reasons, C++ doesn't define operator+
for string_view
.
@@ -467,8 +469,9 @@ class DLL_PUBLIC OpGraph { | |||
*/ | |||
void RemoveOpNode(OpNodeId id); | |||
|
|||
std::map<std::string, TensorNodeId> tensor_name_to_id_; | |||
std::map<std::string, TensorNodeId, std::less<>> tensor_name_to_id_; |
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.
Passing std::less<>
allows use of any comparable key for find
and operator[]
- in this case, a string_view
.
See example - look for "transparent comparison".
template <typename WorkspacePolicy, typename QueuePolicy> | ||
void PipelinedExecutorImpl<WorkspacePolicy, QueuePolicy>::Build(OpGraph *graph, | ||
vector<string> output_names) { | ||
Executor<WorkspacePolicy, QueuePolicy>::Build(graph, output_names); | ||
} |
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.
Useless override removed.
@@ -571,8 +571,6 @@ void Pipeline::Build(std::vector<PipelineOutputDesc> output_descs) { | |||
} | |||
} | |||
|
|||
graph_.InstantiateOperators(); |
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.
That's the 1st thing that Executor::Build does.
CI MESSAGE: [15531540]: BUILD PASSED |
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
CI MESSAGE: [15556390]: BUILD STARTED |
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
CI MESSAGE: [15559469]: BUILD STARTED |
CI MESSAGE: [15559469]: BUILD PASSED |
Category:
Refactoring (Redesign of existing code that doesn't affect functionality)
Description:
This PR does some API adjustments that will work better with the new graph.
There are some name lookup improvements in (old) OpGraph and Pipeline and there's a transition to querying by string_view as opposed to
const string &
- should work better with new OpGraph and, as a bonus, avoid creating temporary strings in C API.Additional information:
Affected modules and functionalities:
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: DALI-3974