-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Optimize cinn_cache_key by replace GraphToProgram to Dot string #37317
Conversation
Thanks for your contribution! |
… optimize_cache_key
std::string CinnCacheKey::HashGraph(const ir::Graph& graph) { | ||
// using Dot to unqiue graph | ||
inference::analysis::Dot dot; | ||
std::unordered_map<const ir::Node*, std::string> node2dot; |
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.
Just a question, can we reuse id of ir::Node
instead of creating your own id?
In that case we can save the std::unordered_map
data structure and corresponding insert/find operations
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.
node.h
states that DO NOT USE node id. To be discussed in the future.
@@ -39,13 +44,42 @@ CinnCacheKey::CinnCacheKey(const ir::Graph& graph, | |||
this->SetKey(graph, input_shapes, arch_str); | |||
} | |||
|
|||
std::string CinnCacheKey::HashGraph(const ir::Graph& graph) { |
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.
Hash usually return hash type. Can we call it GraphHashString
or GraphHashStr
?
Or you just return hash type at line 73 while let caller of this function make it to string.
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.
Done.Changed to return size_t
.
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
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 for op benchmark ci
PR types
Performance optimization
PR changes
Others
Describe
优化
cinn_cache_key
的生成方式,通过替换非常耗时的GraphToProgram
为简约的Dot
字符串