Split Transformations between MOC and Common pipelines#7580
Merged
GlebKazantaev merged 5 commits intoopenvinotoolkit:masterfrom Oct 8, 2021
Merged
Conversation
889323d to
2b1fd71
Compare
2b1fd71 to
5196c6c
Compare
5196c6c to
b703b67
Compare
ilyachur
reviewed
Oct 8, 2021
...engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp
Show resolved
Hide resolved
ilyachur
approved these changes
Oct 8, 2021
itikhono
reviewed
Oct 8, 2021
...-engine/src/transformations/src/transformations/common_optimizations/moc_transformations.cpp
Show resolved
Hide resolved
itikhono
approved these changes
Oct 8, 2021
mvafin
approved these changes
Oct 8, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Since we have started to execute nGraph transformations in offline (ModelOptimizer backend stage) we grew up the transformation pipeline (MOCTransformations inside moc_transformations.cpp) which collects all plugin independent transformations that can be executed in offline. This pipeline became very similar to the CommonOptimizations pipeline so every time when we add new common transformation we have to add it to two very common pipelines so it doubles the maintenance cost.
Also as we are moving towards direct model support (FE in runtime) and parity between offline and runtime execution we have to provide the same number of optimizations in runtime that we perform in offline (except some LoadTime critical passes that will remain only in offline). This split of transformations helps us clearly divide plugin independent transformations from others and provide the same transformation pipeline in runtime which we have in offline.
Changes Description
DisableConvertConstantFoldingOnConstPathunder some condition. So to avoid changes in this behavior we have to skip this step inside moc when we execute it in common optimizations pipeline. But in offline case we have to preserve low-precision sub-graphs by default.How To Add New Transformation
Plugin Dependent Transformation
If this is plugin dependent transformation and some plugin disables it or parametrize it then we have to put it to CommonOptimizations pipeline or directly into particular plugin.
Common Transformation
If this is a common transformation we need to put it in MOCTransformations pipeline but we always need to remember that this transformation automatically will be executed in offline so we have to follow couple simple rules:
m_use_shapekey, so this transformation will be always applied in runtime but in offline it will be executed only is--static_shapekey is specified.m_use_shapekey or divided into two separate transformations (if dynamic version of this transformation fully covers version with shapes so we can keep only dynamic version). This division helps us to execute as much as possible in offline and to reduce number of transformations application in runtime.