-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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]remove useless convert pair(Convert[a->b] -> Convert[b->a]) #27868
base: master
Are you sure you want to change the base?
[CPU]remove useless convert pair(Convert[a->b] -> Convert[b->a]) #27868
Conversation
Don't add test case. A little upgrade can cover it in the functional test "ConcatSDPTransposeTestSetState" Signed-off-by: xipingya <[email protected]>
1: Rootcause: I removed useless convert, but some test still need it. Just add "DisableEliminateUselessConvert" runtime info to disable it. 2: some test function test also need it. Signed-off-by: xipingya <[email protected]>
Signed-off-by: xipingya <[email protected]>
I still have concern here. why is "filterSupportedPrimitiveDescriptors" called for parameter node here? Signed-off-by: xipingya <[email protected]>
.convert_element_type(element::f32); still need to call DisableEliminateUselessConvert Signed-off-by: xipingya <[email protected]>
aa4610b
to
786302e
Compare
hi @maxnick @dmitry-gorokhov @zhangYiIntel , I am not sure my solution is right or not (https://github.com/openvinotoolkit/openvino/pull/27868/files#diff-7a7a15dded44a2171cd0b23b2e456097939e46394ef697f601ee55d0772b36d6R457-R468), |
if (convert && convert->get_output_size() > 0u && convert->get_input_size() > 0u) { | ||
auto convert2 = ov::as_type_ptr<ov::op::v0::Convert>( | ||
convert->get_output_target_inputs(0).begin()->get_node()->shared_from_this()); | ||
if (convert2 && convert->get_input_element_type(0) == convert2->get_output_element_type(0) && |
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.
In general such optimization is not safe. Cases like Convert[fp32->fp16] -> Convert[fp16->f32] still needs to be executed explicitly as long as its elemintation will affect model accuracy.
However we still can adjust the pass to the patterns which are safe to remove (then src/dst precisions can be converted to intermediate precision w/o any loss).
@itikhono Do you think it is reasonable extension for the existing EliminateConvert pass?
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.
Thanks @dmitry-gorokhov for the clarification.
if (convert->get_input_element_type(0) == convert->get_element_type()) { | ||
return replace_output_update_name(convert->output(0), convert->input_value(0)); | ||
} | ||
|
||
// Only for some test. |
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.
This is definetelly incorrect way to solve test failures. Test exptected behavior should be updated instead.
Details:
Tickets: