From e32fc0cd5d219b8418ccb360d2389e8978f15efa Mon Sep 17 00:00:00 2001 From: Tomasz Jankowski Date: Fri, 20 Dec 2024 18:37:51 +0100 Subject: [PATCH] [RTTI] Add OPENVINO_GRAPH_REWRITE_RTTI definition (#28165) ### Details: - Added RTTI definition for passes derived from `ov::pass::GraphRewrite`. - Applied where applicable. ### Tickets: - CVS-159694 Signed-off-by: Tomasz Jankowski --- .../include/low_precision/low_precision.hpp | 2 +- .../include/compress_quantize_weights.hpp | 2 +- .../offline_transformations/include/pruning.hpp | 4 ++-- .../compress_float_constants.hpp | 2 +- .../common_optimizations/concat_reduce_fusion.hpp | 2 +- .../convert_nms_gather_path_to_unsigned.hpp | 2 +- .../fuse_rotary_positional_embeddings.hpp | 2 +- .../common_optimizations/gelu_fusion.hpp | 2 +- .../common_optimizations/hsigmoid_fusion.hpp | 2 +- .../common_optimizations/hswish_fusion.hpp | 2 +- .../common_optimizations/lin_op_sequence_fusion.hpp | 2 +- .../common_optimizations/lstm_cell_fusion.hpp | 2 +- .../move_eltwise_up_data_movement.hpp | 2 +- .../common_optimizations/mvn_fusion.hpp | 2 +- .../common_optimizations/nop_elimination.hpp | 2 +- .../common_optimizations/pad_fusion.hpp | 2 +- .../common_optimizations/prelu_fusion.hpp | 2 +- .../common_optimizations/pull_through_reduce.hpp | 2 +- .../remove_filtering_boxes_by_size.hpp | 2 +- .../common_optimizations/swish_fusion.hpp | 2 +- .../common_optimizations/transpose_sinking.hpp | 2 +- .../bidirectional_sequences_decomposition.hpp | 2 +- .../convert_bitwise_to_logical_bool.hpp | 2 +- .../op_conversions/convert_reduce_to_pooling.hpp | 2 +- .../op_conversions/convert_reduce_to_reshape.hpp | 2 +- .../convert_sequences_to_tensor_iterator.hpp | 2 +- .../op_conversions/convert_ti_to_sequences.hpp | 4 ++-- .../transpose_sinking/ts_general.hpp | 4 ++-- .../openvino/pass/backward_graph_rewrite.hpp | 2 +- src/core/include/openvino/pass/graph_rewrite.hpp | 13 ++++++++++++- src/core/src/pass/graph_rewrite.cpp | 2 ++ src/core/tests/graph_rewrite.cpp | 2 +- src/core/tests/pass_config.cpp | 4 ++-- src/core/tests/pattern.cpp | 2 ++ .../arm/pass/convert_reduce_multi_axis.hpp | 2 +- .../arm/pass/convert_reduce_no_keep_dims.hpp | 2 +- .../common/pass/causal_mask_preprocess_fusion.hpp | 4 ++-- .../common/pass/rnn_sequences_optimization.hpp | 2 +- .../cpu_opset/x64/pass/mha_fusion.hpp | 2 +- .../plugin/transformations/indirect_kv_cache.hpp | 2 +- .../plugin/transformations/kv_cache_compression.hpp | 2 +- .../src/plugin/transformations/kv_cache_fusion.hpp | 2 +- .../src/plugin/transformations/transpose_fusion.hpp | 2 +- 43 files changed, 61 insertions(+), 46 deletions(-) diff --git a/src/common/low_precision_transformations/include/low_precision/low_precision.hpp b/src/common/low_precision_transformations/include/low_precision/low_precision.hpp index b3b92340303ced..483ec19f10a224 100644 --- a/src/common/low_precision_transformations/include/low_precision/low_precision.hpp +++ b/src/common/low_precision_transformations/include/low_precision/low_precision.hpp @@ -56,7 +56,7 @@ class ov::pass::low_precision::MarkupOptimizations : public ov::pass::ModelPass class ov::pass::low_precision::TypeRelaxedReplacer : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("TypeRelaxedReplacer", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("low_precision::TypeRelaxedReplacer"); TypeRelaxedReplacer(); }; diff --git a/src/common/offline_transformations/include/compress_quantize_weights.hpp b/src/common/offline_transformations/include/compress_quantize_weights.hpp index 9b2792caf93d47..90a2a434ae346a 100644 --- a/src/common/offline_transformations/include/compress_quantize_weights.hpp +++ b/src/common/offline_transformations/include/compress_quantize_weights.hpp @@ -102,6 +102,6 @@ class ov::pass::CompressWeightsWithFakeConvert : public ov::pass::MatcherPass { class ov::pass::CompressQuantizeWeights : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("CompressQuantizeWeights", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("CompressQuantizeWeights"); CompressQuantizeWeights(); }; diff --git a/src/common/offline_transformations/include/pruning.hpp b/src/common/offline_transformations/include/pruning.hpp index e573108a89eb86..13e46777fde205 100644 --- a/src/common/offline_transformations/include/pruning.hpp +++ b/src/common/offline_transformations/include/pruning.hpp @@ -29,7 +29,7 @@ class Pruning; */ class ov::pass::InitMasks : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("InitMasks", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("InitMasks"); InitMasks(); }; @@ -56,7 +56,7 @@ class ov::pass::InitConstMask : public ov::pass::MatcherPass { */ class ov::pass::PropagateMasks : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("PropagateMasks", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("PropagateMasks"); PropagateMasks(); }; diff --git a/src/common/transformations/include/transformations/common_optimizations/compress_float_constants.hpp b/src/common/transformations/include/transformations/common_optimizations/compress_float_constants.hpp index d8e0eb8c154766..2f87e5caa8c483 100644 --- a/src/common/transformations/include/transformations/common_optimizations/compress_float_constants.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/compress_float_constants.hpp @@ -41,7 +41,7 @@ class ov::pass::CompressFloatConstantsImpl : public ov::pass::MatcherPass { */ class ov::pass::CompressFloatConstants : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("CompressFloatConstants", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("CompressFloatConstants"); /// @brief Transformation constructor /// @param postponed Postponed compression, see ov::pass::CompressFloatConstantsImpl for details. CompressFloatConstants(bool postponed = false) { diff --git a/src/common/transformations/include/transformations/common_optimizations/concat_reduce_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/concat_reduce_fusion.hpp index ae02a2a50b4a2b..a1edbb5dafd32e 100644 --- a/src/common/transformations/include/transformations/common_optimizations/concat_reduce_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/concat_reduce_fusion.hpp @@ -76,6 +76,6 @@ class ov::pass::PullSqueezeThroughEltwise : public ov::pass::MatcherPass { class ov::pass::ConcatReduceFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("ConcatReduceFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConcatReduceFusion"); ConcatReduceFusion(); }; diff --git a/src/common/transformations/include/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.hpp b/src/common/transformations/include/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.hpp index d778c255160281..6982e985016402 100644 --- a/src/common/transformations/include/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.hpp @@ -27,6 +27,6 @@ class TRANSFORMATIONS_API ConvertNmsGatherPathToUnsigned; */ class ov::pass::ConvertNmsGatherPathToUnsigned : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("ConvertNmsGatherPathToUnsigned", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConvertNmsGatherPathToUnsigned"); ConvertNmsGatherPathToUnsigned(); }; diff --git a/src/common/transformations/include/transformations/common_optimizations/fuse_rotary_positional_embeddings.hpp b/src/common/transformations/include/transformations/common_optimizations/fuse_rotary_positional_embeddings.hpp index 8c45842b274dd5..51177738c1e2d5 100644 --- a/src/common/transformations/include/transformations/common_optimizations/fuse_rotary_positional_embeddings.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/fuse_rotary_positional_embeddings.hpp @@ -90,7 +90,7 @@ class ov::pass::RoPEShareCosSin : public ov::pass::MatcherPass { */ class ov::pass::RoPEFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("RoPEFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("RoPEFusion"); RoPEFusion(bool support_2d_rope = false) { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/gelu_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/gelu_fusion.hpp index 1388cda8268e17..7fd9826b0374be 100644 --- a/src/common/transformations/include/transformations/common_optimizations/gelu_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/gelu_fusion.hpp @@ -96,7 +96,7 @@ class ov::pass::GeluFusionWithTanhNoPower : public ov::pass::MatcherPass { */ class ov::pass::GeluFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("GeluFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("GeluFusion"); GeluFusion() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/hsigmoid_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/hsigmoid_fusion.hpp index 72da0b538b9336..5b301246c7a541 100644 --- a/src/common/transformations/include/transformations/common_optimizations/hsigmoid_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/hsigmoid_fusion.hpp @@ -79,7 +79,7 @@ class ov::pass::HSigmoidFusionWithClampDiv : public ov::pass::MatcherPass { */ class ov::pass::HSigmoidFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("HSigmoidFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("HSigmoidFusion"); HSigmoidFusion() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/hswish_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/hswish_fusion.hpp index 40a91cc4f08a9d..7b1faa990dd360 100644 --- a/src/common/transformations/include/transformations/common_optimizations/hswish_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/hswish_fusion.hpp @@ -68,7 +68,7 @@ class ov::pass::HSwishFusionWithClamp : public ov::pass::MatcherPass { */ class ov::pass::HSwishFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("HSwishFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("HSwishFusion"); HSwishFusion() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/lin_op_sequence_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/lin_op_sequence_fusion.hpp index 091deb3e32e58f..cc71a676eb3b60 100644 --- a/src/common/transformations/include/transformations/common_optimizations/lin_op_sequence_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/lin_op_sequence_fusion.hpp @@ -45,7 +45,7 @@ class ov::pass::MultiplyMultiplyFusion : public ov::pass::MatcherPass { */ class ov::pass::LinOpSequenceFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("LinOpSequenceFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("LinOpSequenceFusion"); LinOpSequenceFusion() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/lstm_cell_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/lstm_cell_fusion.hpp index 1bc5344b31e09b..2acbbf626cd6f3 100644 --- a/src/common/transformations/include/transformations/common_optimizations/lstm_cell_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/lstm_cell_fusion.hpp @@ -45,7 +45,7 @@ class ov::pass::LSTMCellFusionWithSplitWeights : public ov::pass::MatcherPass { */ class ov::pass::LSTMCellFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("LSTMCellFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("LSTMCellFusion"); LSTMCellFusion() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/move_eltwise_up_data_movement.hpp b/src/common/transformations/include/transformations/common_optimizations/move_eltwise_up_data_movement.hpp index d691eee7c29795..dd303ed1bfec45 100644 --- a/src/common/transformations/include/transformations/common_optimizations/move_eltwise_up_data_movement.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/move_eltwise_up_data_movement.hpp @@ -56,7 +56,7 @@ class TRANSFORMATIONS_API MoveEltwiseUpThroughDataMovPerChannel : public ov::pas class TRANSFORMATIONS_API MoveEltwiseUpThroughDataMov : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("MoveEltwiseUpThroughDataMov", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("MoveEltwiseUpThroughDataMov"); MoveEltwiseUpThroughDataMov(std::vector allowed_data_movement_ops = get_default_allowed_ops()) { this->add_matcher(allowed_data_movement_ops); this->add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/mvn_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/mvn_fusion.hpp index 4a625816261c9b..5433a081768090 100644 --- a/src/common/transformations/include/transformations/common_optimizations/mvn_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/mvn_fusion.hpp @@ -50,7 +50,7 @@ class ov::pass::MVNFusionWithConstantsInside : public ov::pass::MatcherPass { */ class ov::pass::MVNFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("MVNFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("MVNFusion"); MVNFusion() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/nop_elimination.hpp b/src/common/transformations/include/transformations/common_optimizations/nop_elimination.hpp index ea7d428bc1eea7..55cb8eeb2cf0c1 100644 --- a/src/common/transformations/include/transformations/common_optimizations/nop_elimination.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/nop_elimination.hpp @@ -145,7 +145,7 @@ class ov::pass::EliminateScatterUpdate : public ov::pass::MatcherPass { class ov::pass::NopElimination : public GraphRewrite { public: - OPENVINO_RTTI("NopElimination", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("NopElimination"); NopElimination(bool use_shape_for_elimination = true); }; diff --git a/src/common/transformations/include/transformations/common_optimizations/pad_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/pad_fusion.hpp index 018c098d221d3e..628391547da82c 100644 --- a/src/common/transformations/include/transformations/common_optimizations/pad_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/pad_fusion.hpp @@ -90,7 +90,7 @@ class ov::pass::PadFusionGroupConvolutionBackpropData : public ov::pass::Matcher class ov::pass::PadFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("PadFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("PadFusion"); PadFusion() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/prelu_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/prelu_fusion.hpp index bb1c3206f1ea3d..729d32375c9eb1 100644 --- a/src/common/transformations/include/transformations/common_optimizations/prelu_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/prelu_fusion.hpp @@ -148,7 +148,7 @@ class ov::pass::PReluFusionNegReluMulAdd : public ov::pass::MatcherPass { */ class ov::pass::PReluFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("PReluFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("PReluFusion"); PReluFusion() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/pull_through_reduce.hpp b/src/common/transformations/include/transformations/common_optimizations/pull_through_reduce.hpp index 2824ba2a8b374d..86f54e9dc03ac5 100644 --- a/src/common/transformations/include/transformations/common_optimizations/pull_through_reduce.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/pull_through_reduce.hpp @@ -49,7 +49,7 @@ class ov::pass::PullReshapeThroughReduce : public ov::pass::MatcherPass { */ class ov::pass::PullThroughReduce : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("PullThroughReduce", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("PullThroughReduce"); PullThroughReduce() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/remove_filtering_boxes_by_size.hpp b/src/common/transformations/include/transformations/common_optimizations/remove_filtering_boxes_by_size.hpp index 02ebb6eec3a48d..0965f06a465770 100644 --- a/src/common/transformations/include/transformations/common_optimizations/remove_filtering_boxes_by_size.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/remove_filtering_boxes_by_size.hpp @@ -21,7 +21,7 @@ class TRANSFORMATIONS_API RemoveFilteringBoxesBySize; class ov::pass::FuseFilteringBoxesBySize : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("FuseFilteringBoxesBySize", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("FuseFilteringBoxesBySize"); FuseFilteringBoxesBySize(); }; diff --git a/src/common/transformations/include/transformations/common_optimizations/swish_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/swish_fusion.hpp index 2bee12da7d9c41..d9a1ae6e321f35 100644 --- a/src/common/transformations/include/transformations/common_optimizations/swish_fusion.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/swish_fusion.hpp @@ -68,7 +68,7 @@ class ov::pass::SwishFusionWithoutBeta : public ov::pass::MatcherPass { */ class ov::pass::SwishFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("SwishFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("SwishFusion"); SwishFusion() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/common_optimizations/transpose_sinking.hpp b/src/common/transformations/include/transformations/common_optimizations/transpose_sinking.hpp index 31de821878e971..d9f5c257f6dda1 100644 --- a/src/common/transformations/include/transformations/common_optimizations/transpose_sinking.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/transpose_sinking.hpp @@ -81,7 +81,7 @@ class ov::pass::TransposeFuse : public ov::pass::MatcherPass { */ class ov::pass::TransposeSinking : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("TransposeSinking", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("TransposeSinking"); TransposeSinking() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp index f74f08a9b8c061..a49c1655537844 100644 --- a/src/common/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp +++ b/src/common/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp @@ -67,7 +67,7 @@ class ov::pass::BidirectionalRNNSequenceDecomposition : public ov::pass::Matcher class ov::pass::BidirectionalSequenceDecomposition : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("BidirectionalSequenceDecomposition", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("BidirectionalSequenceDecomposition"); BidirectionalSequenceDecomposition() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/op_conversions/convert_bitwise_to_logical_bool.hpp b/src/common/transformations/include/transformations/op_conversions/convert_bitwise_to_logical_bool.hpp index a5e130e2389af2..64821ce658eb66 100644 --- a/src/common/transformations/include/transformations/op_conversions/convert_bitwise_to_logical_bool.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_bitwise_to_logical_bool.hpp @@ -43,7 +43,7 @@ class ov::pass::ConvertBitwiseXorToLogicalXor : public ov::pass::MatcherPass { */ class ConvertBitwiseToLogical : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("ConvertBitwiseToLogical", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConvertBitwiseToLogical"); ConvertBitwiseToLogical() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp b/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp index 36d2b052243382..32a2f7a3ace512 100644 --- a/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp @@ -61,7 +61,7 @@ class ov::pass::ConvertReduceSumToPooling : public ConvertReduceBase { class ov::pass::ConvertReduceToPooling : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("ConvertReduceToPooling", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConvertReduceToPooling"); ConvertReduceToPooling() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_reshape.hpp b/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_reshape.hpp index f020e768be2feb..9eeb3e5c0f8da6 100644 --- a/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_reshape.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_reshape.hpp @@ -84,7 +84,7 @@ class ov::pass::ConvertReduceLogicalOrToReshape : public CvtReduceBase { class ov::pass::ConvertReduceToReshape : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("ConvertReduceToReshape", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConvertReduceToReshape"); // Handling reduce if it can be converted to reshape (check input/output tensor) ConvertReduceToReshape() { // Redundant reduce based on its mode diff --git a/src/common/transformations/include/transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp b/src/common/transformations/include/transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp index 46a7e8ff0317e9..e108f4a50ce1f2 100644 --- a/src/common/transformations/include/transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp @@ -59,6 +59,6 @@ class ov::pass::ConvertLSTMSequenceToTensorIterator : public ov::pass::MatcherPa class ov::pass::ConvertSequenceToTensorIterator : public GraphRewrite { public: - OPENVINO_RTTI("ConvertSequenceToTensorIterator", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConvertSequenceToTensorIterator"); ConvertSequenceToTensorIterator(); }; diff --git a/src/common/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp b/src/common/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp index fb53cc81743ec4..f4bd61573e3ac2 100644 --- a/src/common/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp @@ -66,7 +66,7 @@ class ov::pass::ConvertTensorIteratorToGRUSequence : public ov::pass::MatcherPas class ov::pass::ConvertTensorIteratorToSequence : public GraphRewrite { public: - OPENVINO_RTTI("ConvertTensorIteratorToSequence", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConvertTensorIteratorToSequence"); ConvertTensorIteratorToSequence(); }; @@ -88,7 +88,7 @@ class ov::pass::ConvertLoopWithScatterUpdateToLSTMSequence : public ov::pass::Ma */ class ov::pass::ConvertLoopToLSTMSequence : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("ConvertLoopToLSTMSequence", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConvertLoopToLSTMSequence"); ConvertLoopToLSTMSequence() { add_matcher(); add_matcher(); diff --git a/src/common/transformations/include/transformations/transpose_sinking/ts_general.hpp b/src/common/transformations/include/transformations/transpose_sinking/ts_general.hpp index 09d4d5819322a9..b39a25b9db0872 100644 --- a/src/common/transformations/include/transformations/transpose_sinking/ts_general.hpp +++ b/src/common/transformations/include/transformations/transpose_sinking/ts_general.hpp @@ -29,7 +29,7 @@ using TransposeSinkingGeneral = ov::pass::transpose_sinking::TSGeneral; */ class ov::pass::transpose_sinking::TSGeneralForward : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("TSGeneralForward", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("TSGeneralForward"); TSGeneralForward(); }; @@ -40,7 +40,7 @@ class ov::pass::transpose_sinking::TSGeneralForward : public ov::pass::GraphRewr */ class ov::pass::transpose_sinking::TSGeneralBackward : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("TSGeneralBackward", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("TSGeneralBackward"); TSGeneralBackward(); }; diff --git a/src/core/include/openvino/pass/backward_graph_rewrite.hpp b/src/core/include/openvino/pass/backward_graph_rewrite.hpp index 7e7f6f118efe8d..cb7f24a76272bb 100644 --- a/src/core/include/openvino/pass/backward_graph_rewrite.hpp +++ b/src/core/include/openvino/pass/backward_graph_rewrite.hpp @@ -11,7 +11,7 @@ namespace ov { namespace pass { class OPENVINO_API BackwardGraphRewrite : public GraphRewrite { public: - OPENVINO_RTTI("ov::pass::BackwardGraphRewrite"); + OPENVINO_GRAPH_REWRITE_RTTI("ov::pass::BackwardGraphRewrite"); BackwardGraphRewrite() = default; diff --git a/src/core/include/openvino/pass/graph_rewrite.hpp b/src/core/include/openvino/pass/graph_rewrite.hpp index ec8e1339912513..4628875fef8fd9 100644 --- a/src/core/include/openvino/pass/graph_rewrite.hpp +++ b/src/core/include/openvino/pass/graph_rewrite.hpp @@ -8,8 +8,19 @@ #include #include +#include "openvino/core/rtti.hpp" #include "openvino/pass/matcher_pass.hpp" +#define _OPENVINO_GRAPH_REWRITE_RTTI_WITH_TYPE(TYPE_NAME) _OPENVINO_GRAPH_REWRITE_RTTI_WITH_TYPE_VERSION(TYPE_NAME, "0") + +#define _OPENVINO_GRAPH_REWRITE_RTTI_WITH_TYPE_VERSION(TYPE_NAME, VERSION_NAME) \ + _OPENVINO_RTTI_WITH_TYPE_VERSION_PARENT(TYPE_NAME, VERSION_NAME, ::ov::pass::GraphRewrite) + +#define OPENVINO_GRAPH_REWRITE_RTTI(...) \ + _OPENVINO_RTTI_EXPAND(_OPENVINO_RTTI_DEFINITION_SELECTOR_2(__VA_ARGS__, \ + _OPENVINO_GRAPH_REWRITE_RTTI_WITH_TYPE_VERSION, \ + _OPENVINO_GRAPH_REWRITE_RTTI_WITH_TYPE)(__VA_ARGS__)) + namespace ov { namespace pass { /// \brief GraphRewrite is a container for MatcherPasses that allows to run them on Function @@ -80,7 +91,7 @@ class OPENVINO_API GraphRewrite : public ModelPass { /// /// class ov::pass::LinFusions: public ov::pass::GraphRewrite { /// public: - /// OPENVINO_RTTI("LinFusion"); + /// OPENVINO_GRAPH_REWRITE_RTTI("LinFusion"); /// Fusions() { /// add_matcher(); /// add_matcher(); diff --git a/src/core/src/pass/graph_rewrite.cpp b/src/core/src/pass/graph_rewrite.cpp index 029f572189f829..f8a1f1e723d7a7 100644 --- a/src/core/src/pass/graph_rewrite.cpp +++ b/src/core/src/pass/graph_rewrite.cpp @@ -253,6 +253,8 @@ void ov::pass::GraphRewrite::set_pass_config(const std::shared_ptr& // For example: // // class ExampleGraphRewrite: public pass::GraphRewrite { + // public: + // OPENVINO_GRAPH_REWRITE_RTTI("ExampleGraphRewrite"); // ExampleGraphRewrite() { // add_mather(); // add_mather(); diff --git a/src/core/tests/graph_rewrite.cpp b/src/core/tests/graph_rewrite.cpp index 20955f5a5d6b1f..c47b6d5a473666 100644 --- a/src/core/tests/graph_rewrite.cpp +++ b/src/core/tests/graph_rewrite.cpp @@ -58,7 +58,7 @@ class GatherNodesPass : public ov::pass::MatcherPass { class Anchor : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("Anchor"); + OPENVINO_GRAPH_REWRITE_RTTI("Anchor"); Anchor() : GraphRewrite() {} }; diff --git a/src/core/tests/pass_config.cpp b/src/core/tests/pass_config.cpp index 053cb2b62aff32..56d9b2fedf8197 100644 --- a/src/core/tests/pass_config.cpp +++ b/src/core/tests/pass_config.cpp @@ -66,7 +66,7 @@ class TestModelPass : public pass::ModelPass { class TestGraphRewritePass : public pass::GraphRewrite { public: - OPENVINO_RTTI("TestGraphRewritePass"); + OPENVINO_GRAPH_REWRITE_RTTI("TestGraphRewritePass"); TestGraphRewritePass() { add_matcher(); add_matcher(); @@ -284,7 +284,7 @@ class TestNestedMatcher : public ov::pass::MatcherPass { class TestNestedGraphRewrite : public pass::GraphRewrite { public: - OPENVINO_RTTI("TestNestedGraphRewrite"); + OPENVINO_GRAPH_REWRITE_RTTI("TestNestedGraphRewrite"); TestNestedGraphRewrite() { add_matcher(); } diff --git a/src/core/tests/pattern.cpp b/src/core/tests/pattern.cpp index 982e59b55f0f97..5bb961e57db1c2 100644 --- a/src/core/tests/pattern.cpp +++ b/src/core/tests/pattern.cpp @@ -82,6 +82,8 @@ static std::shared_ptr construct_mean_graph() { class TestGraphRewrite : public ov::pass::GraphRewrite { public: + OPENVINO_GRAPH_REWRITE_RTTI("TestGraphRewrite"); + void construct_multiply_by_one() { // pattern #1 : a * 1 = a auto iconst1 = construct_constant_node(1); diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_reduce_multi_axis.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_reduce_multi_axis.hpp index 947d7ee476bc81..4b0bb0e8c81f8a 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_reduce_multi_axis.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_reduce_multi_axis.hpp @@ -82,7 +82,7 @@ class ConvertReduceSum : public ConvertReduceMultiAxisBase { class ConvertReduceMultiAxis : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("ConvertReduceMultiAxis", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConvertReduceMultiAxis"); ConvertReduceMultiAxis() { add_matcher(); add_matcher(); diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_reduce_no_keep_dims.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_reduce_no_keep_dims.hpp index 6cc683154cc175..9684a047afa08e 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_reduce_no_keep_dims.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_reduce_no_keep_dims.hpp @@ -59,7 +59,7 @@ class ConvertReduction : public ConvertReduceNoKeepDimsBase { class ConvertReduceNoKeepDims : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("ConvertReduceNoKeepDims", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("ConvertReduceNoKeepDims"); ConvertReduceNoKeepDims() { add_matcher>(); add_matcher>(); diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.hpp index f9db370aea49bb..4a46a042722a12 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.hpp @@ -11,9 +11,9 @@ namespace intel_cpu { class CausalMaskPreprocessFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("CausalMaskPreprocessFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("CausalMaskPreprocessFusion"); CausalMaskPreprocessFusion(); }; } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/rnn_sequences_optimization.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/rnn_sequences_optimization.hpp index a63a3dce8219c2..4cfc27d7836180 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/rnn_sequences_optimization.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/rnn_sequences_optimization.hpp @@ -29,7 +29,7 @@ class OptimizeRNNSequenceTransposes : public ov::pass::MatcherPass { class OptimizeSequenceTransposes : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("OptimizeSequenceTransposes", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("OptimizeSequenceTransposes"); OptimizeSequenceTransposes(); }; diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/mha_fusion.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/mha_fusion.hpp index fe4f4ccae04f1c..d84c11af9801e5 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/mha_fusion.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/mha_fusion.hpp @@ -54,7 +54,7 @@ class MHAQuantFusion2 : public MHAFusionBase { class MHAFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("MHAFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("MHAFusion"); MHAFusion() { add_matcher(); add_matcher(); diff --git a/src/plugins/intel_gpu/src/plugin/transformations/indirect_kv_cache.hpp b/src/plugins/intel_gpu/src/plugin/transformations/indirect_kv_cache.hpp index 0fc96b6215ba95..f76edeeb4f20da 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/indirect_kv_cache.hpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/indirect_kv_cache.hpp @@ -38,7 +38,7 @@ namespace intel_gpu { /// └───────────┘ └───────────────┘ class IndirectKVCache : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("IndirectKVCache", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("IndirectKVCache"); IndirectKVCache(); }; diff --git a/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_compression.hpp b/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_compression.hpp index 1587021a03ed36..036fdb78914891 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_compression.hpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_compression.hpp @@ -32,7 +32,7 @@ namespace intel_gpu { class KVCacheCompression : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("KVCacheCompression", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("KVCacheCompression"); KVCacheCompression(ov::element::Type compression_dt); bool run_on_model(const std::shared_ptr& m) override; diff --git a/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_fusion.hpp b/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_fusion.hpp index dbe147da8d46b7..614d3ba5020363 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_fusion.hpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_fusion.hpp @@ -76,7 +76,7 @@ namespace intel_gpu { /// └─────────────┘ └───────────┘ └─────────┘ class KVCacheFusion : public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("KVCacheFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("KVCacheFusion"); KVCacheFusion(); bool run_on_model(const std::shared_ptr& m) override; diff --git a/src/plugins/intel_gpu/src/plugin/transformations/transpose_fusion.hpp b/src/plugins/intel_gpu/src/plugin/transformations/transpose_fusion.hpp index a845c7a7aa86b0..3a985a33c722df 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/transpose_fusion.hpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/transpose_fusion.hpp @@ -11,7 +11,7 @@ namespace intel_gpu { class TransposeFusion: public ov::pass::GraphRewrite { public: - OPENVINO_RTTI("TransposeFusion", "0"); + OPENVINO_GRAPH_REWRITE_RTTI("TransposeFusion"); TransposeFusion(bool supports_immad = false); };