-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Improve logging of the matching process #28587
base: master
Are you sure you want to change the base?
Improve logging of the matching process #28587
Conversation
/// \param str String to split | ||
/// \param delimiter Delimiter to use for splitting | ||
/// \return Returns an unordered set of split strings | ||
std::unordered_set<std::string> split_by_delimiter(std::string str, char delimiter); |
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.
Could you look at ov::util::join and do opposite to return vector of strings which are split using delimiter?
Can be this function be in same place as join
?
std::string level_str; | ||
}; | ||
|
||
OPENVINO_API std::string node_version_type_str(const std::shared_ptr<ov::Node>& node); |
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.
OPENVINO_API std::string node_version_type_str(const std::shared_ptr<ov::Node>& node); | |
OPENVINO_API std::string node_version_type_str(const ov::Node& node); |
why pass shared pointer not just node do need do something with ownership in this function?
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.
Agreed, fixed
src/common/transformations/include/transformations/utils/gen_pattern.hpp
Show resolved
Hide resolved
src/core/src/log_util.cpp
Outdated
for (const auto& arg : node->input_values()) { | ||
if (verbose) | ||
stream << sep << arg; | ||
else | ||
stream << sep << arg.get_node_shared_ptr()->get_type_name(); | ||
sep = ", "; | ||
} |
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 (const auto& arg : node->input_values()) { | |
if (verbose) | |
stream << sep << arg; | |
else | |
stream << sep << arg.get_node_shared_ptr()->get_type_name(); | |
sep = ", "; | |
} | |
if (verbose){ | |
verbose_loop() | |
} else{ | |
not_werbose_loop() | |
} |
looks like util:join here
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.
Moved arguments printing to a designated function.
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 looks like not.
suggestion
if (const auto& args = node->input_values(); verbose){
stream << ov::util::join(args, ", ");
} else {
//custom join
for (const auto& arg : args){
...
}
}
_VERBOSE_LOG(level, "X OP type mismatch: ", m_signature, " vs ", graph_value); | ||
OPENVINO_LOG_GENPATTERN2(matcher, pattern_value, graph_value); |
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 topic for future improvements, maybe is possible to merge these two log macros into one?
namespace ov { | ||
namespace util { |
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.
namespace ov { | |
namespace util { | |
namespace ov::util { |
Detail
#include "openvino/core/core_visibility.hpp" | ||
#include "openvino/core/node.hpp" | ||
|
||
#ifdef ENABLE_OPENVINO_DEBUG |
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.
Move it above includes to not add code if file is will be empty.
namespace ov { | ||
namespace util { |
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.
namespace ov { | |
namespace util { | |
namespace ov::util { |
@@ -51,3 +52,53 @@ TEST(UtilsTests, filter_lines_by_prefix) { | |||
res = filter_lines_by_prefix(lines, "ab"); | |||
ASSERT_EQ(res, ""); | |||
} | |||
|
|||
TEST(UtilsTests, split_by_delimiter) { | |||
const auto line = "EliminateSplitConcat,MarkDequantization,StatefulSDPAFusion"; |
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.
Add test string "name,name,name"
Will it return three entries?
/// \param str String to split | ||
/// \param delimiter Delimiter to use for splitting | ||
/// \return Returns an unordered set of split strings | ||
std::unordered_set<std::string> split_by_delimiter(const std::string& str, char delimiter); |
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.
Move it to "common_util.hpp"
std::unordered_set<std::string> split_by_delimiter(const std::string& str, char delimiter); | |
std::vector<std::string> split(const std::string& str, const std::string& delimiter = ","); |
Return value can remove some split strings, it can be always created from vector.
And use string delimiter as it can provide more complex option for split the text
src/core/src/log_util.cpp
Outdated
for (const auto& arg : node->input_values()) { | ||
if (verbose) | ||
stream << sep << arg; | ||
else | ||
stream << sep << arg.get_node_shared_ptr()->get_type_name(); | ||
sep = ", "; | ||
} |
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 looks like not.
suggestion
if (const auto& args = node->input_values(); verbose){
stream << ov::util::join(args, ", ");
} else {
//custom join
for (const auto& arg : args){
...
}
}
stream << sep << arg; | ||
else | ||
stream << sep << arg.get_node_shared_ptr()->get_type_name(); | ||
sep = ", "; |
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.
Why it has to be set every iteration, check ov::util::join how separator is added.
Co-authored-by: Pawel Raasz <[email protected]>
we decided to merge this PR and address the remaining comments within CVS-162907 ticket. |
Improve logging of the matching process to make more human-friendly
Logging before:

Several examples of the improved logging:
Signed-off-by: Andrii Staikov [email protected]
Ticket: