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

[TRANSFORMATIONS] Call KeepPrecisionSensitiveInFP32 transformations recursively for internal MultiSubGraph body #28050

Merged

Conversation

CuriousPanCake
Copy link
Contributor

@CuriousPanCake CuriousPanCake commented Dec 12, 2024

[TRANSFORMATIONS] Call KeepPrecisionSensitiveInFP32 transformations recursively for internal MultiSubGraph body

A set of KeepPrecisionSensitiveInFP32 transformations (MarkSugraphsToKeepInMixedPrecision & AlignMixedFP32FP16Types) preserves the output precisions for certain parts of a model that need to remain in high precision, despite the general model conversion to a different precision (like it's done in the GPU pipeline fp32 -> fp16).

The AlignMixedFP32FP16Types transformation makes sure the high precision parts of the graph are surrounded with the required Converts to facilitate with the other parts of the model that have a different precision now. However, this won't take place if the model is an internal body of a MultiSubGraph as the transformation will not be called for it.

Fix it by calling the KeepPrecisionSensitiveInFP32 transformations recursively to make sure each internal body is converted correctly having the required Converts for it.

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

@CuriousPanCake CuriousPanCake requested a review from a team as a code owner December 12, 2024 21:40
@CuriousPanCake CuriousPanCake requested review from itikhono and removed request for a team December 12, 2024 21:40
@github-actions github-actions bot added the category: transformations OpenVINO Runtime library - Transformations label Dec 12, 2024
@CuriousPanCake CuriousPanCake changed the title [TRANSFORMATIONS] Add ConvertLike to MVN decomposition [TRANSFORMATIONS] Make KeepMixedPrecision transformations are called recursively for internal MultiSubGraphBody Dec 13, 2024
@CuriousPanCake CuriousPanCake changed the title [TRANSFORMATIONS] Make KeepMixedPrecision transformations are called recursively for internal MultiSubGraphBody [TRANSFORMATIONS] Call KeepMixedPrecision transformations recursively for internal MultiSubGraph body Dec 13, 2024
@CuriousPanCake CuriousPanCake changed the title [TRANSFORMATIONS] Call KeepMixedPrecision transformations recursively for internal MultiSubGraph body [TRANSFORMATIONS] Call KeepPrecisionSensitiveInFP32 transformations recursively for internal MultiSubGraph body Dec 13, 2024
It may happen that a MultiSubGraph body may contain an MVN node that is
usually decomposed into simpler operations.

If during ConvertPrecision transformation the inputs of the MultiSubGraph body are
converted to a different precision than the original model and
MultiSubGraph had (as it's done in the GPU pipeline f32 -> f16), the
desired precision for all the nodes appeared during decomposition will be
propagated through. However this will not apply to Constants resulting into
the error of mixed-precision for binary element-wise operations.

Fix it by adding a ConvertLike for the Constant that will be folded
and posses the correct desired precision.

- Ticket:
* CVS-158631

Signed-off-by: Andrii Staikov <[email protected]>
Comment on lines -68 to -71
// todo xxx-101766: if we don't skip Results there is an error on GPU
if (ov::as_type_ptr<ov::op::v0::Result>(out_node))
continue;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed per discussion with @pavel-esir

@CuriousPanCake CuriousPanCake added this pull request to the merge queue Dec 17, 2024
Merged via the queue into openvinotoolkit:master with commit 6f3796b Dec 17, 2024
181 checks passed
@CuriousPanCake CuriousPanCake deleted the CVS-158631_real_fix branch December 17, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: transformations OpenVINO Runtime library - Transformations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants