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

[CPU] SnS transform ambiguous convert #27948

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/common/snippets/src/op/subgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "snippets/pass/align_element_types.hpp"
#include "snippets/pass/reduce_to_snippets_reduce.hpp"
#include "snippets/pass/gn_decomposition.hpp"
#include "snippets/pass/transform_convert.hpp"

#include "snippets/runtime_configurator.hpp"
#include "snippets/utils/utils.hpp"
Expand Down Expand Up @@ -428,6 +429,7 @@ void Subgraph::data_flow_transformations(const BlockedShapeVector& blocked_input
manager.register_pass<snippets::pass::ConvertConstantsToScalars>();

manager.register_positioned_passes(backend_passes);
manager.register_pass<snippets::pass::TransformConvertToConvertTruncation>();
Copy link
Contributor

@a-sidorova a-sidorova Dec 9, 2024

Choose a reason for hiding this comment

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

We call this transformation in CommonOptimizations after subgraph tokenization to mark all original Convert ops as ConvertTruncation.

Then all other transformations which inserts Convert op (such as FQDecomposition or PropagatePrecision), should always insert utility ConvertSaturation op.

Did you find the pass after TransformConvertToConvertTruncation registration in CommonOptimizations which inserts clear Convert op (not from Snippets dialect)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't reproduce the issue locally. I checked the passes after ConvertTruncation in commonOptimization. Only found an potential possible convert in ConstantFolding, but not very sure. So I need more detailed info from the issue reporter:-)

manager.run_passes(body_ptr());
}

Expand Down
5 changes: 2 additions & 3 deletions src/common/snippets/src/pass/transform_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@

ov::snippets::pass::TransformConvertToConvertTruncation::TransformConvertToConvertTruncation() {
MATCHER_SCOPE(TransformConvertToConvertTruncation);
auto convert = std::make_shared<ov::pass::pattern::op::Label>(ov::pass::pattern::any_input(),
auto convert_pattern = std::make_shared<ov::pass::pattern::op::Label>(ov::pass::pattern::any_input(),
[](const std::shared_ptr<const Node> &n) {
return ov::is_type<ov::opset1::Convert>(n) &&
!ov::is_type<op::ConvertTruncation>(n) &&
!ov::is_type<op::ConvertSaturation>(n);
});

register_matcher(std::make_shared<ov::pass::pattern::Matcher>(
ov::pass::pattern::wrap_type<ov::opset1::Convert>(), matcher_name), [](ov::pass::pattern::Matcher &m) {
register_matcher(std::make_shared<ov::pass::pattern::Matcher>(convert_pattern, matcher_name), [](ov::pass::pattern::Matcher &m) {
OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "Snippets::op::TransformConvertToConvertTruncation")
const auto root = m.get_match_root();
const auto convert = ov::as_type_ptr<ov::opset1::Convert>(root);
Expand Down
Loading