-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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][GPU] Add GroupNormalization fusion to common optimizations #28387
base: master
Are you sure you want to change the base?
[TRANSFORMATIONS][GPU] Add GroupNormalization fusion to common optimizations #28387
Conversation
3a67c81
to
ba87e35
Compare
build_jenkins |
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.
Lgtm regarding Core part.
src/common/transformations/tests/common_optimizations/group_normalization_fusion_tests.cpp
Show resolved
Hide resolved
ba87e35
to
3bd623d
Compare
build_jenkins |
3bd623d
to
d69391b
Compare
d69391b
to
b1ac67d
Compare
...mmon/transformations/src/transformations/common_optimizations/group_normalization_fusion.cpp
Show resolved
Hide resolved
auto input = pattern_map.at(input_m); | ||
auto input_ps = input.get_partial_shape(); | ||
|
||
auto T = input.get_element_type(); |
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.
the high level approach for matcher passes is that we split what to replace
(pattern) and how to replace
(callback). So ideally, all applicability checks should be a part of pattern, including this type/shapes/ranks checks. It's not always possible (for instance, when we need to cross-check multiple Ops), but for op attributes or in/out ports checks you can just use predicates mechanism. You can find few examples here: https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/src/plugin/transformations/transpose_fusion.cpp#L88-L98
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.
I've changed it to use predicates for things that don't depend on other nodes, but as you pointed out, I had to still leave some cross-checks between different ops inside callback. Can you check if it looks good to you now?
.../transformations/include/transformations/common_optimizations/group_normalization_fusion.hpp
Outdated
Show resolved
Hide resolved
...mmon/transformations/src/transformations/common_optimizations/group_normalization_fusion.cpp
Outdated
Show resolved
Hide resolved
...mmon/transformations/src/transformations/common_optimizations/group_normalization_fusion.cpp
Outdated
Show resolved
Hide resolved
src/common/transformations/tests/common_optimizations/group_normalization_fusion_tests.cpp
Outdated
Show resolved
Hide resolved
#include "transformations/init_node_info.hpp" | ||
|
||
using namespace testing; | ||
using namespace ov; |
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.
Consider wrap test in namespace
using namespace ov; | |
namespace ov::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.
While I appreciate your suggestion, I prefer to keep it consistent with other tests for common optimizations.
src/common/transformations/tests/common_optimizations/group_normalization_fusion_tests.cpp
Outdated
Show resolved
Hide resolved
// we need to be able to cast mvn to MVN layer type | ||
// in order to read actual epsilon value | ||
auto mvn_out = pattern_map.at(mvn_m); | ||
auto mvn = std::dynamic_pointer_cast<ov::op::v6::MVN>(mvn_out.get_node_shared_ptr()); |
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.
auto mvn = std::dynamic_pointer_cast<ov::op::v6::MVN>(mvn_out.get_node_shared_ptr()); | |
auto mvn = ov::as_type_ptr<ov::op::v6::MVN>(mvn_out.get_node_shared_ptr()); |
Use OV cast,
Or use as_type<op::v6::MVN*>(mvn_out.get_node())
to not create shared pointers as it looks not required for mvn.,
the mvn
can be null pointer or is validated before and here is not possible?
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, I've changed it to OV cast. My understanding is that there is no need for additional check, as it is set in the pattern as node of type "ov::op::v6::MVN" already.
src/common/transformations/tests/common_optimizations/group_normalization_fusion_tests.cpp
Show resolved
Hide resolved
src/common/transformations/tests/common_optimizations/group_normalization_fusion_tests.cpp
Outdated
Show resolved
Hide resolved
namespace ov { | ||
namespace 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.
Optional:
namespace ov { | |
namespace pass { | |
namespace ov::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.
While I appreciate your suggestion, I prefer to keep it consistent with header files for other common optimizations.
.../transformations/include/transformations/common_optimizations/group_normalization_fusion.hpp
Outdated
Show resolved
Hide resolved
89fe905
to
9cf1017
Compare
This reverts commit 217bcdc.
…GroupNormalizationFusion tests
…izationFusion tests
…lizationFusion tests
…sformations pipeline
…es in GroupNormalizationFusion pass
9cf1017
to
8382572
Compare
Details:
Tickets: