-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[CPU][Android] Normalize late Convert in PostSnippets and fix FC pass namespace #32640
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
base: master
Are you sure you want to change the base?
[CPU][Android] Normalize late Convert in PostSnippets and fix FC pass namespace #32640
Conversation
… namespace\n\n- Add NormalizeConvertPreLower (Android-only) and register in PostSnippets\n- Use ov::pass::ConvertFullyConnectedToFullyConnectedCompressed to avoid ambiguous namespace\n- No other changes outside intel_cpu; no alias shim
| @@ -0,0 +1,65 @@ | |||
| // Copyright (C) 2025 Intel Corporation | |||
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.
| // Copyright (C) 2025 Intel Corporation | |
| // Copyright (C) 2018-2025 Intel Corporation |
| @@ -0,0 +1,23 @@ | |||
| // Copyright (C) 2025 Intel Corporation | |||
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.
| // Copyright (C) 2025 Intel Corporation | |
| // Copyright (C) 2018-2025 Intel Corporation |
| // CPU-side pass: for every ov::snippets::op::Subgraph, replace any remaining | ||
| // ov::op::v0::Convert / opset1::Convert inside subgraph body with | ||
| // ov::snippets::op::ConvertTruncation right before lowering in CPU pipeline. |
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 please specify more context in the pass description (That we workaround android specific problem, its details etc.)?
| auto m_v0 = ov::pass::pattern::wrap_type<ov::op::v0::Convert>(); | ||
| auto m_v1 = ov::pass::pattern::wrap_type<ov::opset1::Convert>(); |
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 please try this option?
| auto m_v0 = ov::pass::pattern::wrap_type<ov::op::v0::Convert>(); | |
| auto m_v1 = ov::pass::pattern::wrap_type<ov::opset1::Convert>(); | |
| auto convert_m = ov::pass::pattern::wrap_type<ov::op::v0::Convert, ov::opset1::Convert>(); |
If it works for android, I'd prefer leaving it since it is shorter
| ov::element::Type dst; | ||
| if (auto c0 = std::dynamic_pointer_cast<ov::op::v0::Convert>(cv)) { | ||
| dst = c0->get_destination_type(); | ||
| } else if (auto c1 = std::dynamic_pointer_cast<ov::opset1::Convert>(cv)) { | ||
| dst = c1->get_destination_type(); | ||
| } else { | ||
| return false; | ||
| } |
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.
dst can be always get as cv->get_output_element_type(0), we can avoid the casting here
Add NormalizeConvertPreLower (Android-only) and register in PostSnippets
Use ov::pass::ConvertFullyConnectedToFullyConnectedCompressed to avoid ambiguous namespace