From e82018221c674774223d7ea9585f210791ab7f2d Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Tue, 19 Jan 2021 10:19:25 +0300 Subject: [PATCH] Added CC macro to transformations (#3795) * Added CC macro to transformations * Fixed typo * Added MATCHER_SCOPE * Fixed review comments * Try to remove MATCHER_CALLBACK_SCOPE * Fixed matcher name * Fixed MATCHER_SCOPE * Added documentation * Fixed typo * Fixed CC for linux * Fixed names * Fixed docs * Fixed typo * FIxed comments * Add more CC macros --- docs/nGraph_DG/nGraphTransformation.md | 7 + .../convert_opset1_to_legacy.cpp | 7 +- .../convert_prior_to_ie_prior.cpp | 2 +- .../src/transformations/CMakeLists.txt | 2 +- .../convert_reduce_to_pooling.hpp | 24 +-- .../src/transformations/src/itt.hpp | 71 ++++++++ .../src/ngraph_ops/convolution_ie.cpp | 4 + .../src/ngraph_ops/deconvolution_ie.cpp | 16 +- .../src/ngraph_ops/nms_ie_internal.cpp | 4 + .../algebraic_simplification.cpp | 2 + .../broadcast_elementwise_fusion.cpp | 4 +- .../common_optimizations/clamp_fusion.cpp | 4 +- .../common_optimizations.cpp | 3 +- .../common_optimizations/conv_bias_fusion.cpp | 172 ++++++++++-------- .../common_optimizations/conv_mul_fusion.cpp | 13 +- .../convert_quantize_dequantize.cpp | 4 +- .../depth_to_space_fusion.cpp | 4 +- .../common_optimizations/fq_mul_fusion.cpp | 109 +++++------ .../fq_reshape_fusion.cpp | 4 +- .../common_optimizations/hsigmoid_fusion.cpp | 13 +- .../common_optimizations/hswish_fusion.cpp | 13 +- .../lin_op_sequence_fusion.cpp | 10 +- .../common_optimizations/mish_fusion.cpp | 4 +- .../common_optimizations/nop_elimination.cpp | 2 + .../normalize_l2_fusion.cpp | 7 +- .../optimize_strided_slice.cpp | 5 + .../pull_transpose_through_fq.cpp | 4 +- .../remove_filtering_boxes_by_size.cpp | 4 +- .../common_optimizations/softplus_fusion.cpp | 4 +- .../softplus_to_mish_fusion.cpp | 4 +- .../common_optimizations/swish_fusion.cpp | 13 +- .../control_flow/unroll_tensor_iterator.cpp | 2 + .../src/transformations/convert_precision.cpp | 2 + .../src/transformations/init_node_info.cpp | 2 + .../src/transformations/itt.hpp | 35 ---- .../batch_norm_decomposition.cpp | 7 +- .../bidirectional_sequences_decomposition.cpp | 10 +- .../op_conversions/convert_batch_to_space.cpp | 7 +- .../op_conversions/convert_broadcast3.cpp | 4 +- .../convert_broadcast_to_tiles.cpp | 4 +- .../op_conversions/convert_convolutions.cpp | 13 +- .../op_conversions/convert_depth_to_space.cpp | 4 +- .../op_conversions/convert_divide.cpp | 4 +- .../op_conversions/convert_gather_0d.cpp | 5 +- .../op_conversions/convert_gelu.cpp | 4 +- .../convert_interpolate1_to_interpolate4.cpp | 6 +- .../convert_minimum_to_power_and_max.cpp | 4 +- .../op_conversions/convert_mod.cpp | 4 +- .../op_conversions/convert_mvn1_to_mvn6.cpp | 5 +- .../op_conversions/convert_negative.cpp | 4 +- .../convert_nms_to_nms_ie_internal.cpp | 4 +- .../convert_pad_to_group_conv.cpp | 6 +- .../convert_previous_nms_to_nms_5.cpp | 10 +- .../convert_reduce_to_pooling.cpp | 25 +++ .../convert_scatter_elements_to_scatter.cpp | 4 +- .../convert_sequences_to_tensor_iterator.cpp | 12 +- .../op_conversions/convert_shapeof3.cpp | 4 +- .../convert_shuffle_channels3.cpp | 4 +- .../op_conversions/convert_space_to_batch.cpp | 8 +- .../op_conversions/convert_space_to_depth.cpp | 4 +- .../op_conversions/convert_subtract.cpp | 4 +- .../convert_ti_to_sequences.cpp | 12 +- .../op_conversions/convert_topk3.cpp | 4 +- .../op_conversions/gru_cell_decomposition.cpp | 4 +- .../op_conversions/hsigmoid_decomposition.cpp | 4 +- .../op_conversions/hswish_decomposition.cpp | 4 +- .../log_softmax_decomposition.cpp | 4 +- .../lstm_cell_decomposition.cpp | 4 +- .../op_conversions/mvn6_decomposition.cpp | 4 +- .../reduce_l1_decomposition.cpp | 4 +- .../reduce_l2_decomposition.cpp | 4 +- .../op_conversions/rnn_cell_decomposition.cpp | 4 +- .../op_conversions/softplus_decomposition.cpp | 4 +- .../convert_opset2_to_opset1.cpp | 3 +- .../convert_opset3_to_opset2.cpp | 3 +- .../src/transformations/serialize.cpp | 2 + .../smart_reshape/matmul_sr.cpp | 18 +- .../smart_reshape/mimic_set_batch_size.cpp | 2 + .../proposal_scales_stridedslice.cpp | 7 +- .../smart_reshape/reshape_to_1D.cpp | 4 +- .../smart_reshape/set_batch_size.cpp | 3 +- .../smart_reshape/smart_reshape.cpp | 2 + .../smart_reshape/strided_slice_squeeze.cpp | 11 +- ngraph/core/src/itt.hpp | 7 + ngraph/core/src/pass/graph_rewrite.cpp | 6 +- 85 files changed, 564 insertions(+), 310 deletions(-) create mode 100644 inference-engine/src/transformations/src/itt.hpp delete mode 100644 inference-engine/src/transformations/src/transformations/itt.hpp diff --git a/docs/nGraph_DG/nGraphTransformation.md b/docs/nGraph_DG/nGraphTransformation.md index 318aa50f435..96e89ec7691 100644 --- a/docs/nGraph_DG/nGraphTransformation.md +++ b/docs/nGraph_DG/nGraphTransformation.md @@ -253,6 +253,13 @@ To eliminate operation, nGraph has special method that considers all limitations `replace_output_update_name` in case of successful replacement it automatically preserves friendly name and runtime info. +## Transformation conditional compilation + +Transformation library has two internal macros to support conditional compilation feature. + +* `MATCHER_SCOPE(region)` - allows to disable the MatcherPass if matcher isn't used. The region name should be unique. This macro creates a local variable `matcher_name` which you should use as a matcher name. +* `RUN_ON_FUNCTION_SCOPE(region)` - allows to disable run_on_function pass if it isn't used. The region name should be unique. + ## Transformation writing essentials When developing a transformation, you need to follow these transformation rules: diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp index 17550da5b05..f88785151f8 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp @@ -81,12 +81,7 @@ bool ngraph::pass::ConvertOpSet1ToLegacy::run_on_function(std::shared_ptr(); // Convolution/Deconvolution/FullyConnected fusions - auto convert_convolutions = manager.register_pass(); - convert_convolutions->add_matcher(); - convert_convolutions->add_matcher(); - convert_convolutions->add_matcher(); - convert_convolutions->add_matcher(); - convert_convolutions->set_name("ngraph::pass::ConvertConvolutions"); + manager.register_pass(); // Convolution/Deconvolution/FullyConnected fusions auto fusion = manager.register_pass(); diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_prior_to_ie_prior.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_prior_to_ie_prior.cpp index b37fde6348e..88ebbd8263d 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_prior_to_ie_prior.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_prior_to_ie_prior.cpp @@ -295,4 +295,4 @@ ngraph::pass::ConvertPriorBoxClusteredToLegacy::ConvertPriorBoxClusteredToLegacy auto m = std::make_shared(unsqueeze, "ConvertPriorBoxClusteredToLegacy"); register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/CMakeLists.txt b/inference-engine/src/transformations/CMakeLists.txt index 4ca91c32a43..17617ac3855 100644 --- a/inference-engine/src/transformations/CMakeLists.txt +++ b/inference-engine/src/transformations/CMakeLists.txt @@ -28,7 +28,7 @@ ie_add_vs_version_file(NAME ${TARGET_NAME} FILEDESCRIPTION "Inference Engine Transformations library") target_link_libraries(${TARGET_NAME} PUBLIC ${NGRAPH_LIBRARIES} - PRIVATE openvino::itt ngraph::builder pugixml) + PRIVATE openvino::conditional_compilation openvino::itt ngraph::builder pugixml) target_include_directories(${TARGET_NAME} PUBLIC ${PUBLIC_HEADERS_DIR} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src") diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp b/inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp index d0b9251ad00..37a275c2bae 100644 --- a/inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp +++ b/inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp @@ -48,37 +48,19 @@ public: class ngraph::pass::ConvertReduceMeanToPooling: public ConvertReduceBase { public: NGRAPH_RTTI_DECLARATION; - ConvertReduceMeanToPooling() { - auto m = std::make_shared( - ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), - pattern::wrap_type()}, - pattern::has_static_shape()), "ConvertReduceMean"); - register_matcher(m, convert_reduce_to_pooling()); - } + ConvertReduceMeanToPooling(); }; class ngraph::pass::ConvertReduceMaxToPooling: public ConvertReduceBase { public: NGRAPH_RTTI_DECLARATION; - ConvertReduceMaxToPooling() { - auto m = std::make_shared( - ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), - pattern::wrap_type()}, - pattern::has_static_shape()), "ConvertReduceMax"); - register_matcher(m, convert_reduce_to_pooling()); - } + ConvertReduceMaxToPooling(); }; class ngraph::pass::ConvertReduceSumToPooling: public ConvertReduceBase { public: NGRAPH_RTTI_DECLARATION; - ConvertReduceSumToPooling() { - auto m = std::make_shared( - ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), - pattern::wrap_type()}, - pattern::has_static_shape()), "ConvertReduceSum"); - register_matcher(m, convert_reduce_to_pooling()); - } + ConvertReduceSumToPooling(); }; template diff --git a/inference-engine/src/transformations/src/itt.hpp b/inference-engine/src/transformations/src/itt.hpp new file mode 100644 index 00000000000..cabba94bfc1 --- /dev/null +++ b/inference-engine/src/transformations/src/itt.hpp @@ -0,0 +1,71 @@ +//***************************************************************************** +// Copyright 2017-2020 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//***************************************************************************** + +/** + * @brief Defines openvino domains for tracing + * @file itt.hpp + */ + +#pragma once + +#include +#include + +namespace ngraph { +namespace pass { +namespace itt { +namespace domains { + OV_ITT_DOMAIN(IETransform); +} // namespace domains +} // namespace itt +} // namespace pass +} // namespace ngraph + +OV_CC_DOMAINS(ngraph_pass); +OV_CC_DOMAINS(internal_op); + +/* + * RUN_ON_FUNCTION_SCOPE macro allows to disable the run_on_function pass + * MATCHER_SCOPE macro allows to disable the MatcherPass if matcher isn't applied + * INTERNAL_OP_SCOPE macro allows to disable parts of internal nGraph operations if they are not used + */ +#if defined(SELECTIVE_BUILD_ANALYZER) +#define RUN_ON_FUNCTION_SCOPE(region) OV_SCOPE(ngraph_pass, OV_CC_CAT(region, _run_on_function)) +#define MATCHER_SCOPE(region) \ + const std::string matcher_name(OV_CC_TOSTRING(region)) + +#define INTERNAL_OP_SCOPE(region) OV_SCOPE(internal_op, region) + +#elif defined(SELECTIVE_BUILD) + +#define MATCHER_SCOPE_(scope, region) \ + if (OV_CC_SCOPE_IS_ENABLED(OV_CC_CAT3(scope, _, region)) == 0) \ + throw ngraph::ngraph_error(std::string(OV_CC_TOSTRING(OV_CC_CAT3(scope, _, region))) + \ + " is disabled!") + +#define MATCHER_SCOPE(region) \ + const std::string matcher_name(OV_CC_TOSTRING(region)); \ + if (OV_CC_SCOPE_IS_ENABLED(OV_CC_CAT3(ngraph_pass, _, region)) == 0) \ + return +#define INTERNAL_OP_SCOPE(region) MATCHER_SCOPE_(internal_op, region) +#define RUN_ON_FUNCTION_SCOPE(region) MATCHER_SCOPE_(ngraph_pass, OV_CC_CAT(region, _run_on_function)) + +#else +#define MATCHER_SCOPE(region) \ + const std::string matcher_name(OV_CC_TOSTRING(region)) +#define INTERNAL_OP_SCOPE(region) +#define RUN_ON_FUNCTION_SCOPE(region) +#endif diff --git a/inference-engine/src/transformations/src/ngraph_ops/convolution_ie.cpp b/inference-engine/src/transformations/src/ngraph_ops/convolution_ie.cpp index 2820c1d6325..a3c9417f2c8 100644 --- a/inference-engine/src/transformations/src/ngraph_ops/convolution_ie.cpp +++ b/inference-engine/src/transformations/src/ngraph_ops/convolution_ie.cpp @@ -3,6 +3,7 @@ // #include "ngraph_ops/convolution_ie.hpp" +#include "itt.hpp" #include #include @@ -99,6 +100,7 @@ op::ConvolutionIE::ConvolutionIE(const Output& data_batch, } void op::ConvolutionIE::validate_and_infer_types() { + INTERNAL_OP_SCOPE(ConvolutionIE_validate_and_infer_types); PartialShape data_batch_shape = get_input_partial_shape(0); PartialShape filters_shape = get_input_partial_shape(1); @@ -145,6 +147,7 @@ void op::ConvolutionIE::validate_and_infer_types() { } shared_ptr op::ConvolutionIE::clone_with_new_inputs(const ngraph::OutputVector & new_args) const { + INTERNAL_OP_SCOPE(ConvolutionIE_clone_with_new_inputs); if (new_args.size() == 2) { return make_shared(new_args.at(0), new_args.at(1), @@ -172,6 +175,7 @@ shared_ptr op::ConvolutionIE::clone_with_new_inputs(const ngraph::OutputVe } bool op::ConvolutionIE::visit_attributes(AttributeVisitor& visitor) { + INTERNAL_OP_SCOPE(ConvolutionIE_visit_attributes); visitor.on_attribute("strides", m_strides); visitor.on_attribute("dilations", m_dilations); visitor.on_attribute("pads_begin", m_pads_begin); diff --git a/inference-engine/src/transformations/src/ngraph_ops/deconvolution_ie.cpp b/inference-engine/src/transformations/src/ngraph_ops/deconvolution_ie.cpp index dca81e5b44a..56a281ffbaa 100644 --- a/inference-engine/src/transformations/src/ngraph_ops/deconvolution_ie.cpp +++ b/inference-engine/src/transformations/src/ngraph_ops/deconvolution_ie.cpp @@ -6,6 +6,7 @@ #include #include #include +#include "itt.hpp" #include "ngraph_ops/deconvolution_ie.hpp" @@ -64,6 +65,7 @@ op::DeconvolutionIE::DeconvolutionIE(const Output& data, } void op::DeconvolutionIE::validate_and_infer_types() { + INTERNAL_OP_SCOPE(DeconvolutionIE_validate_and_infer_types); // To calculate output shape we use opset1::GroupConvolutionBackPropData // but before we need to reshape weights from I(G*O)YX to GIOYX auto weights = input_value(1); @@ -89,6 +91,7 @@ void op::DeconvolutionIE::validate_and_infer_types() { } shared_ptr op::DeconvolutionIE::clone_with_new_inputs(const ngraph::OutputVector &new_args) const { + INTERNAL_OP_SCOPE(DeconvolutionIE_clone_with_new_inputs); if (new_args.size() == 2) { return make_shared(new_args.at(0), new_args.at(1), @@ -117,10 +120,11 @@ shared_ptr op::DeconvolutionIE::clone_with_new_inputs(const ngraph::Output } bool op::DeconvolutionIE::visit_attributes(AttributeVisitor& visitor) { - visitor.on_attribute("strides", m_strides); - visitor.on_attribute("dilations", m_dilations); - visitor.on_attribute("pads_begin", m_pads_begin); - visitor.on_attribute("pads_end", m_pads_end); - visitor.on_attribute("group", m_group); - return true; + INTERNAL_OP_SCOPE(DeconvolutionIE_visit_attributes); + visitor.on_attribute("strides", m_strides); + visitor.on_attribute("dilations", m_dilations); + visitor.on_attribute("pads_begin", m_pads_begin); + visitor.on_attribute("pads_end", m_pads_end); + visitor.on_attribute("group", m_group); + return true; } diff --git a/inference-engine/src/transformations/src/ngraph_ops/nms_ie_internal.cpp b/inference-engine/src/transformations/src/ngraph_ops/nms_ie_internal.cpp index 2053e869434..4a406396988 100644 --- a/inference-engine/src/transformations/src/ngraph_ops/nms_ie_internal.cpp +++ b/inference-engine/src/transformations/src/ngraph_ops/nms_ie_internal.cpp @@ -6,6 +6,7 @@ #include #include "ngraph_ops/nms_ie_internal.hpp" +#include "itt.hpp" using namespace std; using namespace ngraph; @@ -40,6 +41,7 @@ op::internal::NonMaxSuppressionIEInternal::NonMaxSuppressionIEInternal(const Out } std::shared_ptr op::internal::NonMaxSuppressionIEInternal::clone_with_new_inputs(const ngraph::OutputVector &new_args) const { + INTERNAL_OP_SCOPE(internal_NonMaxSuppressionIEInternal_clone_with_new_inputs); if (new_args.size() == 6) { return make_shared(new_args.at(0), new_args.at(1), new_args.at(2), new_args.at(3), new_args.at(4), new_args.at(5), m_center_point_box, m_sort_result_descending, @@ -53,6 +55,7 @@ std::shared_ptr op::internal::NonMaxSuppressionIEInternal::clone_with_new_ } bool op::internal::NonMaxSuppressionIEInternal::visit_attributes(AttributeVisitor& visitor) { + INTERNAL_OP_SCOPE(internal_NonMaxSuppressionIEInternal_visit_attributes); visitor.on_attribute("center_point_box", m_center_point_box); visitor.on_attribute("sort_result_descending", m_sort_result_descending); visitor.on_attribute("output_type", m_output_type); @@ -79,6 +82,7 @@ int64_t op::internal::NonMaxSuppressionIEInternal::max_boxes_output_from_input() } void op::internal::NonMaxSuppressionIEInternal::validate_and_infer_types() { + INTERNAL_OP_SCOPE(internal_NonMaxSuppressionIEInternal_validate_and_infer_types); const auto boxes_ps = get_input_partial_shape(boxes_port); const auto scores_ps = get_input_partial_shape(scores_port); diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp index 589e31d8d3b..27265821086 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp @@ -19,6 +19,7 @@ #include #include "transformations/common_optimizations/algebraic_simplification.hpp" +#include "itt.hpp" #include #include @@ -234,6 +235,7 @@ static bool replace_transpose_with_reshape(shared_ptr transpose) { } bool pass::AlgebraicSimplification::run_on_function(shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(AlgebraicSimplification); static const unordered_map)>> ops_to_simplifiers = {{opset3::Gather::type_info, simplify_gather}, {opset2::ShapeOf::type_info, simplify_gather_shapeof}, diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/broadcast_elementwise_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/broadcast_elementwise_fusion.cpp index 5d3482e4474..d5824caf670 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/broadcast_elementwise_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/broadcast_elementwise_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/broadcast_elementwise_fusion.hpp" #include @@ -51,6 +52,7 @@ bool can_eliminate_broadcast(const ngraph::Output& eltwise, } ngraph::pass::BroadcastElementwiseFusion::BroadcastElementwiseFusion() { + MATCHER_SCOPE(BroadcastElementwiseFusion); auto broadcast_input = pattern::any_input(); auto broadcast = pattern::wrap_type({broadcast_input, pattern::any_input()}); auto eltwise_input = pattern::any_input(); @@ -76,6 +78,6 @@ ngraph::pass::BroadcastElementwiseFusion::BroadcastElementwiseFusion() { return false; }; - auto m = std::make_shared(eltwise, "BroadcastElementwiseFusion"); + auto m = std::make_shared(eltwise, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/clamp_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/clamp_fusion.cpp index 00e79f73afd..4b3ade67cdb 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/clamp_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/clamp_fusion.cpp @@ -11,11 +11,13 @@ #include #include #include +#include "itt.hpp" NGRAPH_RTTI_DEFINITION(ngraph::pass::ClampFusion, "ClampFusion", 0); ngraph::pass::ClampFusion::ClampFusion() { + MATCHER_SCOPE(ClampFusion); auto data_pattern = ngraph::pattern::any_input(); auto min_const_pattern = ngraph::pattern::wrap_type(); auto max_const_pattern = ngraph::pattern::wrap_type(); @@ -53,6 +55,6 @@ ngraph::pass::ClampFusion::ClampFusion() { return true; }; - auto m = std::make_shared(min_pattern, "ClampFusion"); + auto m = std::make_shared(min_pattern, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp index b89a9e78689..0755782d3d3 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp @@ -5,7 +5,7 @@ #include #include "transformations/init_node_info.hpp" -#include "transformations/itt.hpp" +#include "itt.hpp" #include "transformations/common_optimizations/algebraic_simplification.hpp" #include "transformations/common_optimizations/broadcast_elementwise_fusion.hpp" #include "transformations/common_optimizations/nop_elimination.hpp" @@ -55,6 +55,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::CommonOptimizations, "CommonOptimizations", 0); bool ngraph::pass::CommonOptimizations::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(CommonOptimizations); ngraph::pass::Manager manager(get_pass_config()); // This pass must be called first in pipeline diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp index 99ac553c271..e4225bdcb15 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -16,6 +17,7 @@ #include #include +#include "itt.hpp" using namespace ngraph; @@ -65,127 +67,139 @@ bool IsConvInLowPrecision(const std::shared_ptr& conv) { } template -ngraph::matcher_pass_callback get_callback() { - ngraph::matcher_pass_callback callback = [](ngraph::pattern::Matcher &m) { - auto eltwise = m.get_match_root(); +bool conv_callback(ngraph::pattern::Matcher &m) { + auto eltwise = m.get_match_root(); - std::shared_ptr m_const; - std::shared_ptr m_conv; - // FIXME: use auto [m_conv, m_const] when C++17 is available - std::tie(m_conv, m_const) = parse_eltwise_inputs(eltwise); - if (!m_conv || !m_const) { - return false; - } + std::shared_ptr m_const; + std::shared_ptr m_conv; + // FIXME: use auto [m_conv, m_const] when C++17 is available + std::tie(m_conv, m_const) = parse_eltwise_inputs(eltwise); + if (!m_conv || !m_const) { + return false; + } - const auto & const_shape = m_const->get_shape(); - const auto & output_pshape = m_conv->get_output_partial_shape(0); + const auto & const_shape = m_const->get_shape(); + const auto & output_pshape = m_conv->get_output_partial_shape(0); - if (output_pshape.rank().is_dynamic() || output_pshape[1].is_dynamic()) { - return false; - } + if (output_pshape.rank().is_dynamic() || output_pshape[1].is_dynamic()) { + return false; + } - const auto & output_rank = output_pshape.rank().get_length(); + const auto & output_rank = output_pshape.rank().get_length(); - const int64_t channel_dim = output_pshape[1].get_length(); + const int64_t channel_dim = output_pshape[1].get_length(); - bool is_scalar_multiplier(shape_size(const_shape) == 1); + bool is_scalar_multiplier(shape_size(const_shape) == 1); - // Check that constant has shape [1, C, 1, 1] where the number of 1 is equal to - // the number of spatial dimensions or it's a scalar. That means that Constant - // applied per channel and can be fused into Convolution weights. - // Also Constant shape rank must be less or equal Convolution output shape - // otherwise fusion will break output broadcasting - auto expected_shape = Shape(output_rank, 1); - expected_shape[1] = channel_dim; + // Check that constant has shape [1, C, 1, 1] where the number of 1 is equal to + // the number of spatial dimensions or it's a scalar. That means that Constant + // applied per channel and can be fused into Convolution weights. + // Also Constant shape rank must be less or equal Convolution output shape + // otherwise fusion will break output broadcasting + auto expected_shape = Shape(output_rank, 1); + expected_shape[1] = channel_dim; - if (op::util::check_for_broadcast(expected_shape, const_shape)) { - return false; - } + if (op::util::check_for_broadcast(expected_shape, const_shape)) { + return false; + } - // Broadcast constant to [1, C, 1, 1] where the number of 1 is equal to - // the number of weights dimensions. - Output final_const = m_const; - if (is_scalar_multiplier) { - final_const = op::util::broadcastTo(m_const, expected_shape); - } + // Broadcast constant to [1, C, 1, 1] where the number of 1 is equal to + // the number of weights dimensions. + Output final_const = m_const; + if (is_scalar_multiplier) { + final_const = op::util::broadcastTo(m_const, expected_shape); + } - if (final_const.get_shape().size() > 1) { - final_const = std::make_shared(final_const, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{1}, {channel_dim}), true); - } + if (final_const.get_shape().size() > 1) { + final_const = std::make_shared(final_const, + ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{1}, {channel_dim}), true); + } - ngraph::Output new_conv, new_weights, new_bias; - if (std::dynamic_pointer_cast(eltwise)) { - // Fuse: ConvolutionIE/DeconvolutionIE->Add - if (m_conv->inputs().size() == 2) { - new_bias = final_const; - } else { - new_bias = std::make_shared(final_const, m_conv->input_value(2)); - } - new_conv = m_conv->clone_with_new_inputs({m_conv->input_value(0), m_conv->input_value(1), new_bias}); - } else if (std::is_same() && std::dynamic_pointer_cast(eltwise) && - !IsConvInLowPrecision(m_conv)) { - // Fuse: ConvolutionIE->Mul - auto weights_shape = m_conv->input(1).get_shape(); - - ngraph::Shape weights_const_shape(weights_shape.size(), 1); - weights_const_shape[0] = weights_shape[0]; - - auto const_reshape = std::make_shared(final_const, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{weights_const_shape.size()}, weights_const_shape), true); - new_weights = std::make_shared (m_conv->input_value(1), const_reshape); - if (m_conv->inputs().size() == 2) { - new_conv = m_conv->clone_with_new_inputs({m_conv->input_value(0), new_weights}); - } else { - auto bias_reshape = std::make_shared(final_const, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{1}, {weights_shape[0]}), true); - new_bias = std::make_shared(bias_reshape, final_const); - new_conv = m_conv->clone_with_new_inputs({m_conv->input_value(0), new_weights, new_bias}); - } + ngraph::Output new_conv, new_weights, new_bias; + if (std::dynamic_pointer_cast(eltwise)) { + // Fuse: ConvolutionIE/DeconvolutionIE->Add + if (m_conv->inputs().size() == 2) { + new_bias = final_const; } else { - return false; + new_bias = std::make_shared(final_const, m_conv->input_value(2)); } + new_conv = m_conv->clone_with_new_inputs({m_conv->input_value(0), m_conv->input_value(1), new_bias}); + } else if (std::is_same() && std::dynamic_pointer_cast(eltwise) && + !IsConvInLowPrecision(m_conv)) { + // Fuse: ConvolutionIE->Mul + auto weights_shape = m_conv->input(1).get_shape(); - ngraph::copy_runtime_info({m_conv, eltwise}, new_conv.get_node_shared_ptr()); - new_conv.get_node_shared_ptr()->set_friendly_name(m.get_match_root()->get_friendly_name()); - ngraph::replace_node(m.get_match_root(), new_conv.get_node_shared_ptr()); - return true; - }; - return callback; + ngraph::Shape weights_const_shape(weights_shape.size(), 1); + weights_const_shape[0] = weights_shape[0]; + + auto const_reshape = std::make_shared(final_const, + ngraph::opset1::Constant::create(ngraph::element::i64, + ngraph::Shape{weights_const_shape.size()}, + weights_const_shape), + true); + new_weights = std::make_shared (m_conv->input_value(1), const_reshape); + if (m_conv->inputs().size() == 2) { + new_conv = m_conv->clone_with_new_inputs({m_conv->input_value(0), new_weights}); + } else { + auto bias_reshape = std::make_shared(final_const, + ngraph::opset1::Constant::create(ngraph::element::i64, + ngraph::Shape{1}, + {weights_shape[0]}), + true); + new_bias = std::make_shared(bias_reshape, final_const); + new_conv = m_conv->clone_with_new_inputs({m_conv->input_value(0), new_weights, new_bias}); + } + } else { + return false; + } + + ngraph::copy_runtime_info({m_conv, eltwise}, new_conv.get_node_shared_ptr()); + new_conv.get_node_shared_ptr()->set_friendly_name(m.get_match_root()->get_friendly_name()); + ngraph::replace_node(m.get_match_root(), new_conv.get_node_shared_ptr()); + return true; } NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvAddFusion, "ConvAddFusion", 0); ngraph::pass::ConvAddFusion::ConvAddFusion() { + MATCHER_SCOPE(ConvAddFusion); auto conv = ngraph::pattern::wrap_type(pattern::consumers_count(1)); auto add = ngraph::pattern::wrap_type({conv, std::make_shared()}); - matcher_pass_callback callback = get_callback(); + matcher_pass_callback callback = [](ngraph::pattern::Matcher &m) { + return conv_callback(m); + }; - auto m = std::make_shared(add, "ConvAddFusion"); + auto m = std::make_shared(add, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvMultiplyFusion, "ConvMultiplyFusion", 0); ngraph::pass::ConvMultiplyFusion::ConvMultiplyFusion() { + MATCHER_SCOPE(ConvMultiplyFusion); auto conv = ngraph::pattern::wrap_type(pattern::consumers_count(1)); auto add = ngraph::pattern::wrap_type({conv, std::make_shared()}); - matcher_pass_callback callback = get_callback(); + matcher_pass_callback callback = [](ngraph::pattern::Matcher &m) { + return conv_callback(m); + }; - auto m = std::make_shared(add, "ConvMultiplyFusion"); + auto m = std::make_shared(add, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::DeconvAddFusion, "DeconvAddFusion", 0); ngraph::pass::DeconvAddFusion::DeconvAddFusion() { + MATCHER_SCOPE(DeconvAddFusion); auto conv = ngraph::pattern::wrap_type(pattern::consumers_count(1)); auto add = ngraph::pattern::wrap_type({conv, std::make_shared()}); - matcher_pass_callback callback = get_callback(); + matcher_pass_callback callback = [](ngraph::pattern::Matcher &m){ + return conv_callback(m); + }; - auto m = std::make_shared(add, "DeconvAddFusion"); + auto m = std::make_shared(add, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp index 4f10f679743..06dea782333 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp @@ -3,6 +3,7 @@ // #include "transformations/common_optimizations/conv_mul_fusion.hpp" +#include "itt.hpp" #include #include @@ -18,6 +19,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvolutionMultiplyFusion, "ConvolutionMultiplyFusion", 0); ngraph::pass::ConvolutionMultiplyFusion::ConvolutionMultiplyFusion() { + MATCHER_SCOPE(ConvolutionMultiplyFusion); auto input = pattern::any_input(); auto weights = ngraph::pattern::any_input(pattern::has_static_dim(0) /* has OIYX layout */); auto conv = ngraph::pattern::wrap_type({input, weights}, pattern::consumers_count(1)); @@ -74,13 +76,14 @@ ngraph::pass::ConvolutionMultiplyFusion::ConvolutionMultiplyFusion() { return true; }; - auto m = std::make_shared(mul, "ConvolutionMultiplyFusion"); + auto m = std::make_shared(mul, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::GroupConvolutionMultiplyFusion, "GroupConvolutionMultiplyFusion", 0); ngraph::pass::GroupConvolutionMultiplyFusion::GroupConvolutionMultiplyFusion() { + MATCHER_SCOPE(GroupConvolutionMultiplyFusion); auto input = pattern::any_input(); auto weights = ngraph::pattern::any_input();//pattern::has_static_dims({0, 1}) /* has GOIYX layout */); auto conv = ngraph::pattern::wrap_type({input, weights}, pattern::consumers_count(1)); @@ -139,13 +142,14 @@ ngraph::pass::GroupConvolutionMultiplyFusion::GroupConvolutionMultiplyFusion() { return true; }; - auto m = std::make_shared(mul, "GroupConvolutionMultiplyFusion"); + auto m = std::make_shared(mul, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvolutionBackpropDataMultiplyFusion, "ConvolutionBackpropDataMultiplyFusion", 0); ngraph::pass::ConvolutionBackpropDataMultiplyFusion::ConvolutionBackpropDataMultiplyFusion() { + MATCHER_SCOPE(ConvolutionBackpropDataMultiplyFusion); auto input = pattern::any_input(); auto weights = ngraph::pattern::any_input(pattern::has_static_dim(1) /* has IOYX layout */); auto conv = ngraph::pattern::wrap_type({input, weights}, pattern::consumers_count(1)); @@ -202,13 +206,14 @@ ngraph::pass::ConvolutionBackpropDataMultiplyFusion::ConvolutionBackpropDataMult return true; }; - auto m = std::make_shared(mul, "ConvolutionBackpropDataMultiplyFusion"); + auto m = std::make_shared(mul, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::GroupConvolutionBackpropDataMultiplyFusion, "GroupConvolutionBackpropDataMultiplyFusion", 0); ngraph::pass::GroupConvolutionBackpropDataMultiplyFusion::GroupConvolutionBackpropDataMultiplyFusion() { + MATCHER_SCOPE(GroupConvolutionBackpropDataMultiplyFusion); auto input = pattern::any_input(); auto weights = ngraph::pattern::any_input(pattern::has_static_dims({0, 2}) /* has GIOYX layout */); auto conv = ngraph::pattern::wrap_type({input, weights}, pattern::consumers_count(1)); @@ -267,6 +272,6 @@ ngraph::pass::GroupConvolutionBackpropDataMultiplyFusion::GroupConvolutionBackpr return true; }; - auto m = std::make_shared(mul, "GroupConvolutionMultiplyFusion"); + auto m = std::make_shared(mul, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/convert_quantize_dequantize.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/convert_quantize_dequantize.cpp index 4cb11ab10ad..b396f51895b 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/convert_quantize_dequantize.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/convert_quantize_dequantize.cpp @@ -4,6 +4,7 @@ #include "transformations/common_optimizations/convert_quantize_dequantize.hpp" #include "transformations/utils/utils.hpp" +#include "itt.hpp" #include #include @@ -57,6 +58,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertQuantizeDequantize, "ConvertQuantizeDequantize", 0); ngraph::pass::ConvertQuantizeDequantize::ConvertQuantizeDequantize() { + MATCHER_SCOPE(ConvertQuantizeDequantize); auto data_pattern = ngraph::pattern::any_input(); auto input_low_pattern = ngraph::pattern::any_input(); auto input_high_pattern = ngraph::pattern::any_input(); @@ -149,6 +151,6 @@ ngraph::pass::ConvertQuantizeDequantize::ConvertQuantizeDequantize() { return true; }; - auto m = std::make_shared(mul_pattern, "ConvertQuantizeDequantize"); + auto m = std::make_shared(mul_pattern, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/depth_to_space_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/depth_to_space_fusion.cpp index 8fa97e8b69a..a210b485834 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/depth_to_space_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/depth_to_space_fusion.cpp @@ -3,6 +3,7 @@ // #include "transformations/common_optimizations/depth_to_space_fusion.hpp" +#include "itt.hpp" #include #include @@ -84,6 +85,7 @@ bool check_depth_first(const ngraph::Shape& shape_input, const ngraph::Shape& sh NGRAPH_RTTI_DEFINITION(ngraph::pass::DepthToSpaceFusion, "DepthToSpaceFusion", 0); ngraph::pass::DepthToSpaceFusion::DepthToSpaceFusion() { + MATCHER_SCOPE(DepthToSpaceFusion); auto input0 = std::make_shared(element::f32, Shape{1, 1, 1, 1}); auto input1 = std::make_shared(element::i64, Shape{4}); auto input2 = std::make_shared(element::i64, Shape{4}); @@ -159,6 +161,6 @@ ngraph::pass::DepthToSpaceFusion::DepthToSpaceFusion() { return true; }; - auto m = std::make_shared(reshape_after, "DepthToSpaceFusion"); + auto m = std::make_shared(reshape_after, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp index 7a62287285c..36c69e97335 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/fq_mul_fusion.hpp" #include "transformations/utils/utils.hpp" @@ -15,29 +16,29 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::FakeQuantizeMulFusion, "FakeQuantizeMulFusion", 0); namespace { - std::pair, ngraph::Output> - get_adjusted_output_range(ngraph::Output out_low, - ngraph::Output out_high, - ngraph::Output multiplier) { - const auto mul_out_low = std::make_shared(out_low, multiplier); - const auto mul_out_high = std::make_shared(out_high, multiplier); - copy_runtime_info({out_low.get_node_shared_ptr(), multiplier.get_node_shared_ptr()}, - mul_out_low); - copy_runtime_info({out_high.get_node_shared_ptr(), multiplier.get_node_shared_ptr()}, - mul_out_high); +std::pair, ngraph::Output> + get_adjusted_output_range(ngraph::Output out_low, + ngraph::Output out_high, + ngraph::Output multiplier) { + const auto mul_out_low = std::make_shared(out_low, multiplier); + const auto mul_out_high = std::make_shared(out_high, multiplier); + copy_runtime_info({out_low.get_node_shared_ptr(), multiplier.get_node_shared_ptr()}, + mul_out_low); + copy_runtime_info({out_high.get_node_shared_ptr(), multiplier.get_node_shared_ptr()}, + mul_out_high); - ngraph::OutputVector new_out_low(1), new_out_high(1); + ngraph::OutputVector new_out_low(1), new_out_high(1); - if (!mul_out_low->constant_fold(new_out_low, {out_low, multiplier})) { - new_out_low[0] = mul_out_low; + if (!mul_out_low->constant_fold(new_out_low, {out_low, multiplier})) { + new_out_low[0] = mul_out_low; + } + + if (!mul_out_high->constant_fold(new_out_high, {out_high, multiplier})) { + new_out_high[0] = mul_out_high; + } + + return {new_out_low[0], new_out_high[0]}; } - - if (!mul_out_high->constant_fold(new_out_high, {out_high, multiplier})) { - new_out_high[0] = mul_out_high; - } - - return {new_out_low[0], new_out_high[0]}; - } } // namespace // This transformation multiplies the "output_low" and "output_high" inputs of the FQ operation @@ -62,49 +63,49 @@ namespace { // ngraph::pass::FakeQuantizeMulFusion::FakeQuantizeMulFusion() { - const auto fq_output_low_p = ngraph::pattern::any_input(); - const auto fq_output_high_p = ngraph::pattern::any_input(); + MATCHER_SCOPE(FakeQuantizeMulFusion); + const auto fq_output_low_p = ngraph::pattern::any_input(); + const auto fq_output_high_p = ngraph::pattern::any_input(); - const auto fq_node_p = ngraph::pattern::wrap_type( - {ngraph::pattern::any_input(), - ngraph::pattern::any_input(), - ngraph::pattern::any_input(), - fq_output_low_p, - fq_output_high_p}, - pattern::consumers_count(1)); + const auto fq_node_p = ngraph::pattern::wrap_type( + {ngraph::pattern::any_input(), + ngraph::pattern::any_input(), + ngraph::pattern::any_input(), + fq_output_low_p, + fq_output_high_p}, + pattern::consumers_count(1)); - const auto mul_constant_p = ngraph::pattern::wrap_type(); - const auto mul_node_p = ngraph::pattern::wrap_type( - {fq_node_p, mul_constant_p}, pattern::consumers_count(1)); + const auto mul_constant_p = ngraph::pattern::wrap_type(); + const auto mul_node_p = ngraph::pattern::wrap_type( + {fq_node_p, mul_constant_p}, pattern::consumers_count(1)); - ngraph::matcher_pass_callback callback = [=](pattern::Matcher &m) { - const auto& pattern_map = m.get_pattern_value_map(); + ngraph::matcher_pass_callback callback = [=](pattern::Matcher &m) { + const auto& pattern_map = m.get_pattern_value_map(); - const auto fq_node = pattern_map.at(fq_node_p).get_node_shared_ptr(); + const auto fq_node = pattern_map.at(fq_node_p).get_node_shared_ptr(); - const auto original_output_low = pattern_map.at(fq_output_low_p); - const auto original_output_high = pattern_map.at(fq_output_high_p); - const auto mul_constant = pattern_map.at(mul_constant_p); + const auto original_output_low = pattern_map.at(fq_output_low_p); + const auto original_output_high = pattern_map.at(fq_output_high_p); + const auto mul_constant = pattern_map.at(mul_constant_p); - const auto new_output_limits = get_adjusted_output_range( - original_output_low, original_output_high, mul_constant); + const auto new_output_limits = get_adjusted_output_range( + original_output_low, original_output_high, mul_constant); - const auto new_fq_node = fq_node->clone_with_new_inputs({fq_node->input_value(0), - fq_node->input_value(1), - fq_node->input_value(2), - new_output_limits.first, - new_output_limits.second}); + const auto new_fq_node = fq_node->clone_with_new_inputs({fq_node->input_value(0), + fq_node->input_value(1), + fq_node->input_value(2), + new_output_limits.first, + new_output_limits.second}); - const auto mul_node = pattern_map.at(mul_node_p).get_node_shared_ptr(); - replace_node(mul_node, new_fq_node); + const auto mul_node = pattern_map.at(mul_node_p).get_node_shared_ptr(); + replace_node(mul_node, new_fq_node); - new_fq_node->set_friendly_name(fq_node->get_friendly_name()); - copy_runtime_info({fq_node, mul_node}, new_fq_node); + new_fq_node->set_friendly_name(fq_node->get_friendly_name()); + copy_runtime_info({fq_node, mul_node}, new_fq_node); - return true; - }; + return true; + }; - auto m = std::make_shared(mul_node_p, - "FakeQuantizeMulFusion"); - this->register_matcher(m, callback); + auto m = std::make_shared(mul_node_p, matcher_name); + this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp index 0697a7ac4d5..224b3c0d1ad 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/fq_reshape_fusion.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::FakeQuantizeReshapeFusion, "FakeQuantizeReshapeFusion", 0); ngraph::pass::FakeQuantizeReshapeFusion::FakeQuantizeReshapeFusion() { + MATCHER_SCOPE(FakeQuantizeReshapeFusion); const auto fq_node_p = ngraph::pattern::wrap_type( {ngraph::pattern::wrap_type(), // for weights only ngraph::pattern::any_input(), @@ -74,6 +76,6 @@ ngraph::pass::FakeQuantizeReshapeFusion::FakeQuantizeReshapeFusion() { return true; }; - auto m = std::make_shared(reshape_node_p, "FakeQuantizeReshapeFusion"); + auto m = std::make_shared(reshape_node_p, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/hsigmoid_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/hsigmoid_fusion.cpp index f19c91eeba1..28c11ef5cc7 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/hsigmoid_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/hsigmoid_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/hsigmoid_fusion.hpp" #include "transformations/utils/utils.hpp" @@ -16,6 +17,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::HSigmoidFusion, "HSigmoidFusion", 0); NGRAPH_RTTI_DEFINITION(ngraph::pass::HSigmoidFusionWithReluDiv, "HSigmoidFusionWithReluDiv", 0); ngraph::pass::HSigmoidFusionWithReluDiv::HSigmoidFusionWithReluDiv() { + MATCHER_SCOPE(HSigmoidFusionWithReluDiv); // Replaces a sub-graph ((min(Relu(x + 3), 6)) / 6 with a HSigmoid op. auto input = ngraph::pattern::any_input(); auto add_constant = ngraph::pattern::wrap_type(); @@ -55,13 +57,14 @@ ngraph::pass::HSigmoidFusionWithReluDiv::HSigmoidFusionWithReluDiv() { return true; }; - auto m = std::make_shared(div, "HSigmoidWithReluDivFusion"); + auto m = std::make_shared(div, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::HSigmoidFusionWithReluMul, "HSigmoidFusionWithReluMul", 0); ngraph::pass::HSigmoidFusionWithReluMul::HSigmoidFusionWithReluMul() { + MATCHER_SCOPE(HSigmoidFusionWithReluMul); // Replaces a sub-graph ((min(Relu(x + 3), 6)) * const(1/6) with a HSigmoid op. auto input = ngraph::pattern::any_input(); auto add_constant = ngraph::pattern::wrap_type(); @@ -102,13 +105,14 @@ ngraph::pass::HSigmoidFusionWithReluMul::HSigmoidFusionWithReluMul() { return true; }; - auto m = std::make_shared(mul_second, "HSigmoidWithReluMulFusion"); + auto m = std::make_shared(mul_second, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::HSigmoidFusionWithoutRelu, "HSigmoidFusionWithoutRelu", 0); ngraph::pass::HSigmoidFusionWithoutRelu::HSigmoidFusionWithoutRelu() { + MATCHER_SCOPE(HSigmoidFusionWithoutRelu); // Replaces a sub-graph (min(max(x + 3, 0), 6) / 6) with a HSigmoid op. auto input = ngraph::pattern::any_input(); auto add_constant = ngraph::pattern::wrap_type(); @@ -152,13 +156,14 @@ ngraph::pass::HSigmoidFusionWithoutRelu::HSigmoidFusionWithoutRelu() { return true; }; - auto m = std::make_shared(div, "HSigmoidWithoutReluFusion"); + auto m = std::make_shared(div, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::HSigmoidFusionWithClamp, "HSigmoidFusionWithClamp", 0); ngraph::pass::HSigmoidFusionWithClamp::HSigmoidFusionWithClamp() { + MATCHER_SCOPE(HSigmoidFusionWithClamp); // Replaces a sub-graph (Clamp(x + 3, 0, 6) * const(1/6)) with a HSigmoid op. auto input = ngraph::pattern::any_input(); auto add_constant = ngraph::pattern::wrap_type(); @@ -193,6 +198,6 @@ ngraph::pass::HSigmoidFusionWithClamp::HSigmoidFusionWithClamp() { return true; }; - auto m = std::make_shared(mul_first, "HSigmoidWithClampFusion"); + auto m = std::make_shared(mul_first, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/hswish_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/hswish_fusion.cpp index e64909bb594..0bb0815eaf5 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/hswish_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/hswish_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/hswish_fusion.hpp" #include "transformations/utils/utils.hpp" @@ -16,6 +17,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::HSwishFusion, "HSwishFusion", 0); NGRAPH_RTTI_DEFINITION(ngraph::pass::HSwishFusionWithReluDiv, "HSwishFusionWithReluDiv", 0); ngraph::pass::HSwishFusionWithReluDiv::HSwishFusionWithReluDiv() { + MATCHER_SCOPE(HSwishFusionWithReluDiv); // Replaces a sub-graph (x * (min(Relu(x + 3), 6)) / 6 with a HSwish op. auto input = ngraph::pattern::any_input(); auto add_constant = ngraph::pattern::wrap_type(); @@ -60,13 +62,14 @@ ngraph::pass::HSwishFusionWithReluDiv::HSwishFusionWithReluDiv() { return true; }; - auto m = std::make_shared(div, "HSwishWithReluDivFusion"); + auto m = std::make_shared(div, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::HSwishFusionWithReluMul, "HSwishFusionWithReluMul", 0); ngraph::pass::HSwishFusionWithReluMul::HSwishFusionWithReluMul() { + MATCHER_SCOPE(HSwishFusionWithReluMul); // Replaces a sub-graph (x * (min(Relu(x + 3), 6)) * const(1/6) with a HSwish op. auto input = ngraph::pattern::any_input(); auto add_constant = ngraph::pattern::wrap_type(); @@ -111,13 +114,14 @@ ngraph::pass::HSwishFusionWithReluMul::HSwishFusionWithReluMul() { return true; }; - auto m = std::make_shared(mul_second, "HSwishWithReluMulFusion"); + auto m = std::make_shared(mul_second, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::HSwishFusionWithoutRelu, "HSwishFusionWithoutRelu", 0); ngraph::pass::HSwishFusionWithoutRelu::HSwishFusionWithoutRelu() { + MATCHER_SCOPE(HSwishFusionWithoutRelu); // Replaces a sub-graph x * (min(max(x + 3, 0), 6) / 6) with a HSwish op. auto input = ngraph::pattern::any_input(); auto add_constant = ngraph::pattern::wrap_type(); @@ -166,13 +170,14 @@ ngraph::pass::HSwishFusionWithoutRelu::HSwishFusionWithoutRelu() { return true; }; - auto m = std::make_shared(mul, "HSwishWithoutReluFusion"); + auto m = std::make_shared(mul, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::HSwishFusionWithClamp, "HSwishFusionWithClamp", 0); ngraph::pass::HSwishFusionWithClamp::HSwishFusionWithClamp() { + MATCHER_SCOPE(HSwishFusionWithClamp); // Replaces a sub-graph x * (Clamp(x + 3, 0, 6) * const(1/6)) with a HSwish op. auto input = ngraph::pattern::any_input(); auto add_constant = ngraph::pattern::wrap_type(); @@ -211,6 +216,6 @@ ngraph::pass::HSwishFusionWithClamp::HSwishFusionWithClamp() { return true; }; - auto m = std::make_shared(mul_second, "HSwishWithClampFusion"); + auto m = std::make_shared(mul_second, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/lin_op_sequence_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/lin_op_sequence_fusion.cpp index 1f2279ddaad..8b2538bd906 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/lin_op_sequence_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/lin_op_sequence_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/lin_op_sequence_fusion.hpp" #include @@ -31,6 +32,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::LinOpSequenceFusion, "LinOpSequenceFusion", NGRAPH_RTTI_DEFINITION(ngraph::pass::AddMultiplyFusion, "AddMultiplyFusion", 0); ngraph::pass::AddMultiplyFusion::AddMultiplyFusion() { + MATCHER_SCOPE(AddMultiplyFusion); // Create Add->Multiply pattern where Add has exactly one consumer auto m_data = ngraph::pattern::any_input(); auto m_add_constant = ngraph::pattern::wrap_type(); @@ -70,13 +72,14 @@ ngraph::pass::AddMultiplyFusion::AddMultiplyFusion() { return true; }; - auto m = std::make_shared(m_mul, "AddMultiplyFusion"); + auto m = std::make_shared(m_mul, matcher_name); this->register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::AddAddFusion, "AddAddFusion", 0); ngraph::pass::AddAddFusion::AddAddFusion() { + MATCHER_SCOPE(AddAddFusion); // Create Add->Add pattern where first Add has exactly one consumer auto m_data = ngraph::pattern::any_input(); auto m_add1_constant = ngraph::pattern::wrap_type(); @@ -104,13 +107,14 @@ ngraph::pass::AddAddFusion::AddAddFusion() { return true; }; - auto m = std::make_shared(m_add2, "AddAddFusion"); + auto m = std::make_shared(m_add2, matcher_name); this->register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::MultiplyMultiplyFusion, "MultiplyMultiplyFusion", 0); ngraph::pass::MultiplyMultiplyFusion::MultiplyMultiplyFusion() { + MATCHER_SCOPE(MultiplyMultiplyFusion); // Create Multiply->Multiply pattern where first Multiply has exactly one consumer auto m_data = ngraph::pattern::any_input(); auto m_mul1_constant = ngraph::pattern::wrap_type(); @@ -138,6 +142,6 @@ ngraph::pass::MultiplyMultiplyFusion::MultiplyMultiplyFusion() { return true; }; - auto m = std::make_shared(m_mul2, "MultiplyMultiplyFusion"); + auto m = std::make_shared(m_mul2, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/mish_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/mish_fusion.cpp index bf395d76100..da1b8ab9243 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/mish_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/mish_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/mish_fusion.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::MishFusion, "MishFusion", 0); ngraph::pass::MishFusion::MishFusion() { + MATCHER_SCOPE(MishFusion); auto input = ngraph::pattern::any_input(); auto exp = std::make_shared(input); auto add = std::make_shared(exp, ngraph::pattern::wrap_type()); @@ -37,6 +39,6 @@ ngraph::pass::MishFusion::MishFusion() { return true; }; - auto m = std::make_shared(mul, "MishFusion"); + auto m = std::make_shared(mul, matcher_name); register_matcher(m, matcher_pass_callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp index 3ff7f1e0423..af9386e9cde 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp @@ -14,6 +14,7 @@ // limitations under the License. //***************************************************************************** +#include "itt.hpp" #include #include #include @@ -329,6 +330,7 @@ static bool eliminate_squeeze(const std::shared_ptr& node) { NGRAPH_RTTI_DEFINITION(ngraph::pass::NopElimination, "NopElimination", 0); bool pass::NopElimination::run_on_function(std::shared_ptr function) { + RUN_ON_FUNCTION_SCOPE(NopElimination); static const std::unordered_map&)>> dispatcher{{TI(opset3::Pad), &eliminate_nop}, {TI(opset3::Convert), &eliminate_convert}, diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/normalize_l2_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/normalize_l2_fusion.cpp index e701645bc74..2b2523cf6bc 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/normalize_l2_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/normalize_l2_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/normalize_l2_fusion.hpp" #include "transformations/utils/utils.hpp" @@ -17,6 +18,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::NormalizeL2Fusion, "NormalizeL2Fusion", 0); NGRAPH_RTTI_DEFINITION(ngraph::pass::NormalizeL2FusionWithMax, "NormalizeL2FusionWithMax", 0); ngraph::pass::NormalizeL2FusionWithMax::NormalizeL2FusionWithMax() { + MATCHER_SCOPE(NormalizeL2FusionWithMax); auto input = ngraph::pattern::any_input(); auto exp = ngraph::pattern::wrap_type(); @@ -63,13 +65,14 @@ ngraph::pass::NormalizeL2FusionWithMax::NormalizeL2FusionWithMax() { return true; }; - auto m = std::make_shared(divide, "NormalizeL2FusionWithMax"); + auto m = std::make_shared(divide, matcher_name); register_matcher(m, matcher_pass_callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::NormalizeL2FusionWithAdd, "NormalizeL2FusionWithAdd", 0); ngraph::pass::NormalizeL2FusionWithAdd::NormalizeL2FusionWithAdd() { + MATCHER_SCOPE(NormalizeL2FusionWithAdd); auto input = ngraph::pattern::any_input(); auto exp = ngraph::pattern::wrap_type(); @@ -116,6 +119,6 @@ ngraph::pass::NormalizeL2FusionWithAdd::NormalizeL2FusionWithAdd() { return true; }; - auto m = std::make_shared(divide, "NormalizeL2FusionWithMax"); + auto m = std::make_shared(divide, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp index 9c335cdc925..55521f4f586 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp @@ -5,6 +5,7 @@ #include #include +#include "itt.hpp" #include #include #include @@ -15,6 +16,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::StridedSliceOptimization, "StridedSliceOpti NGRAPH_RTTI_DEFINITION(ngraph::pass::UselessStridedSliceEraser, "UselessStridedSliceEraser", 0); bool ngraph::pass::UselessStridedSliceEraser::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(UselessStridedSliceEraser); bool rewritten = false; for (auto & node : f->get_ordered_ops()) { // Recursively apply transformation for sub-graph based operations @@ -89,6 +91,7 @@ bool strided_slices_perform_the_same(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(SharedStridedSliceEraser); bool graph_rewritten = false; std::map, std::vector>> source_to_ss; @@ -120,6 +123,7 @@ bool ngraph::pass::SharedStridedSliceEraser::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(GroupedStridedSliceOptimizer); bool graph_rewritten = false; using planned_slice = std::pair, ngraph::SlicePlan>; @@ -232,6 +236,7 @@ bool ngraph::pass::GroupedStridedSliceOptimizer::run_on_function(std::shared_ptr } bool ngraph::pass::StridedSliceOptimization::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(StridedSliceOptimization); bool rewritten = UselessStridedSliceEraser().run_on_function(f); rewritten |= SharedStridedSliceEraser().run_on_function(f); rewritten |= GroupedStridedSliceOptimizer().run_on_function(f); diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/pull_transpose_through_fq.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/pull_transpose_through_fq.cpp index c09d88a6b44..d879518d547 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/pull_transpose_through_fq.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/pull_transpose_through_fq.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/pull_transpose_through_fq.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::PullTransposeThroughFQUp, "PullTransposeThroughFQUp", 0); ngraph::pass::PullTransposeThroughFQUp::PullTransposeThroughFQUp() { + MATCHER_SCOPE(PullTransposeThroughFQUp); auto m_fq = pattern::wrap_type({pattern::any_input(pattern::has_static_rank()), pattern::any_input(pattern::has_static_rank()), pattern::any_input(pattern::has_static_rank()), @@ -57,6 +59,6 @@ ngraph::pass::PullTransposeThroughFQUp::PullTransposeThroughFQUp() { return true; }; - auto m = std::make_shared(m_transpose, "PullTransposeThroughFQUp"); + auto m = std::make_shared(m_transpose, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp index 8edac8f654c..5c59ddd9d1c 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include #include @@ -13,6 +14,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::RemoveFilteringBoxesBySize, "RemoveFilteringBoxesBySize", 0); ngraph::pass::RemoveFilteringBoxesBySize::RemoveFilteringBoxesBySize() { + MATCHER_SCOPE(RemoveFilteringBoxesBySize); // variadic split auto data = std::make_shared(element::f32, Shape{1000, 4}); auto sizes = opset3::Constant::create(element::i64, Shape{4}, std::vector({1, 1, 1, 1})); @@ -103,6 +105,6 @@ ngraph::pass::RemoveFilteringBoxesBySize::RemoveFilteringBoxesBySize() { return true; }; - auto m = std::make_shared(cast, "RemoveFilteringBoxesBySize"); + auto m = std::make_shared(cast, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_fusion.cpp index bd57b0a84d7..6c3d3d0bde6 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/softplus_fusion.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::SoftPlusFusion, "SoftPlusFusion", 0); ngraph::pass::SoftPlusFusion::SoftPlusFusion() { + MATCHER_SCOPE(SoftPlusFusion); // fuses ln(exp(x) + 1.0) operations into SoftPlus(x) auto input = ngraph::pattern::any_input(); auto exp = std::make_shared(input); @@ -50,6 +52,6 @@ ngraph::pass::SoftPlusFusion::SoftPlusFusion() { return true; }; - auto m = std::make_shared(log, "SoftPlusFusion"); + auto m = std::make_shared(log, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_to_mish_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_to_mish_fusion.cpp index 798da885021..438f047de7b 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_to_mish_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_to_mish_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/softplus_to_mish_fusion.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::SoftPlusToMishFusion, "SoftPlusToMishFusion", 0); ngraph::pass::SoftPlusToMishFusion::SoftPlusToMishFusion() { + MATCHER_SCOPE(SoftPlusToMishFusion); auto input = ngraph::pattern::any_input(); auto softplus = ngraph::pattern::wrap_type({input}, pattern::consumers_count(1)); auto tanh = ngraph::pattern::wrap_type({softplus}, pattern::consumers_count(1)); @@ -33,6 +35,6 @@ ngraph::pass::SoftPlusToMishFusion::SoftPlusToMishFusion() { return true; }; - auto m = std::make_shared(mul, "SoftPlusToMishFusion"); + auto m = std::make_shared(mul, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/swish_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/swish_fusion.cpp index 0125665f68e..eaed5b6e81e 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/swish_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/swish_fusion.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/common_optimizations/swish_fusion.hpp" #include @@ -32,6 +33,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::SwishFusion, "SwishFusion", 0); NGRAPH_RTTI_DEFINITION(ngraph::pass::SwishFusionWithSigmoid, "SwishFusionWithSigmoid", 0); ngraph::pass::SwishFusionWithSigmoid::SwishFusionWithSigmoid() { + MATCHER_SCOPE(SwishFusionWithSigmoid); // replaces a sub-graphs x * Sigmoid(x) with a Swish op. auto input = ngraph::pattern::any_input(); auto sigmoid = std::make_shared(input); @@ -51,13 +53,14 @@ ngraph::pass::SwishFusionWithSigmoid::SwishFusionWithSigmoid() { return true; }; - auto m = std::make_shared(mul, "SwishWithSigmoidFusion"); + auto m = std::make_shared(mul, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::SwishFusionWithSigmoidWithBeta, "SwishFusionWithSigmoidWithBeta", 0); ngraph::pass::SwishFusionWithSigmoidWithBeta::SwishFusionWithSigmoidWithBeta() { + MATCHER_SCOPE(SwishFusionWithSigmoidWithBeta); // replaces a sub-graphs x * Sigmoid(x * beta) with a Swish op. auto input = ngraph::pattern::any_input(); auto beta = ngraph::pattern::any_input(); @@ -96,13 +99,14 @@ ngraph::pass::SwishFusionWithSigmoidWithBeta::SwishFusionWithSigmoidWithBeta() { return true; }; - auto m = std::make_shared(mul, "SwishWithSigmoidWithBetaFusion"); + auto m = std::make_shared(mul, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::SwishFusionWithBeta, "SwishFusionWithBeta", 0); ngraph::pass::SwishFusionWithBeta::SwishFusionWithBeta() { + MATCHER_SCOPE(SwishFusionWithBeta); // replaces a sub-graphs x / (1.0 + exp(-x * beta)) with a Swish op. auto input = ngraph::pattern::any_input(); auto beta = ngraph::pattern::any_input(); @@ -137,13 +141,14 @@ ngraph::pass::SwishFusionWithBeta::SwishFusionWithBeta() { return true; }; - auto m = std::make_shared(div, "SwishWithBetaFusion"); + auto m = std::make_shared(div, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::SwishFusionWithoutBeta, "SwishFusionWithoutBeta", 0); ngraph::pass::SwishFusionWithoutBeta::SwishFusionWithoutBeta() { + MATCHER_SCOPE(SwishFusionWithoutBeta); // replaces a sub-graphs x / (1.0 + exp(-x)) with a Swish op. auto input = ngraph::pattern::any_input(); auto neg = std::make_shared(input); @@ -174,6 +179,6 @@ ngraph::pass::SwishFusionWithoutBeta::SwishFusionWithoutBeta() { return true; }; - auto m = std::make_shared(div, "SwishWithoutBetaFusion"); + auto m = std::make_shared(div, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp b/inference-engine/src/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp index 40b062981b5..f7a54157e5f 100644 --- a/inference-engine/src/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp +++ b/inference-engine/src/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/control_flow/unroll_tensor_iterator.hpp" #include "transformations/utils/utils.hpp" @@ -16,6 +17,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::UnrollTensorIterator, "UnrollTensorIterator", 0); bool ngraph::pass::UnrollTensorIterator::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(UnrollTensorIterator); for (const auto& op : f->get_ops()) { auto ti = std::dynamic_pointer_cast(op); if (!ti || transformation_callback(ti)) { diff --git a/inference-engine/src/transformations/src/transformations/convert_precision.cpp b/inference-engine/src/transformations/src/transformations/convert_precision.cpp index fb1a04bcafb..37e603895f1 100644 --- a/inference-engine/src/transformations/src/transformations/convert_precision.cpp +++ b/inference-engine/src/transformations/src/transformations/convert_precision.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/convert_precision.hpp" #include @@ -77,6 +78,7 @@ bool fuse_type_to_reduce_logical(std::shared_ptr & node, ngraph::e NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertPrecision, "ConvertPrecision", 0); bool ngraph::pass::ConvertPrecision::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(ConvertPrecision); static std::map&, element::Type, size_t idx)>> type_to_fuse { {opset4::Parameter::type_info, fuse_type_to_parameter}, {opset4::Convert::type_info, fuse_type_to_convert}, diff --git a/inference-engine/src/transformations/src/transformations/init_node_info.cpp b/inference-engine/src/transformations/src/transformations/init_node_info.cpp index 7eed233b7ab..826cf52d0c5 100644 --- a/inference-engine/src/transformations/src/transformations/init_node_info.cpp +++ b/inference-engine/src/transformations/src/transformations/init_node_info.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/init_node_info.hpp" #include "transformations/rt_info/fused_names_attribute.hpp" #include "transformations/rt_info/primitives_priority_attribute.hpp" @@ -16,6 +17,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::InitNodeInfo, "InitNodeInfo", 0); bool ngraph::pass::InitNodeInfo::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(InitNodeInfo); std::vector > attributes { std::make_shared >(FusedNames()) }; diff --git a/inference-engine/src/transformations/src/transformations/itt.hpp b/inference-engine/src/transformations/src/transformations/itt.hpp deleted file mode 100644 index 994d93e5384..00000000000 --- a/inference-engine/src/transformations/src/transformations/itt.hpp +++ /dev/null @@ -1,35 +0,0 @@ -//***************************************************************************** -// Copyright 2017-2020 Intel Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//***************************************************************************** - -/** - * @brief Defines openvino domains for tracing - * @file itt.hpp - */ - -#pragma once - -#include - -namespace ngraph { -namespace pass { -namespace itt { -namespace domains { - OV_ITT_DOMAIN(IETransform); - OV_ITT_DOMAIN(nGraphPass_LT); -} // namespace domains -} // namespace itt -} // namespace pass -} // namespace ngraph diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/batch_norm_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/batch_norm_decomposition.cpp index b4bd2a9e39e..8907487b8b6 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/batch_norm_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/batch_norm_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/batch_norm_decomposition.hpp" #include @@ -17,6 +18,7 @@ using namespace ngraph; NGRAPH_RTTI_DEFINITION(ngraph::pass::BatchNormDecomposition, "BatchNormDecomposition", 0); ngraph::pass::BatchNormDecomposition::BatchNormDecomposition() { + MATCHER_SCOPE(BatchNormDecomposition); auto bn = pattern::wrap_type({ pattern::any_input(pattern::has_static_rank()), pattern::any_input(pattern::has_static_shape()), @@ -73,7 +75,7 @@ ngraph::pass::BatchNormDecomposition::BatchNormDecomposition() { return true; }; - auto m = std::make_shared(bn, "BatchNormDecomposition"); + auto m = std::make_shared(bn, matcher_name); this->register_matcher(m, callback); } @@ -81,6 +83,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::BatchNormV5Decomposition, "BatchNormDecompo // TODO: this pass will be unified with BatchNormDecomposition pass ngraph::pass::BatchNormV5Decomposition::BatchNormV5Decomposition() { + MATCHER_SCOPE(BatchNormV5Decomposition); auto bn = pattern::wrap_type({ pattern::any_input(pattern::has_static_rank()), pattern::any_input(pattern::has_static_shape()), @@ -137,6 +140,6 @@ ngraph::pass::BatchNormV5Decomposition::BatchNormV5Decomposition() { return true; }; - auto m = std::make_shared(bn, "BatchNormDecomposition"); + auto m = std::make_shared(bn, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp index 69582760b03..39886cfe9b4 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/bidirectional_sequences_decomposition.hpp" #include @@ -16,6 +17,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::BidirectionalGRUSequenceDecomposition, "Bid NGRAPH_RTTI_DEFINITION(ngraph::pass::BidirectionalRNNSequenceDecomposition, "BidirectionalRNNSequenceDecomposition", 0); ngraph::pass::BidirectionalLSTMSequenceDecomposition::BidirectionalLSTMSequenceDecomposition() { + MATCHER_SCOPE(BidirectionalLSTMSequenceDecomposition); auto lstm_sequence_ngraph = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher &m) { @@ -79,11 +81,12 @@ ngraph::pass::BidirectionalLSTMSequenceDecomposition::BidirectionalLSTMSequenceD return true; }; - auto m = std::make_shared(lstm_sequence_ngraph, "BidirectionalLSTMSequenceDecomposition"); + auto m = std::make_shared(lstm_sequence_ngraph, matcher_name); this->register_matcher(m, callback); } ngraph::pass::BidirectionalGRUSequenceDecomposition::BidirectionalGRUSequenceDecomposition() { + MATCHER_SCOPE(BidirectionalGRUSequenceDecomposition); auto gru_sequence_ngraph = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher &m) { @@ -143,11 +146,12 @@ ngraph::pass::BidirectionalGRUSequenceDecomposition::BidirectionalGRUSequenceDec return true; }; - auto m = std::make_shared(gru_sequence_ngraph, "BidirectionalGRUSequenceDecomposition"); + auto m = std::make_shared(gru_sequence_ngraph, matcher_name); this->register_matcher(m, callback); } ngraph::pass::BidirectionalRNNSequenceDecomposition::BidirectionalRNNSequenceDecomposition() { + MATCHER_SCOPE(BidirectionalRNNSequenceDecomposition); auto rnn_sequence_ngraph = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher &m) { @@ -205,6 +209,6 @@ ngraph::pass::BidirectionalRNNSequenceDecomposition::BidirectionalRNNSequenceDec return true; }; - auto m = std::make_shared(rnn_sequence_ngraph, "BidirectionalRNNSequenceDecomposition"); + auto m = std::make_shared(rnn_sequence_ngraph, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp index 164c8476497..4e349e19a99 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_batch_to_space.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertBatchToSpace, "ConvertBatchToSpace", 0); void ngraph::pass::ConvertBatchToSpace::convert_batch_to_space() { + MATCHER_SCOPE(ConvertBatchToSpace_convert_batch_to_space); auto batch_to_space = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { auto batch_to_space = std::dynamic_pointer_cast (m.get_match_root()); @@ -121,11 +123,12 @@ void ngraph::pass::ConvertBatchToSpace::convert_batch_to_space() { return true; }; - auto m = std::make_shared(batch_to_space, "ConvertBatchToSpace"); + auto m = std::make_shared(batch_to_space, matcher_name); this->register_matcher(m, callback); } void ngraph::pass::ConvertBatchToSpace::convert_batch_to_space_by_elements() { + MATCHER_SCOPE(ConvertBatchToSpace_convert_batch_to_space_by_elements); auto batch_to_space = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { auto batch_to_space = std::dynamic_pointer_cast (m.get_match_root()); @@ -220,6 +223,6 @@ void ngraph::pass::ConvertBatchToSpace::convert_batch_to_space_by_elements() { return true; }; - auto m = std::make_shared(batch_to_space, "ConvertBatchToSpace"); + auto m = std::make_shared(batch_to_space, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast3.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast3.cpp index f3c49b32e84..81007ac2a54 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast3.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast3.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_broadcast3.hpp" #include @@ -55,6 +56,7 @@ bool make_compatible_shape(const ngraph::PartialShape & input_shape, std::vector } ngraph::pass::ConvertBroadcast3::ConvertBroadcast3() { + MATCHER_SCOPE(ConvertBroadcast3); auto broadcast = pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -106,6 +108,6 @@ ngraph::pass::ConvertBroadcast3::ConvertBroadcast3() { return true; }; - auto m = std::make_shared(broadcast, "ConvertBroadcast3"); + auto m = std::make_shared(broadcast, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast_to_tiles.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast_to_tiles.cpp index b736106057e..e9a382bbd27 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast_to_tiles.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast_to_tiles.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_broadcast_to_tiles.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertBroadcastToTiles, "ConvertBroadcastToTiles", 0); ngraph::pass::ConvertBroadcastToTiles::ConvertBroadcastToTiles() { + MATCHER_SCOPE(ConvertBroadcastToTiles); auto broadcast = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { @@ -96,6 +98,6 @@ ngraph::pass::ConvertBroadcastToTiles::ConvertBroadcastToTiles() { return true; }; - auto m = std::make_shared(broadcast, "ConvertBroadcastToTile"); + auto m = std::make_shared(broadcast, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp index 131f3f95578..be4763cc11c 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_convolutions.hpp" #include @@ -19,6 +20,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertConvolutions, "ConvertConvolutions", NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertConvolution, "ConvertConvolution", 0); ngraph::pass::ConvertConvolution::ConvertConvolution() { + MATCHER_SCOPE(ConvertConvolution); auto conv = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -42,13 +44,14 @@ ngraph::pass::ConvertConvolution::ConvertConvolution() { return true; }; - auto m = std::make_shared(conv, "ConvertConvolution"); + auto m = std::make_shared(conv, matcher_name); this->register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertGroupConvolution, "ConvertGroupConvolution", 0); ngraph::pass::ConvertGroupConvolution::ConvertGroupConvolution() { + MATCHER_SCOPE(ConvertGroupConvolution); auto gconv = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -88,13 +91,14 @@ ngraph::pass::ConvertGroupConvolution::ConvertGroupConvolution() { return true; }; - auto m = std::make_shared(gconv, "ConvertGroupConvolution"); + auto m = std::make_shared(gconv, matcher_name); this->register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertDeconvolution, "ConvertDeconvolution", 0); ngraph::pass::ConvertDeconvolution::ConvertDeconvolution() { + MATCHER_SCOPE(ConvertDeconvolution); auto conv = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -120,13 +124,14 @@ ngraph::pass::ConvertDeconvolution::ConvertDeconvolution() { return true; }; - auto m = std::make_shared(conv, "ConvertConvolutionBackpropData"); + auto m = std::make_shared(conv, matcher_name); this->register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertGroupDeconvolution, "ConvertGroupDeconvolution", 0); ngraph::pass::ConvertGroupDeconvolution::ConvertGroupDeconvolution() { + MATCHER_SCOPE(ConvertGroupDeconvolution); auto gconv = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -164,6 +169,6 @@ ngraph::pass::ConvertGroupDeconvolution::ConvertGroupDeconvolution() { return true; }; - auto m = std::make_shared(gconv, "ConvertGroupConvolutionBackpropData"); + auto m = std::make_shared(gconv, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_depth_to_space.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_depth_to_space.cpp index e2e313bc9d1..b0c7e424aa8 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_depth_to_space.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_depth_to_space.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_depth_to_space.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertDepthToSpace, "ConvertDepthToSpace", 0); ngraph::pass::ConvertDepthToSpace::ConvertDepthToSpace() { + MATCHER_SCOPE(ConvertDepthToSpace); auto dts_node = ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape())}); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { @@ -100,6 +102,6 @@ ngraph::pass::ConvertDepthToSpace::ConvertDepthToSpace() { return true; }; - auto m = std::make_shared(dts_node, "ConvertDepthToSpace"); + auto m = std::make_shared(dts_node, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp index 10a8ab1b178..d40a992d4a9 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_divide.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertDivide, "ConvertDivide", 0); ngraph::pass::ConvertDivide::ConvertDivide() { + MATCHER_SCOPE(ConvertDivide); auto div = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -34,6 +36,6 @@ ngraph::pass::ConvertDivide::ConvertDivide() { return true; }; - auto m = std::make_shared(div, "ConvertDivide"); + auto m = std::make_shared(div, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_0d.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_0d.cpp index e3235a4ff5d..d240f506d24 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_0d.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_0d.cpp @@ -4,6 +4,8 @@ #include "transformations/op_conversions/convert_gather_0d.hpp" +#include "itt.hpp" + #include #include @@ -14,6 +16,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertGather0D, "ConvertGather0D", 0); ngraph::pass::ConvertGather0D::ConvertGather0D() { + MATCHER_SCOPE(ConvertGather0D); auto gather = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher &m) { @@ -47,6 +50,6 @@ ngraph::pass::ConvertGather0D::ConvertGather0D() { return true; }; - auto m1 = std::make_shared(gather, "ConvertGather0D"); + auto m1 = std::make_shared(gather, matcher_name); this->register_matcher(m1, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_gelu.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_gelu.cpp index a2e3483ef2a..2ee04f4f654 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_gelu.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_gelu.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include #include #include @@ -13,6 +14,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertGELU, "ConvertGELU", 0); ngraph::pass::ConvertGELU::ConvertGELU() { + MATCHER_SCOPE(ConvertGELU); auto input = std::make_shared(element::f32, Shape{}); auto gelu = std::make_shared(input); @@ -37,6 +39,6 @@ ngraph::pass::ConvertGELU::ConvertGELU() { return true; }; - auto m = std::make_shared(gelu, "ConvertGELU"); + auto m = std::make_shared(gelu, matcher_name); register_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_interpolate1_to_interpolate4.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_interpolate1_to_interpolate4.cpp index 52e2fa5ec12..d43d20e400b 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_interpolate1_to_interpolate4.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_interpolate1_to_interpolate4.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_interpolate1_to_interpolate4.hpp" #include @@ -15,6 +16,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertInterpolate1ToInterpolate4, "ConvertInterpolate1ToInterpolate4", 0); ngraph::pass::ConvertInterpolate1ToInterpolate4::ConvertInterpolate1ToInterpolate4() { + MATCHER_SCOPE(ConvertInterpolate1ToInterpolate4); auto interpolate1 = ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_rank()), pattern::any_input()}); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { auto interpolate1 = std::dynamic_pointer_cast(m.get_match_root()); @@ -64,6 +66,6 @@ ngraph::pass::ConvertInterpolate1ToInterpolate4::ConvertInterpolate1ToInterpolat return true; }; - auto m = std::make_shared(interpolate1, "ConvertInterpolate1ToInterpolate4"); + auto m = std::make_shared(interpolate1, matcher_name); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp index bc585f6fdac..8ebc442968a 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_minimum_to_power_and_max.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertMinimum, "ConvertMinimum", 0); ngraph::pass::ConvertMinimum::ConvertMinimum() { + MATCHER_SCOPE(ConvertMinimum); auto minimum = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { @@ -43,6 +45,6 @@ ngraph::pass::ConvertMinimum::ConvertMinimum() { return true; }; - auto m = std::make_shared(minimum, "ConvertMinimum"); + auto m = std::make_shared(minimum, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp index e85f2a6ac93..ef6327c9cd9 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_mod.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertMod, "ConvertMod", 0); ngraph::pass::ConvertMod::ConvertMod() { + MATCHER_SCOPE(ConvertMod); auto mod = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { @@ -45,6 +47,6 @@ ngraph::pass::ConvertMod::ConvertMod() { return true; }; - auto m = std::make_shared(mod, "ConvertMod"); + auto m = std::make_shared(mod, matcher_name); this->register_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_mvn1_to_mvn6.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_mvn1_to_mvn6.cpp index 97730ff48c0..3093f807533 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_mvn1_to_mvn6.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_mvn1_to_mvn6.cpp @@ -12,9 +12,12 @@ #include #include +#include "itt.hpp" + NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertMVN1ToMVN6, "ConvertMVN1ToMVN6", 0); ngraph::pass::ConvertMVN1ToMVN6::ConvertMVN1ToMVN6() { + MATCHER_SCOPE(ConvertMVN1ToMVN6); auto mvn = pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -47,6 +50,6 @@ ngraph::pass::ConvertMVN1ToMVN6::ConvertMVN1ToMVN6() { return true; }; - auto m = std::make_shared(mvn, "ConvertMVN1ToMVN6"); + auto m = std::make_shared(mvn, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp index 13592ea7ec1..c3c4c3861c0 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_negative.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertNegative, "ConvertNegative", 0); ngraph::pass::ConvertNegative::ConvertNegative() { + MATCHER_SCOPE(ConvertNegative); auto neg = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -30,6 +32,6 @@ ngraph::pass::ConvertNegative::ConvertNegative() { return true; }; - auto m = std::make_shared(neg, "ConvertNegative"); + auto m = std::make_shared(neg, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp index 3f39f2079bf..b46a415ab85 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include #include @@ -17,6 +18,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertNMSToNMSIEInternal, "ConvertNMSToNMSIEInternal", 0); ngraph::pass::ConvertNMSToNMSIEInternal::ConvertNMSToNMSIEInternal() { + MATCHER_SCOPE(ConvertNMSToNMSIEInternal); auto nms = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher &m) { @@ -118,6 +120,6 @@ ngraph::pass::ConvertNMSToNMSIEInternal::ConvertNMSToNMSIEInternal() { return true; }; - auto m = std::make_shared(nms, "ConvertNMSToNMSIEInternal"); + auto m = std::make_shared(nms, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_pad_to_group_conv.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_pad_to_group_conv.cpp index 911bbb89f2f..89a67845964 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_pad_to_group_conv.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_pad_to_group_conv.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_pad_to_group_conv.hpp" #include @@ -15,6 +16,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertPadToGroupConvolution, "ConvertPadToGroupConvolution", 0); ngraph::pass::ConvertPadToGroupConvolution::ConvertPadToGroupConvolution() { + MATCHER_SCOPE(ConvertPadToGroupConvolution); auto neg = ngraph::pattern::wrap_type(pattern::has_static_dim(1)); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { @@ -80,6 +82,6 @@ ngraph::pass::ConvertPadToGroupConvolution::ConvertPadToGroupConvolution() { return true; }; - auto m = std::make_shared(neg, "ConvertPadToGroupConvolution"); + auto m = std::make_shared(neg, matcher_name); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp index 974ec8403d2..ee92fa6fe51 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_previous_nms_to_nms_5.hpp" #include @@ -161,35 +162,38 @@ struct NMSAttributes { NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertNMS4ToNMS5, "ConvertNMS4ToNMS5", 0); ngraph::pass::ConvertNMS4ToNMS5::ConvertNMS4ToNMS5() { + MATCHER_SCOPE(ConvertNMS4ToNMS5); auto nms = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { return callback_func(m, this); }; - auto m = std::make_shared(nms, "ConvertNMS4ToNMS5"); + auto m = std::make_shared(nms, matcher_name); this->register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertNMS3ToNMS5, "ConvertNMS3ToNMS5", 0); ngraph::pass::ConvertNMS3ToNMS5::ConvertNMS3ToNMS5() { + MATCHER_SCOPE(ConvertNMS3ToNMS5); auto nms = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { return callback_func(m, this); }; - auto m = std::make_shared(nms, "ConvertNMS3ToNMS5"); + auto m = std::make_shared(nms, matcher_name); this->register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertNMS1ToNMS5, "ConvertNMS1ToNMS5", 0); ngraph::pass::ConvertNMS1ToNMS5::ConvertNMS1ToNMS5() { + MATCHER_SCOPE(ConvertNMS1ToNMS5); auto nms = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { return callback_func(m, this); }; - auto m = std::make_shared(nms, "ConvertNMS1ToNMS5"); + auto m = std::make_shared(nms, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp index 5cc643d4a04..d25f156edea 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp @@ -2,9 +2,34 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_reduce_to_pooling.hpp" NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertReduceToPooling, "ConvertReduceToPooling", 0); NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertReduceMeanToPooling, "ConvertReduceMeanToPooling", 0); NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertReduceMaxToPooling, "ConvertReduceMaxToPooling", 0); NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertReduceSumToPooling, "ConvertReduceSumToPooling", 0); + +ngraph::pass::ConvertReduceMeanToPooling::ConvertReduceMeanToPooling() { + MATCHER_SCOPE(ConvertReduceMeanToPooling); + auto m = std::make_shared(ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), + pattern::wrap_type()}, + pattern::has_static_shape()), matcher_name); + register_matcher(m, convert_reduce_to_pooling()); +} +ngraph::pass::ConvertReduceMaxToPooling::ConvertReduceMaxToPooling() { + MATCHER_SCOPE(ConvertReduceMaxToPooling); + auto m = std::make_shared( + ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), + pattern::wrap_type()}, + pattern::has_static_shape()), matcher_name); + register_matcher(m, convert_reduce_to_pooling()); +} +ngraph::pass::ConvertReduceSumToPooling::ConvertReduceSumToPooling() { + MATCHER_SCOPE(ConvertReduceSumToPooling); + auto m = std::make_shared( + ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), + pattern::wrap_type()}, + pattern::has_static_shape()), matcher_name); + register_matcher(m, convert_reduce_to_pooling()); +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp index a2cf87e308e..43426f7437c 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_scatter_elements_to_scatter.hpp" #include @@ -15,6 +16,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertScatterElementsToScatter, "ConvertScatterElementsToScatter", 0); ngraph::pass::ConvertScatterElementsToScatter::ConvertScatterElementsToScatter() { + MATCHER_SCOPE(ConvertScatterElementsToScatter); auto data = std::make_shared(element::f32, Shape{1}); auto indices = std::make_shared(element::i64, Shape{1}); auto updates = std::make_shared(element::f32, Shape{1}); @@ -208,7 +210,7 @@ ngraph::pass::ConvertScatterElementsToScatter::ConvertScatterElementsToScatter() return true; }; - auto m = std::make_shared(scatter, "ConvertScatterElementsToScatter"); + auto m = std::make_shared(scatter, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_sequences_to_tensor_iterator.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_sequences_to_tensor_iterator.cpp index 5418c47c807..4319bfa2fa6 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_sequences_to_tensor_iterator.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_sequences_to_tensor_iterator.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2020 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "ngraph/builder/autobroadcast.hpp" #include "transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp" @@ -84,6 +85,7 @@ namespace { } // namespace ngraph::pass::ConvertRNNSequenceToTensorIterator::ConvertRNNSequenceToTensorIterator() { + MATCHER_SCOPE(ConvertRNNSequenceToTensorIterator); // X, H, seq_lengths - static, W,R,B - any auto rnn_seq = ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), pattern::any_input(pattern::has_static_shape()), @@ -237,11 +239,12 @@ ngraph::pass::ConvertRNNSequenceToTensorIterator::ConvertRNNSequenceToTensorIter return true; }; - auto m = std::make_shared(rnn_seq, "ConvertRNNSequenceToTensorIterator"); + auto m = std::make_shared(rnn_seq, matcher_name); register_matcher(m, callback); } ngraph::pass::ConvertGRUSequenceToTensorIterator::ConvertGRUSequenceToTensorIterator() { + MATCHER_SCOPE(ConvertGRUSequenceToTensorIterator); // X, H, seq_lengths - static, W,R,B - any auto rnn_seq = ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), pattern::any_input(pattern::has_static_shape()), @@ -395,11 +398,12 @@ ngraph::pass::ConvertGRUSequenceToTensorIterator::ConvertGRUSequenceToTensorIter return true; }; - auto m = std::make_shared(rnn_seq, "ConvertGRUSequenceToTensorIterator"); + auto m = std::make_shared(rnn_seq, matcher_name); register_matcher(m, callback); } ngraph::pass::ConvertLSTMSequenceToTensorIterator::ConvertLSTMSequenceToTensorIterator() { + MATCHER_SCOPE(ConvertLSTMSequenceToTensorIterator); // X, H, C, seq_lengths - static, W,R,B - any auto rnn_seq = ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), pattern::any_input(pattern::has_static_shape()), @@ -581,6 +585,6 @@ ngraph::pass::ConvertLSTMSequenceToTensorIterator::ConvertLSTMSequenceToTensorIt return true; }; - auto m = std::make_shared(rnn_seq, "ConvertLSTMSequenceToTensorIterator"); + auto m = std::make_shared(rnn_seq, matcher_name); register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp index 5b204a8d861..3857f367cb1 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_shapeof3.hpp" #include @@ -15,6 +16,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertShapeOf3, "ConvertShapeOf3", 0); ngraph::pass::ConvertShapeOf3::ConvertShapeOf3() { + MATCHER_SCOPE(ConvertShapeOf3); auto shapeof = pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -42,6 +44,6 @@ ngraph::pass::ConvertShapeOf3::ConvertShapeOf3() { return true; }; - auto m = std::make_shared(shapeof, "ConvertShapeOf3"); + auto m = std::make_shared(shapeof, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp index a515de6b88c..4b4d9f901fd 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_shuffle_channels3.hpp" #include @@ -16,6 +17,7 @@ using namespace ngraph; NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertShuffleChannels3, "ConvertShuffleChannels3", 0); ngraph::pass::ConvertShuffleChannels3::ConvertShuffleChannels3() { + MATCHER_SCOPE(ConvertShuffleChannels3); auto input = std::make_shared(element::f32, Shape{1, 1, 1, 1}); auto shuffle_channels = std::make_shared<::opset3::ShuffleChannels>(input); @@ -97,6 +99,6 @@ ngraph::pass::ConvertShuffleChannels3::ConvertShuffleChannels3() { return true; }; - auto m = std::make_shared(shuffle_channels, "ConvertShuffleChannels3"); + auto m = std::make_shared(shuffle_channels, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp index 7e52fa19105..5efd958c62b 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_space_to_batch.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertSpaceToBatch, "ConvertSpaceToBatch", 0); void ngraph::pass::ConvertSpaceToBatch::convert_space_to_batch() { + MATCHER_SCOPE(ConvertSpaceToBatch_convert_space_to_batch); auto space_to_batch = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { auto space_to_batch = std::dynamic_pointer_cast (m.get_match_root()); @@ -112,11 +114,12 @@ void ngraph::pass::ConvertSpaceToBatch::convert_space_to_batch() { return true; }; - auto m = std::make_shared(space_to_batch, "ConvertSpaceToBatch"); + auto m = std::make_shared(space_to_batch, matcher_name); this->register_matcher(m, callback); } void ngraph::pass::ConvertSpaceToBatch::convert_space_to_batch_by_elements() { + MATCHER_SCOPE(ConvertSpaceToBatch_convert_space_to_batch_by_elements); auto space_to_batch = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { auto space_to_batch = std::dynamic_pointer_cast (m.get_match_root()); @@ -203,7 +206,6 @@ void ngraph::pass::ConvertSpaceToBatch::convert_space_to_batch_by_elements() { return true; }; - auto m = std::make_shared(space_to_batch, "ConvertSpaceToBatch"); + auto m = std::make_shared(space_to_batch, matcher_name); this->register_matcher(m, callback); } - diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp index b386c8d97ed..ec8f098e0fc 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_space_to_depth.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertSpaceToDepth, "ConvertSpaceToDepth", 0); ngraph::pass::ConvertSpaceToDepth::ConvertSpaceToDepth() { + MATCHER_SCOPE(ConvertSpaceToDepth); auto dts = ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape())}); ngraph::matcher_pass_callback callback = [this](pattern::Matcher& m) { @@ -89,6 +91,6 @@ ngraph::pass::ConvertSpaceToDepth::ConvertSpaceToDepth() { return true; }; - auto m = std::make_shared(dts, "ConvertSpaceToDepth"); + auto m = std::make_shared(dts, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_subtract.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_subtract.cpp index c513abe73f2..a9d18261b5c 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_subtract.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_subtract.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_subtract.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertSubtract, "ConvertSubtract", 0); ngraph::pass::ConvertSubtract::ConvertSubtract() { + MATCHER_SCOPE(ConvertSubtract); auto sub = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -63,6 +65,6 @@ ngraph::pass::ConvertSubtract::ConvertSubtract() { return true; }; - auto m = std::make_shared(sub, "ConvertSubtract"); + auto m = std::make_shared(sub, matcher_name); this->register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp index 8168f18360d..c30123803b8 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_ti_to_sequences.hpp" #include "transformations/utils/utils.hpp" @@ -22,6 +23,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertTensorIteratorToRNNSequence, "Conver NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertTensorIteratorToGRUSequence, "ConvertTensorIteratorToGRUSequence", 0); ngraph::pass::ConvertTensorIteratorToLSTMSequence::ConvertTensorIteratorToLSTMSequence() { + MATCHER_SCOPE(ConvertTensorIteratorToLSTMSequence); auto tensor_iterator = std::make_shared(ngraph::element::f32, ngraph::Shape{}, ngraph::pattern::has_class()); ngraph::matcher_pass_callback callback = [this](pattern::Matcher &m) { @@ -191,11 +193,12 @@ ngraph::pass::ConvertTensorIteratorToLSTMSequence::ConvertTensorIteratorToLSTMSe return true; }; - auto m = std::make_shared(tensor_iterator, "ConvertTensorIteratorToLSTMSequence"); + auto m = std::make_shared(tensor_iterator, matcher_name); register_matcher(m, callback); } ngraph::pass::ConvertTensorIteratorToRNNSequence::ConvertTensorIteratorToRNNSequence() { + MATCHER_SCOPE(ConvertTensorIteratorToRNNSequence); auto tensor_iterator = std::make_shared(ngraph::element::f32, ngraph::Shape{}, ngraph::pattern::has_class()); ngraph::matcher_pass_callback callback = [this](pattern::Matcher &m) { @@ -344,11 +347,12 @@ ngraph::pass::ConvertTensorIteratorToRNNSequence::ConvertTensorIteratorToRNNSequ return true; }; - auto m = std::make_shared(tensor_iterator, "ConvertTensorIteratorToRNNSequence"); + auto m = std::make_shared(tensor_iterator, matcher_name); register_matcher(m, callback); } ngraph::pass::ConvertTensorIteratorToGRUSequence::ConvertTensorIteratorToGRUSequence() { + MATCHER_SCOPE(ConvertTensorIteratorToGRUSequence); auto tensor_iterator = std::make_shared(ngraph::element::f32, ngraph::Shape{}, ngraph::pattern::has_class()); ngraph::matcher_pass_callback callback = [this](pattern::Matcher &m) { @@ -498,6 +502,6 @@ ngraph::pass::ConvertTensorIteratorToGRUSequence::ConvertTensorIteratorToGRUSequ return true; }; - auto m = std::make_shared(tensor_iterator, "ConvertTensorIteratorToGRUSequence"); + auto m = std::make_shared(tensor_iterator, matcher_name); register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_topk3.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_topk3.cpp index 3916a23d6fd..29978378c94 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_topk3.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_topk3.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/convert_topk3.hpp" #include @@ -17,6 +18,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertTopK3, "ConvertTopK3", 0); ngraph::pass::ConvertTopK3::ConvertTopK3() { + MATCHER_SCOPE(ConvertTopK3); auto topk = pattern::wrap_type(); ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { @@ -61,6 +63,6 @@ ngraph::pass::ConvertTopK3::ConvertTopK3() { return true; }; - auto m = std::make_shared(topk, "ConvertTopK3"); + auto m = std::make_shared(topk, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/gru_cell_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/gru_cell_decomposition.cpp index cad85fa95d0..b31a7e63186 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/gru_cell_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/gru_cell_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/gru_cell_decomposition.hpp" #include @@ -15,6 +16,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::GRUCellDecomposition, "GRUCellDecomposition", 0); ngraph::pass::GRUCellDecomposition::GRUCellDecomposition() { + MATCHER_SCOPE(GRUCellDecomposition); auto gru_cell = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](ngraph::pattern::Matcher& m) { auto gru_cell = std::dynamic_pointer_cast (m.get_match_root()); @@ -101,6 +103,6 @@ ngraph::pass::GRUCellDecomposition::GRUCellDecomposition() { return true; }; - auto m = std::make_shared(gru_cell, "GRUCellDecomposition"); + auto m = std::make_shared(gru_cell, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp index 51481edc76d..caf764a6d6e 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/hsigmoid_decomposition.hpp" #include @@ -13,6 +14,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::HSigmoidDecomposition, "HSigmoidDecomposition", 0); ngraph::pass::HSigmoidDecomposition::HSigmoidDecomposition() { + MATCHER_SCOPE(HSigmoidDecomposition); // Decomposes HSigmoid(x) op into sub-graph (min(Relu(x + 3), 6) * const(1/6) auto hsigmoid = ngraph::pattern::wrap_type(); @@ -40,6 +42,6 @@ ngraph::pass::HSigmoidDecomposition::HSigmoidDecomposition() { return true; }; - auto m = std::make_shared(hsigmoid, "HSigmoidDecomposition"); + auto m = std::make_shared(hsigmoid, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/hswish_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/hswish_decomposition.cpp index 652c53c59f0..5ff41f85249 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/hswish_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/hswish_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/hswish_decomposition.hpp" #include @@ -13,6 +14,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::HSwishDecomposition, "HSwishDecomposition", 0); ngraph::pass::HSwishDecomposition::HSwishDecomposition() { + MATCHER_SCOPE(HSwishDecomposition); // Decomposes HSwish(x) op into sub-graph x * (min(Relu(x + 3), 6) * const(1/6) auto hswish = ngraph::pattern::wrap_type(); @@ -41,6 +43,6 @@ ngraph::pass::HSwishDecomposition::HSwishDecomposition() { return true; }; - auto m = std::make_shared(hswish, "HSwishDecomposition"); + auto m = std::make_shared(hswish, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/log_softmax_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/log_softmax_decomposition.cpp index c6d7d99c985..83f97393be4 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/log_softmax_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/log_softmax_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/log_softmax_decomposition.hpp" #include @@ -13,6 +14,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::LogSoftmaxDecomposition, "LogSoftmaxDecomposition", 0); ngraph::pass::LogSoftmaxDecomposition::LogSoftmaxDecomposition() { + MATCHER_SCOPE(LogSoftmaxDecomposition); // Decomposes LogSoftmax(x, axis) op into sub-graph x - log(reduce_sum(exp(x), axis)) auto log_softmax = ngraph::pattern::wrap_type(); @@ -39,6 +41,6 @@ ngraph::pass::LogSoftmaxDecomposition::LogSoftmaxDecomposition() { return true; }; - auto m = std::make_shared(log_softmax, "LogSoftmaxDecomposition"); + auto m = std::make_shared(log_softmax, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/lstm_cell_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/lstm_cell_decomposition.cpp index 8d597a10e0f..1f30d6662cf 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/lstm_cell_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/lstm_cell_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/lstm_cell_decomposition.hpp" #include @@ -16,6 +17,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::LSTMCellDecomposition, "LSTMCellDecomposition", 0); ngraph::pass::LSTMCellDecomposition::LSTMCellDecomposition() { + MATCHER_SCOPE(LSTMCellDecomposition); auto is_supported_lstm_cell = [](const std::shared_ptr& n) { return pattern::has_class()(n) || pattern::has_class()(n); }; @@ -86,6 +88,6 @@ ngraph::pass::LSTMCellDecomposition::LSTMCellDecomposition() { return true; }; - auto m = std::make_shared(any_lstm, "LSTMCellDecomposition"); + auto m = std::make_shared(any_lstm, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/mvn6_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/mvn6_decomposition.cpp index 89e23e7d461..bc5b0974f7c 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/mvn6_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/mvn6_decomposition.cpp @@ -9,10 +9,12 @@ #include #include #include +#include "itt.hpp" NGRAPH_RTTI_DEFINITION(ngraph::pass::MVN6Decomposition, "MVN6Decomposition", 0); ngraph::pass::MVN6Decomposition::MVN6Decomposition() { + MATCHER_SCOPE(MVN6Decomposition); // Decomposes MVN(x, axes) op if normalize_variance is false into sub-graph // x - ReduceMean(x, axes), if normalize_variance is true into sub-graph // (x - ReduceMean(x, axes)) / Sqrt(ReduceSum((x - ReduceMean(x, axes)) ^ 2)) @@ -67,6 +69,6 @@ ngraph::pass::MVN6Decomposition::MVN6Decomposition() { return true; }; - auto m = std::make_shared(mvn, "MVN6Decomposition"); + auto m = std::make_shared(mvn, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l1_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l1_decomposition.cpp index 9582bf43255..78e3ac1849b 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l1_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l1_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/reduce_l1_decomposition.hpp" #include @@ -13,6 +14,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ReduceL1Decomposition, "ReduceL1Decomposition", 0); ngraph::pass::ReduceL1Decomposition::ReduceL1Decomposition() { + MATCHER_SCOPE(ReduceL1Decomposition); // decomposes ReduceL1 operations into ReduceSum(abs(x)) auto reduce_l1 = ngraph::pattern::wrap_type(); @@ -34,7 +36,7 @@ ngraph::pass::ReduceL1Decomposition::ReduceL1Decomposition() { return true; }; - auto m = std::make_shared(reduce_l1, "ReduceL1Decomposition"); + auto m = std::make_shared(reduce_l1, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l2_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l2_decomposition.cpp index f0285e4d0f4..3f8671554a9 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l2_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l2_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/reduce_l2_decomposition.hpp" #include @@ -13,6 +14,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ReduceL2Decomposition, "ReduceL2Decomposition", 0); ngraph::pass::ReduceL2Decomposition::ReduceL2Decomposition() { + MATCHER_SCOPE(ReduceL2Decomposition); // decomposes ReduceL2 operations into sqrt(ReduceSum(x * x)) auto reduce_l2 = ngraph::pattern::wrap_type(); @@ -35,7 +37,7 @@ ngraph::pass::ReduceL2Decomposition::ReduceL2Decomposition() { return true; }; - auto m = std::make_shared(reduce_l2, "ReduceL2Decomposition"); + auto m = std::make_shared(reduce_l2, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/rnn_cell_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/rnn_cell_decomposition.cpp index 08a8a3ea8eb..b502abfd854 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/rnn_cell_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/rnn_cell_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/rnn_cell_decomposition.hpp" #include @@ -15,6 +16,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::RNNCellDecomposition, "RNNCellDecomposition", 0); ngraph::pass::RNNCellDecomposition::RNNCellDecomposition() { + MATCHER_SCOPE(RNNCellDecomposition); auto rnn_cell = ngraph::pattern::wrap_type(); ngraph::matcher_pass_callback callback = [this](ngraph::pattern::Matcher& m) { auto rnn_cell = std::dynamic_pointer_cast (m.get_match_root()); @@ -49,6 +51,6 @@ ngraph::pass::RNNCellDecomposition::RNNCellDecomposition() { return true; }; - auto m = std::make_shared(rnn_cell, "RNNCellDecomposition"); + auto m = std::make_shared(rnn_cell, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/softplus_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/softplus_decomposition.cpp index 1260f4fa954..7a9ad8fdf30 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/softplus_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/softplus_decomposition.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/op_conversions/softplus_decomposition.hpp" #include @@ -14,6 +15,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::SoftPlusDecomposition, "SoftPlusDecomposition", 0); ngraph::pass::SoftPlusDecomposition::SoftPlusDecomposition() { + MATCHER_SCOPE(SoftPlusDecomposition); // decomposes SoftPlus(x) operation into ln(exp(x) + 1.0) auto input = ngraph::pattern::any_input(); auto softplus = std::make_shared(input); @@ -38,6 +40,6 @@ ngraph::pass::SoftPlusDecomposition::SoftPlusDecomposition() { return true; }; - auto m = std::make_shared(softplus, "SoftPlusDecomposition"); + auto m = std::make_shared(softplus, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp b/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp index 8021011dd51..7885a471066 100644 --- a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp +++ b/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp @@ -6,7 +6,7 @@ #include "transformations/op_conversions/convert_batch_to_space.hpp" #include "transformations/op_conversions/convert_space_to_batch.hpp" -#include "transformations/itt.hpp" +#include "itt.hpp" #include #include @@ -16,6 +16,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertOpSet2ToOpSet1, "ConvertOpSet2ToOpSet1", 0); bool ngraph::pass::ConvertOpSet2ToOpSet1::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(ConvertOpSet2ToOpSet1); ngraph::pass::Manager manager(get_pass_config()); manager.register_pass(); diff --git a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp b/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp index 35665673308..b25c98772a9 100644 --- a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp +++ b/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp @@ -9,7 +9,7 @@ #include "transformations/op_conversions/convert_shuffle_channels3.hpp" #include "transformations/op_conversions/convert_topk3.hpp" #include "transformations/op_conversions/softplus_decomposition.hpp" -#include "transformations/itt.hpp" +#include "itt.hpp" #include #include @@ -19,6 +19,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertOpSet3ToOpSet2, "ConvertOpSet3ToOpSet2", 0); bool ngraph::pass::ConvertOpSet3ToOpSet2::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(ConvertOpSet3ToOpSet2); ngraph::pass::Manager manager(get_pass_config()); manager.register_pass(); diff --git a/inference-engine/src/transformations/src/transformations/serialize.cpp b/inference-engine/src/transformations/src/transformations/serialize.cpp index a2ba1e2e04a..2e564321679 100644 --- a/inference-engine/src/transformations/src/transformations/serialize.cpp +++ b/inference-engine/src/transformations/src/transformations/serialize.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include #include #include @@ -501,6 +502,7 @@ void ngfunction_2_irv10(pugi::xml_document& doc, // ! [function_pass:serialize_cpp] // serialize.cpp bool pass::Serialize::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(Serialize); // prepare data pugi::xml_document xml_doc; std::ofstream bin_file(m_binPath, std::ios::out | std::ios::binary); diff --git a/inference-engine/src/transformations/src/transformations/smart_reshape/matmul_sr.cpp b/inference-engine/src/transformations/src/transformations/smart_reshape/matmul_sr.cpp index 311392ef99c..453807f99cb 100644 --- a/inference-engine/src/transformations/src/transformations/smart_reshape/matmul_sr.cpp +++ b/inference-engine/src/transformations/src/transformations/smart_reshape/matmul_sr.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include "transformations/smart_reshape/matmul_sr.hpp" #include "transformations/smart_reshape/utils.hpp" @@ -49,6 +50,7 @@ bool relax_hc_reshape_followed_by_matmul(const ngraph::pattern::PatternValueMap NGRAPH_RTTI_DEFINITION(ngraph::pass::ReshapeAMatMul, "ReshapeAMatMul", 0); ngraph::pass::ReshapeAMatMul::ReshapeAMatMul() { + MATCHER_SCOPE(ReshapeAMatMul); auto other_input_label = pattern::any_input(); auto reshape_input_label = pattern::any_input(); auto reshape_pattern_label = pattern::any_input(); @@ -57,16 +59,16 @@ ngraph::pass::ReshapeAMatMul::ReshapeAMatMul() { matcher_pass_callback callback = [=](pattern::Matcher &m) -> bool { const auto & pattern_to_output = m.get_pattern_value_map(); - return relax_hc_reshape_followed_by_matmul( - pattern_to_output, matmul_label, reshape_label, other_input_label, reshape_pattern_label, true); + return relax_hc_reshape_followed_by_matmul(pattern_to_output, matmul_label, reshape_label, other_input_label, reshape_pattern_label, true); }; - auto m = std::make_shared(matmul_label, "ReshapeMatMul_A"); + auto m = std::make_shared(matmul_label, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::ReshapeBMatMul, "ReshapeBMatMul", 0); ngraph::pass::ReshapeBMatMul::ReshapeBMatMul() { + MATCHER_SCOPE(ReshapeBMatMul); auto other_input_label = pattern::any_input(); auto reshape_input_label = pattern::any_input(); auto reshape_pattern_label = pattern::any_input(); @@ -75,16 +77,16 @@ ngraph::pass::ReshapeBMatMul::ReshapeBMatMul() { matcher_pass_callback callback = [=](pattern::Matcher &m) -> bool { const auto & pattern_to_output = m.get_pattern_value_map(); - return relax_hc_reshape_followed_by_matmul( - pattern_to_output, matmul_label, reshape_label, other_input_label, reshape_pattern_label, false); + return relax_hc_reshape_followed_by_matmul(pattern_to_output, matmul_label, reshape_label, other_input_label, reshape_pattern_label, false); }; - auto m = std::make_shared(matmul_label, "ReshapeMatMul_B"); + auto m = std::make_shared(matmul_label, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::TransposeMatMul, "TransposeMatMul", 0); ngraph::pass::TransposeMatMul::TransposeMatMul() { + MATCHER_SCOPE(TransposeMatMul); auto matmul_label = ngraph::pattern::wrap_type(); matcher_pass_callback callback = [=](pattern::Matcher &m) -> bool { @@ -136,6 +138,6 @@ ngraph::pass::TransposeMatMul::TransposeMatMul() { } return false; }; - auto m = std::make_shared(matmul_label, "TransposeMatMul"); + auto m = std::make_shared(matmul_label, matcher_name); register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/smart_reshape/mimic_set_batch_size.cpp b/inference-engine/src/transformations/src/transformations/smart_reshape/mimic_set_batch_size.cpp index 3fdba37af2b..403ebced1a5 100644 --- a/inference-engine/src/transformations/src/transformations/smart_reshape/mimic_set_batch_size.cpp +++ b/inference-engine/src/transformations/src/transformations/smart_reshape/mimic_set_batch_size.cpp @@ -2,12 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include #include NGRAPH_RTTI_DEFINITION(ngraph::pass::MimicSetBatchSize, "MimicSetBatchSize", 0); bool ngraph::pass::MimicSetBatchSize::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(MimicSetBatchSize); // extracting ratio of out to in 0-index dimension value from the folded function auto specialized_function = ngraph::clone_function(*f); ngraph::pass::Manager manager; diff --git a/inference-engine/src/transformations/src/transformations/smart_reshape/proposal_scales_stridedslice.cpp b/inference-engine/src/transformations/src/transformations/smart_reshape/proposal_scales_stridedslice.cpp index 82c223733c4..42a546e172f 100644 --- a/inference-engine/src/transformations/src/transformations/smart_reshape/proposal_scales_stridedslice.cpp +++ b/inference-engine/src/transformations/src/transformations/smart_reshape/proposal_scales_stridedslice.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include #include @@ -31,6 +32,7 @@ bool crop_scales_for_proposal(const ngraph::pattern::PatternValueMap & pattern_t NGRAPH_RTTI_DEFINITION(ngraph::pass::Proposal1Scales, "Proposal1Scales", 0); ngraph::pass::Proposal1Scales::Proposal1Scales() { + MATCHER_SCOPE(Proposal1Scales); auto parameter_label = ngraph::pattern::wrap_type([](const Output &output) { const auto & shape = output.get_partial_shape(); return shape.rank().is_static() && shape.rank().get_length() == 2 && shape[1].is_static() && (shape[1].get_length() == 3 || shape[1].get_length() == 4); @@ -42,13 +44,14 @@ ngraph::pass::Proposal1Scales::Proposal1Scales() { matcher_pass_callback callback = [parameter_label, proposal_label](pattern::Matcher &m) -> bool { return crop_scales_for_proposal(m.get_pattern_value_map(), parameter_label, proposal_label); }; - auto m = std::make_shared(proposal_label, "Proposal1Scales"); + auto m = std::make_shared(proposal_label, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::Proposal4Scales, "Proposal4Scales", 0); ngraph::pass::Proposal4Scales::Proposal4Scales() { + MATCHER_SCOPE(Proposal4Scales); auto parameter_label = ngraph::pattern::wrap_type([](const Output &output) { const auto & shape = output.get_partial_shape(); return shape.rank().is_static() && shape.rank().get_length() == 2 && shape[1].is_static() && (shape[1].get_length() == 3 || shape[1].get_length() == 4); @@ -60,6 +63,6 @@ ngraph::pass::Proposal4Scales::Proposal4Scales() { matcher_pass_callback callback = [parameter_label, proposal_label](pattern::Matcher &m) -> bool { return crop_scales_for_proposal(m.get_pattern_value_map(), parameter_label, proposal_label); }; - auto m = std::make_shared(proposal_label, "Proposal4Scales"); + auto m = std::make_shared(proposal_label, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/smart_reshape/reshape_to_1D.cpp b/inference-engine/src/transformations/src/transformations/smart_reshape/reshape_to_1D.cpp index ddff28b1e80..a420d47af92 100644 --- a/inference-engine/src/transformations/src/transformations/smart_reshape/reshape_to_1D.cpp +++ b/inference-engine/src/transformations/src/transformations/smart_reshape/reshape_to_1D.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include #include @@ -13,6 +14,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ReshapeTo1D, "ReshapeTo1D", 0); ngraph::pass::ReshapeTo1D::ReshapeTo1D() { + MATCHER_SCOPE(ReshapeTo1D); auto reshape_label = ngraph::pattern::wrap_type({pattern::any_input(), ngraph::pattern::wrap_type()}, [](const Output & output) { return output.get_partial_shape().rank().is_static() && output.get_partial_shape().rank().get_length() == 1; }); @@ -20,6 +22,6 @@ ngraph::pass::ReshapeTo1D::ReshapeTo1D() { m.get_match_root()->input(1).replace_source_output(ngraph::opset5::Constant::create(ngraph::element::i64, {1}, {-1})); return true; }; - auto m = std::make_shared(reshape_label, "ReshapeTo1D"); + auto m = std::make_shared(reshape_label, matcher_name); register_matcher(m, callback); } diff --git a/inference-engine/src/transformations/src/transformations/smart_reshape/set_batch_size.cpp b/inference-engine/src/transformations/src/transformations/smart_reshape/set_batch_size.cpp index 3d67cac98f7..02c44701fbd 100644 --- a/inference-engine/src/transformations/src/transformations/smart_reshape/set_batch_size.cpp +++ b/inference-engine/src/transformations/src/transformations/smart_reshape/set_batch_size.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -17,6 +17,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::SetBatchSize, "SetBatchSize", 0); bool ngraph::pass::SetBatchSize::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(SetBatchSize); OV_ITT_SCOPED_TASK(itt::domains::IETransform, "ngraph::pass::SetBatchSize"); ngraph::pass::Manager manager; diff --git a/inference-engine/src/transformations/src/transformations/smart_reshape/smart_reshape.cpp b/inference-engine/src/transformations/src/transformations/smart_reshape/smart_reshape.cpp index d58a4cdbeaa..04b104fb48e 100644 --- a/inference-engine/src/transformations/src/transformations/smart_reshape/smart_reshape.cpp +++ b/inference-engine/src/transformations/src/transformations/smart_reshape/smart_reshape.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "itt.hpp" #include #include @@ -17,6 +18,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::SmartReshape, "SmartReshape", 0); bool ngraph::pass::SmartReshape::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(SmartReshape); ngraph::pass::Manager static_manager; // This pass must be called first in pipeline static_manager.register_pass(); diff --git a/inference-engine/src/transformations/src/transformations/smart_reshape/strided_slice_squeeze.cpp b/inference-engine/src/transformations/src/transformations/smart_reshape/strided_slice_squeeze.cpp index cdddd6ea5d3..153d8783a78 100644 --- a/inference-engine/src/transformations/src/transformations/smart_reshape/strided_slice_squeeze.cpp +++ b/inference-engine/src/transformations/src/transformations/smart_reshape/strided_slice_squeeze.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // -#include +#include #include #include @@ -14,6 +14,7 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::StridedSliceSqueeze, "ngraph::pass::StridedSliceSqueeze", 0); ngraph::pass::StridedSliceSqueeze::StridedSliceSqueeze() { + MATCHER_SCOPE(StridedSliceSqueeze); auto ss_label = ngraph::pattern::wrap_type(pattern::consumers_count(1)); auto squeeze_label = ngraph::pattern::wrap_type({ss_label, ngraph::pattern::wrap_type()}); @@ -75,12 +76,13 @@ ngraph::pass::StridedSliceSqueeze::StridedSliceSqueeze() { copy_runtime_info(slice, new_slice); return true; }; - auto m = std::make_shared(squeeze_label, "ngraph::pass::StridedSliceSqueeze"); + auto m = std::make_shared(squeeze_label, matcher_name); register_matcher(m, callback); } NGRAPH_RTTI_DEFINITION(ngraph::pass::SqueezeStridedSlice, "ngraph::pass::SqueezeStridedSlice", 0); ngraph::pass::SqueezeStridedSlice::SqueezeStridedSlice() { + MATCHER_SCOPE(SqueezeStridedSlice); auto squeeze_label = ngraph::pattern::wrap_type( {pattern::any_input(), ngraph::pattern::wrap_type()}, pattern::consumers_count(1)); auto ss_label = ngraph::pattern::wrap_type({squeeze_label, pattern::any_input(), pattern::any_input(), pattern::any_input()}); @@ -138,7 +140,7 @@ ngraph::pass::SqueezeStridedSlice::SqueezeStridedSlice() { copy_runtime_info(slice, new_slice); return true; }; - auto m = std::make_shared(ss_label, "ngraph::pass::SqueezeStridedSlice"); + auto m = std::make_shared(ss_label, matcher_name); register_matcher(m, callback); } @@ -162,6 +164,7 @@ bool squeezes_perform_the_same(std::shared_ptr lhs, std } bool ngraph::pass::SharedSqueeze::run_on_function(std::shared_ptr f) { + RUN_ON_FUNCTION_SCOPE(SharedSqueeze); OV_ITT_SCOPED_TASK(itt::domains::IETransform, "ngraph::pass::SharedSqueeze"); bool graph_rewritten = false; @@ -190,4 +193,4 @@ bool ngraph::pass::SharedSqueeze::run_on_function(std::shared_ptrget_name()); \ + OV_ITT_SCOPED_TASK(SIMPLE_ngraph_pass, m_callback_handle) #elif defined(SELECTIVE_BUILD) #define NGRAPH_OP_SCOPE(region) \ if (OV_CC_SCOPE_IS_ENABLED(OV_CC_CAT3(ngraph_op, _, region)) == 0) \ throw ngraph::ngraph_error(std::string(OV_CC_TOSTRING(OV_CC_CAT3(ngraph_op, _, region))) + \ " is disabled!") +#define NGRAPH_PASS_CALLBACK(matcher) #else #define NGRAPH_OP_SCOPE(region) OV_ITT_SCOPED_TASK(ngraph::itt::domains::ngraph_op, #region) +#define NGRAPH_PASS_CALLBACK(matcher) #endif #define NGRAPH_TYPE_CASE(region, a, ...) \ diff --git a/ngraph/core/src/pass/graph_rewrite.cpp b/ngraph/core/src/pass/graph_rewrite.cpp index 0393a356d2b..d1980024e47 100644 --- a/ngraph/core/src/pass/graph_rewrite.cpp +++ b/ngraph/core/src/pass/graph_rewrite.cpp @@ -251,6 +251,7 @@ void pass::GraphRewrite::add_matcher(const shared_ptr& m, if (m->match(node->output(0))) { NGRAPH_DEBUG << "Matcher " << m->get_name() << " matched " << node; + NGRAPH_PASS_CALLBACK(m); bool status = callback(*m.get()); // explicitly clear Matcher state because it holds pointers to matched nodes m->clear_state(); @@ -387,6 +388,7 @@ void ngraph::pass::MatcherPass::register_matcher(const std::shared_ptrmatch(node->output(0))) { NGRAPH_DEBUG << "Matcher " << m->get_name() << " matched " << node; + NGRAPH_PASS_CALLBACK(m); bool status = callback(*m.get()); // explicitly clear Matcher state because it holds pointers to matched nodes m->clear_state(); @@ -401,5 +403,7 @@ bool ngraph::pass::MatcherPass::apply(std::shared_ptr node) { OV_ITT_SCOPED_TASK(itt::domains::nGraph, "ngraph::pass::MatcherPass::apply"); m_new_nodes.clear(); - return m_handler(node); + if (m_handler) + return m_handler(node); + return false; }