Skip to content
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

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

CuriousPanCake
Copy link
Contributor

@CuriousPanCake CuriousPanCake commented Jan 21, 2025

Improve logging of the matching process to make more human-friendly

Logging before:
image

Several examples of the improved logging:

image

image

image

image

Signed-off-by: Andrii Staikov [email protected]

Ticket:

@github-actions github-actions bot added category: Core OpenVINO Core (aka ngraph) category: transformations OpenVINO Runtime library - Transformations category: CPP API OpenVINO CPP API bindings labels Jan 21, 2025
@CuriousPanCake CuriousPanCake marked this pull request as ready for review January 21, 2025 14:14
@CuriousPanCake CuriousPanCake requested review from a team as code owners January 21, 2025 14:14
@CuriousPanCake CuriousPanCake requested review from itikhono and removed request for a team January 21, 2025 14:14
@CuriousPanCake CuriousPanCake requested review from a team as code owners February 13, 2025 09:36
@CuriousPanCake CuriousPanCake removed the request for review from a team February 13, 2025 09:36
/// \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);
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed

Comment on lines 60 to 66
for (const auto& arg : node->input_values()) {
if (verbose)
stream << sep << arg;
else
stream << sep << arg.get_node_shared_ptr()->get_type_name();
sep = ", ";
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Contributor Author

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.

Copy link
Contributor

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){
 ...
 }
}

@CuriousPanCake CuriousPanCake requested review from a team as code owners February 20, 2025 15:08
@github-actions github-actions bot added the category: IE Tests OpenVINO Test: plugins and common label Feb 20, 2025
@CuriousPanCake CuriousPanCake requested review from itikhono and praasz and removed request for itikhono February 20, 2025 15:10
Comment on lines 822 to +823
_VERBOSE_LOG(level, "X OP type mismatch: ", m_signature, " vs ", graph_value);
OPENVINO_LOG_GENPATTERN2(matcher, pattern_value, graph_value);
Copy link
Contributor

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?

Comment on lines +11 to +12
namespace ov {
namespace util {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace ov {
namespace util {
namespace ov::util {

Detail

#include "openvino/core/core_visibility.hpp"
#include "openvino/core/node.hpp"

#ifdef ENABLE_OPENVINO_DEBUG
Copy link
Contributor

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.

Comment on lines +15 to +16
namespace ov {
namespace util {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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";
Copy link
Contributor

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);
Copy link
Contributor

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"

Suggested change
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

Comment on lines 60 to 66
for (const auto& arg : node->input_values()) {
if (verbose)
stream << sep << arg;
else
stream << sep << arg.get_node_shared_ptr()->get_type_name();
sep = ", ";
}
Copy link
Contributor

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 = ", ";
Copy link
Contributor

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.

@itikhono
Copy link
Contributor

itikhono commented Feb 21, 2025

we decided to merge this PR and address the remaining comments within CVS-162907 ticket.

@itikhono itikhono enabled auto-merge February 21, 2025 07:20
@itikhono itikhono added this pull request to the merge queue Feb 21, 2025
@p-durandin p-durandin removed this pull request from the merge queue due to a manual request Feb 21, 2025
@itikhono itikhono enabled auto-merge February 21, 2025 12:08
@itikhono itikhono added this pull request to the merge queue Feb 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 21, 2025
@dorloff dorloff enabled auto-merge February 21, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings category: docs OpenVINO documentation category: IE Tests OpenVINO Test: plugins and common category: transformations OpenVINO Runtime library - Transformations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants