From a25a476db2cd27cbc1b8290702c77aaba5666dc2 Mon Sep 17 00:00:00 2001 From: Oleg Pipikin Date: Thu, 25 Apr 2024 16:46:01 +0200 Subject: [PATCH] Remove opset usages for transformations (#24220) ### Details: - Remove opset usages for transformations - Use operation versions instead of opsets ### Tickets: - CVS-118087 --- .../src/compress_quantize_weigths.cpp | 2 + .../ov_ops/multiclass_nms_ie_internal.hpp | 6 +- .../dimension_tracking.hpp | 11 +- .../convert_reduce_to_pooling.hpp | 45 ++-- .../convert_reduce_to_reshape.hpp | 7 +- .../transpose_sinking/ts_utils.hpp | 17 +- .../include/transformations/utils/utils.hpp | 16 +- .../ov_ops/generate_proposals_ie_internal.cpp | 1 - .../src/ov_ops/multiclass_nms_ie_internal.cpp | 4 +- .../src/ov_ops/nms_ie_internal.cpp | 5 +- .../eliminate_unsqueeze_gather.cpp | 5 + .../fold_subgraph_empty_inputs.cpp | 1 + .../common_optimizations/gelu_fusion.cpp | 1 + ..._precision_sensitive_shapeof_subgraphs.cpp | 1 + .../common_optimizations/nop_elimination.cpp | 8 + .../pull_through_reduce.cpp | 3 + .../reduce_reshape_fusion.cpp | 3 + ...ip_gather_before_transpose_and_reshape.cpp | 1 + .../strides_optimization.cpp | 1 + .../transpose_sinking.cpp | 3 + .../src/transformations/convert_precision.cpp | 207 ++++++++--------- .../flush_fp32_subnormals_to_zero.cpp | 7 +- .../mark_dequantization_subgraph.cpp | 21 +- .../convert_gather_to_compressed.cpp | 8 +- ...convert_nms_rotated_to_nms_ie_internal.cpp | 1 + .../convert_reduce_to_reshape.cpp | 7 + .../convert_ti_to_sequences.cpp | 11 +- .../group_normalization_decomposition.cpp | 1 + .../rt_info/primitives_priority_attribute.cpp | 14 +- .../dereshape_matmul.cpp | 2 + .../reshape_optimizations.cpp | 1 + .../symbolic_optimizations.cpp | 4 + .../transpose_sinking/ts_binary.cpp | 4 + .../transpose_sinking/ts_shape_of.cpp | 1 + .../transpose_sinking/ts_unary.cpp | 6 + .../src/transformations/utils/utils.cpp | 39 ++-- .../fuse_rotary_positional_embeddings.cpp | 4 + .../common_optimizations/gelu_fusion.cpp | 1 + .../common_optimizations/nop_elimination.cpp | 216 +++++++++--------- .../convert_reduce_to_reshape.cpp | 7 + .../tests/op_conversions/convert_subtract.cpp | 1 + .../dereshape_matmul.cpp | 5 + .../ts_reset_no_sinking_attribute.cpp | 3 + .../transpose_sinking/ts_shape_of_test.cpp | 3 + src/core/tests/pass/constant_folding.cpp | 7 +- src/core/tests/pattern.cpp | 3 + .../embedding_segments_feature_fusing.cpp | 3 + .../gru_block_cell_replacer.cpp | 1 + src/inference/src/check_network_batchable.cpp | 4 +- src/inference/tests/unit/query_model_test.cpp | 11 + src/plugins/auto/src/plugin.cpp | 3 + .../intel_cpu/src/cpu_streams_calculation.cpp | 1 + src/plugins/intel_cpu/src/nodes/rnn.cpp | 5 + src/plugins/intel_cpu/src/nodes/split.cpp | 2 + .../intel_cpu/src/nodes/tensoriterator.cpp | 2 + .../cpu_opset/common/pass/split_fc.cpp | 1 + .../arm/convert_group_conv.cpp | 2 +- .../arm/convert_group_conv1d.cpp | 2 +- .../intel_gpu/src/plugin/ops/eltwise.cpp | 5 + src/plugins/intel_gpu/src/plugin/ops/loop.cpp | 1 + .../intel_gpu/src/plugin/ops/unary.cpp | 2 + .../convert_fc_to_compressed.cpp | 1 + .../transformations/indirect_kv_cache.cpp | 1 + .../transformations/kv_cache_fusion.cpp | 2 + .../clamp_fp16_output_test.cpp | 2 + .../convert_binary_conv_to_conv_test.cpp | 1 + .../indirect_kv_cache_test.cpp | 1 + .../transformations/kv_cache_fusion_test.cpp | 2 + .../src/al/src/sync_infer_request.cpp | 1 + src/plugins/template/src/plugin.cpp | 1 + .../ov_snippets_models/src/subgraph_mha.cpp | 16 +- 71 files changed, 473 insertions(+), 325 deletions(-) diff --git a/src/common/offline_transformations/src/compress_quantize_weigths.cpp b/src/common/offline_transformations/src/compress_quantize_weigths.cpp index 765ebb9ab6e..f2d3526a9bd 100644 --- a/src/common/offline_transformations/src/compress_quantize_weigths.cpp +++ b/src/common/offline_transformations/src/compress_quantize_weigths.cpp @@ -11,6 +11,8 @@ #include "openvino/op/fake_convert.hpp" #include "openvino/op/fake_quantize.hpp" #include "openvino/op/multiply.hpp" +#include "openvino/op/negative.hpp" +#include "openvino/op/power.hpp" #include "openvino/op/subtract.hpp" #include "openvino/pass/constant_folding.hpp" #include "openvino/pass/pattern/op/or.hpp" diff --git a/src/common/transformations/include/ov_ops/multiclass_nms_ie_internal.hpp b/src/common/transformations/include/ov_ops/multiclass_nms_ie_internal.hpp index 38fd664369d..025a69e325e 100644 --- a/src/common/transformations/include/ov_ops/multiclass_nms_ie_internal.hpp +++ b/src/common/transformations/include/ov_ops/multiclass_nms_ie_internal.hpp @@ -4,17 +4,17 @@ #pragma once +#include "openvino/op/multiclass_nms.hpp" #include "openvino/op/util/multiclass_nms_base.hpp" -#include "openvino/opsets/opset9.hpp" #include "transformations_visibility.hpp" namespace ov { namespace op { namespace internal { -class TRANSFORMATIONS_API MulticlassNmsIEInternal : public opset9::MulticlassNms { +class TRANSFORMATIONS_API MulticlassNmsIEInternal : public ov::op::v9::MulticlassNms { public: - OPENVINO_OP("MulticlassNmsIEInternal", "ie_internal_opset", opset9::MulticlassNms); + OPENVINO_OP("MulticlassNmsIEInternal", "ie_internal_opset", ov::op::v9::MulticlassNms); MulticlassNmsIEInternal() = default; diff --git a/src/common/transformations/include/transformations/common_optimizations/dimension_tracking.hpp b/src/common/transformations/include/transformations/common_optimizations/dimension_tracking.hpp index 745f6e0bb93..a9bd1db84d3 100644 --- a/src/common/transformations/include/transformations/common_optimizations/dimension_tracking.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/dimension_tracking.hpp @@ -6,12 +6,11 @@ #include -#include "openvino/opsets/opset1.hpp" #include "openvino/pass/graph_rewrite.hpp" #include "transformations_visibility.hpp" using P2Btype = - std::unordered_map, std::unordered_set>>; + std::unordered_map, std::unordered_set>>; namespace ov { namespace pass { @@ -36,17 +35,17 @@ protected: namespace ov { namespace batch_util { -void mark_batch(const std::shared_ptr& parameter, +void mark_batch(const std::shared_ptr& parameter, P2Btype& map, const std::unordered_set>& batches); -void mark_no_batch(const std::shared_ptr& parameter, P2Btype& map); -void mark_layout_independent_batch(const std::shared_ptr& parameter, +void mark_no_batch(const std::shared_ptr& parameter, P2Btype& map); +void mark_layout_independent_batch(const std::shared_ptr& parameter, const std::shared_ptr& result, P2Btype& map); void mark_with_unique_dimension_symbols(const std::shared_ptr& m); void restore_original_dimensions( const std::shared_ptr& model, - const std::map, ov::PartialShape>& parameter_to_shape, + const std::map, ov::PartialShape>& parameter_to_shape, bool leave_batch_dynamic = true, bool clear_symbols = false); bool check_batch_tracks_through_all_the_nodes(const std::shared_ptr& m); diff --git a/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp b/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp index baa8b827590..b74a0ff538e 100644 --- a/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp @@ -9,7 +9,16 @@ #include #include "openvino/core/rt_info.hpp" -#include "openvino/opsets/opset1.hpp" +#include "openvino/op/avg_pool.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/convert.hpp" +#include "openvino/op/max_pool.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/reduce_max.hpp" +#include "openvino/op/reduce_mean.hpp" +#include "openvino/op/reduce_min.hpp" +#include "openvino/op/reduce_sum.hpp" +#include "openvino/op/reshape.hpp" #include "openvino/pass/graph_rewrite.hpp" #include "transformations_visibility.hpp" @@ -69,7 +78,7 @@ ov::matcher_pass_callback ConvertReduceBase::convert_reduce_to_pooling() { auto input = reduce->input_value(0); - auto axes_node = std::dynamic_pointer_cast(reduce->input_value(1).get_node_shared_ptr()); + auto axes_node = std::dynamic_pointer_cast(reduce->input_value(1).get_node_shared_ptr()); if (!axes_node) { return false; } @@ -96,9 +105,9 @@ ov::matcher_pass_callback ConvertReduceBase::convert_reduce_to_pooling() { return input_shape[axis] == 1; })) { const auto reshape_shape = reduce->output(0).get_shape(); - auto reshape = std::make_shared( + auto reshape = std::make_shared( input, - ov::opset1::Constant::create(ov::element::i64, ov::Shape{reshape_shape.size()}, reshape_shape), + ov::op::v0::Constant::create(ov::element::i64, ov::Shape{reshape_shape.size()}, reshape_shape), true); reshape->set_friendly_name(reduce->get_friendly_name()); @@ -190,16 +199,16 @@ ov::matcher_pass_callback ConvertReduceBase::convert_reduce_to_pooling() { ov::NodeVector new_ops; if (!shape_begin.empty() && shape_begin != input.get_shape()) { - input = std::make_shared( + input = std::make_shared( input, - ov::opset1::Constant::create(ov::element::i64, ov::Shape{shape_begin.size()}, shape_begin), + ov::op::v0::Constant::create(ov::element::i64, ov::Shape{shape_begin.size()}, shape_begin), true); input.get_node_shared_ptr()->set_friendly_name(reduce->get_friendly_name() + "/reshape_begin"); new_ops.push_back(input.get_node_shared_ptr()); } - if (std::is_same()) { - input = std::make_shared(input, + if (std::is_same()) { + input = std::make_shared(input, strides, pads_begin, pads_end, @@ -209,8 +218,8 @@ ov::matcher_pass_callback ConvertReduceBase::convert_reduce_to_pooling() { input.get_node_shared_ptr()->set_friendly_name(reduce->get_friendly_name() + "/pool"); new_ops.push_back(input.get_node_shared_ptr()); - } else if (std::is_same()) { - input = std::make_shared(input, + } else if (std::is_same()) { + input = std::make_shared(input, strides, pads_begin, pads_end, @@ -219,16 +228,16 @@ ov::matcher_pass_callback ConvertReduceBase::convert_reduce_to_pooling() { input.get_node_shared_ptr()->set_friendly_name(reduce->get_friendly_name() + "/pool"); new_ops.push_back(input.get_node_shared_ptr()); - } else if (std::is_same()) { + } else if (std::is_same()) { // Fallback to real type because of potential data loss in case of integer AVG Pool bool fallback_to_real = input.get_element_type().is_integral(); if (fallback_to_real) { - input = std::make_shared(input, ov::element::f32); + input = std::make_shared(input, ov::element::f32); new_ops.push_back(input.get_node_shared_ptr()); } - input = std::make_shared(input, + input = std::make_shared(input, strides, pads_begin, pads_end, @@ -239,14 +248,14 @@ ov::matcher_pass_callback ConvertReduceBase::convert_reduce_to_pooling() { input.get_node_shared_ptr()->set_friendly_name(reduce->get_friendly_name() + "/pool"); new_ops.push_back(input.get_node_shared_ptr()); - input = std::make_shared( + input = std::make_shared( input, - ov::opset1::Constant::create(input.get_element_type(), ov::Shape{1}, {reduction_dims_count})); + ov::op::v0::Constant::create(input.get_element_type(), ov::Shape{1}, {reduction_dims_count})); input.get_node_shared_ptr()->set_friendly_name(reduce->get_friendly_name() + "/mul"); new_ops.push_back(input.get_node_shared_ptr()); if (fallback_to_real) { - input = std::make_shared(input, reduce->output(0).get_element_type()); + input = std::make_shared(input, reduce->output(0).get_element_type()); new_ops.push_back(input.get_node_shared_ptr()); } } else { @@ -254,9 +263,9 @@ ov::matcher_pass_callback ConvertReduceBase::convert_reduce_to_pooling() { } if (shape_end != input.get_shape()) { - input = std::make_shared( + input = std::make_shared( input, - ov::opset1::Constant::create(ov::element::i64, ov::Shape{shape_end.size()}, shape_end), + ov::op::v0::Constant::create(ov::element::i64, ov::Shape{shape_end.size()}, shape_end), true); new_ops.push_back(input.get_node_shared_ptr()); } diff --git a/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_reshape.hpp b/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_reshape.hpp index 0ca0f6e458b..15e303f0c26 100644 --- a/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_reshape.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_reshape.hpp @@ -9,7 +9,8 @@ #include #include "openvino/core/rt_info.hpp" -#include "openvino/opsets/opset1.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/reshape.hpp" #include "openvino/pass/graph_rewrite.hpp" #include "transformations_visibility.hpp" @@ -109,9 +110,9 @@ ov::matcher_pass_callback CvtReduceBase::convert_reduce_to_reshape() { // convert redundant reduce to reshape if the input shape is supported by reshape if (is_redundant(input_shape, reduce_shape) && input_shape.size() < 6) { const auto reshape_shape = reduce->output(0).get_shape(); - auto reshape = std::make_shared( + auto reshape = std::make_shared( input, - ov::opset1::Constant::create(ov::element::i64, ov::Shape{reshape_shape.size()}, reshape_shape), + ov::op::v0::Constant::create(ov::element::i64, ov::Shape{reshape_shape.size()}, reshape_shape), true); reshape->set_friendly_name(reduce->get_friendly_name()); diff --git a/src/common/transformations/include/transformations/transpose_sinking/ts_utils.hpp b/src/common/transformations/include/transformations/transpose_sinking/ts_utils.hpp index 7eeace62c2a..46bf5c793cd 100644 --- a/src/common/transformations/include/transformations/transpose_sinking/ts_utils.hpp +++ b/src/common/transformations/include/transformations/transpose_sinking/ts_utils.hpp @@ -6,8 +6,9 @@ #include +#include "openvino/op/constant.hpp" +#include "openvino/op/transpose.hpp" #include "openvino/op/util/op_types.hpp" -#include "openvino/opsets/opset10.hpp" #include "openvino/util/common_util.hpp" #include "transformations/utils/utils.hpp" @@ -17,8 +18,8 @@ namespace transpose_sinking { namespace utils { struct TransposeInputsInfo { - std::shared_ptr transpose; - std::shared_ptr transpose_const; + std::shared_ptr transpose; + std::shared_ptr transpose_const; size_t input_idx; bool isEmpty() const { @@ -90,7 +91,7 @@ namespace sink_backward { */ ov::NodeVector InsertTransposeBeforeNode( const std::shared_ptr& main_node, - const std::shared_ptr& transpose_const, + const std::shared_ptr& transpose_const, std::vector input_indexes = {}, std::function(const ov::Output& node, size_t n_dims)> InsertUnsqueeze = InsertBroadcastUnsqueeze); @@ -114,22 +115,22 @@ bool RemoveTransposeConsumers(const std::shared_ptr& node); */ ov::Output ChangeValuesOrder(const ov::Output& input, const ov::AxisVector& transpose_axis_order, - const std::shared_ptr& axis); + const std::shared_ptr& axis); /** * @brief Inserts Gather operation which changes the order of values in @arg input * according to @arg transpose_axis_order along @arg axis. */ Output ChangeAxes(const Output& input, const AxisVector& transpose_axis_order, - const std::shared_ptr& axis); + const std::shared_ptr& axis); /** * @brief Inserts Gather operation which changes the order of values in @arg input * according to @arg transpose_axis_order along @arg axis. */ Output ChangeAxes(const Output& input, - const std::shared_ptr& transpose_axis_order, - const std::shared_ptr& axis); + const std::shared_ptr& transpose_axis_order, + const std::shared_ptr& axis); /** * @brief Returns the updated axes order for case when the initial axes order has more elements * than after TransposeSinking, e.g.: diff --git a/src/common/transformations/include/transformations/utils/utils.hpp b/src/common/transformations/include/transformations/utils/utils.hpp index 63b1f2ae211..3ff74db89a0 100644 --- a/src/common/transformations/include/transformations/utils/utils.hpp +++ b/src/common/transformations/include/transformations/utils/utils.hpp @@ -13,8 +13,8 @@ #include "openvino/core/descriptor_tensor.hpp" #include "openvino/core/rt_info.hpp" -#include "openvino/opsets/opset4.hpp" -#include "openvino/opsets/opset8.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/convert.hpp" #include "openvino/pass/graph_rewrite.hpp" #include "transformations/rt_info/attributes.hpp" #include "transformations_visibility.hpp" @@ -65,7 +65,7 @@ bool has_op_with_type(const std::shared_ptr& function) { inline bool has_decompression_converts(const std::shared_ptr& function) { for (const auto& op : function->get_ops()) { - if (std::dynamic_pointer_cast(op)) { + if (std::dynamic_pointer_cast(op)) { if (ov::is_decompression(op)) return true; } @@ -133,7 +133,7 @@ bool has_constant_value(const std::shared_ptr& node, return false; } - auto constant = std::dynamic_pointer_cast(node); + auto constant = std::dynamic_pointer_cast(node); if (!constant) { return false; } @@ -167,7 +167,7 @@ bool has_constant_value(const std::shared_ptr& node, return false; } - auto constant = std::dynamic_pointer_cast(node); + auto constant = std::dynamic_pointer_cast(node); if (!constant) { return false; } @@ -184,18 +184,18 @@ bool has_constant_value(const std::shared_ptr& node, return const_values == values; } -TRANSFORMATIONS_API bool get_single_value(const std::shared_ptr& const_node, +TRANSFORMATIONS_API bool get_single_value(const std::shared_ptr& const_node, float& value, bool check_value_range = true); -TRANSFORMATIONS_API std::shared_ptr normalize_constant(const std::shared_ptr& constant, +TRANSFORMATIONS_API std::shared_ptr normalize_constant(const std::shared_ptr& constant, const PartialShape& shape); TRANSFORMATIONS_API std::shared_ptr broadcastTo(const Output& input, const Shape& shape); TRANSFORMATIONS_API std::shared_ptr reshapeTo(const Output& input, const Shape& shape); -TRANSFORMATIONS_API bool constantIsEqualTo(const std::shared_ptr& const_node, +TRANSFORMATIONS_API bool constantIsEqualTo(const std::shared_ptr& const_node, float value, float eps = 1e-5); diff --git a/src/common/transformations/src/ov_ops/generate_proposals_ie_internal.cpp b/src/common/transformations/src/ov_ops/generate_proposals_ie_internal.cpp index 97bf3d9b597..c9a55abb7af 100644 --- a/src/common/transformations/src/ov_ops/generate_proposals_ie_internal.cpp +++ b/src/common/transformations/src/ov_ops/generate_proposals_ie_internal.cpp @@ -7,7 +7,6 @@ #include #include "itt.hpp" -#include "openvino/opsets/opset9.hpp" using namespace std; using namespace ov; diff --git a/src/common/transformations/src/ov_ops/multiclass_nms_ie_internal.cpp b/src/common/transformations/src/ov_ops/multiclass_nms_ie_internal.cpp index 64da6b26bc4..bbfc1216bca 100644 --- a/src/common/transformations/src/ov_ops/multiclass_nms_ie_internal.cpp +++ b/src/common/transformations/src/ov_ops/multiclass_nms_ie_internal.cpp @@ -13,7 +13,7 @@ using namespace ov; op::internal::MulticlassNmsIEInternal::MulticlassNmsIEInternal(const Output& boxes, const Output& scores, const op::util::MulticlassNmsBase::Attributes& attrs) - : opset9::MulticlassNms(boxes, scores, attrs) { + : ov::op::v9::MulticlassNms(boxes, scores, attrs) { constructor_validate_and_infer_types(); } @@ -21,7 +21,7 @@ op::internal::MulticlassNmsIEInternal::MulticlassNmsIEInternal(const Output& scores, const Output& roisnum, const op::util::MulticlassNmsBase::Attributes& attrs) - : opset9::MulticlassNms(boxes, scores, roisnum, attrs) { + : ov::op::v9::MulticlassNms(boxes, scores, roisnum, attrs) { constructor_validate_and_infer_types(); } diff --git a/src/common/transformations/src/ov_ops/nms_ie_internal.cpp b/src/common/transformations/src/ov_ops/nms_ie_internal.cpp index ca7aaf08340..27bd7c8e511 100644 --- a/src/common/transformations/src/ov_ops/nms_ie_internal.cpp +++ b/src/common/transformations/src/ov_ops/nms_ie_internal.cpp @@ -7,7 +7,8 @@ #include #include "itt.hpp" -#include "openvino/opsets/opset5.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/util/op_types.hpp" using namespace std; using namespace ov; @@ -104,7 +105,7 @@ int64_t op::internal::NonMaxSuppressionIEInternal::max_boxes_output_from_input() } const auto max_output_boxes_input = - ov::as_type_ptr(input_value(max_output_boxes_per_class_port).get_node_shared_ptr()); + ov::as_type_ptr(input_value(max_output_boxes_per_class_port).get_node_shared_ptr()); max_output_boxes = max_output_boxes_input->cast_vector().at(0); return max_output_boxes; diff --git a/src/common/transformations/src/transformations/common_optimizations/eliminate_unsqueeze_gather.cpp b/src/common/transformations/src/transformations/common_optimizations/eliminate_unsqueeze_gather.cpp index 330838e74a2..9ae42a79309 100644 --- a/src/common/transformations/src/transformations/common_optimizations/eliminate_unsqueeze_gather.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/eliminate_unsqueeze_gather.cpp @@ -9,6 +9,11 @@ #include "openvino/op/constant.hpp" #include "openvino/op/reshape.hpp" #include "openvino/op/unsqueeze.hpp" +#include "openvino/op/util/binary_elementwise_arithmetic.hpp" +#include "openvino/op/util/binary_elementwise_bitwise.hpp" +#include "openvino/op/util/binary_elementwise_comparison.hpp" +#include "openvino/op/util/binary_elementwise_logical.hpp" +#include "openvino/op/util/gather_base.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/src/transformations/common_optimizations/fold_subgraph_empty_inputs.cpp b/src/common/transformations/src/transformations/common_optimizations/fold_subgraph_empty_inputs.cpp index 8eaa1e22a11..dd61ae7a50b 100644 --- a/src/common/transformations/src/transformations/common_optimizations/fold_subgraph_empty_inputs.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/fold_subgraph_empty_inputs.cpp @@ -11,6 +11,7 @@ #include "itt.hpp" #include "openvino/core/rt_info.hpp" #include "openvino/op/constant.hpp" +#include "openvino/op/util/multi_subgraph_base.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/src/transformations/common_optimizations/gelu_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/gelu_fusion.cpp index bdc98b1dd52..6936e3b1724 100644 --- a/src/common/transformations/src/transformations/common_optimizations/gelu_fusion.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/gelu_fusion.cpp @@ -17,6 +17,7 @@ #include "openvino/op/constant.hpp" #include "openvino/op/divide.hpp" #include "openvino/op/erf.hpp" +#include "openvino/op/gelu.hpp" #include "openvino/op/multiply.hpp" #include "openvino/op/parameter.hpp" #include "openvino/op/power.hpp" diff --git a/src/common/transformations/src/transformations/common_optimizations/mark_precision_sensitive_shapeof_subgraphs.cpp b/src/common/transformations/src/transformations/common_optimizations/mark_precision_sensitive_shapeof_subgraphs.cpp index 1cef297fc4a..a488b09bb29 100644 --- a/src/common/transformations/src/transformations/common_optimizations/mark_precision_sensitive_shapeof_subgraphs.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/mark_precision_sensitive_shapeof_subgraphs.cpp @@ -10,6 +10,7 @@ #include "itt.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/divide.hpp" +#include "openvino/op/util/multi_subgraph_base.hpp" #include "openvino/op/util/precision_sensitive_attribute.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/rt_info/disable_fp16_compression.hpp" diff --git a/src/common/transformations/src/transformations/common_optimizations/nop_elimination.cpp b/src/common/transformations/src/transformations/common_optimizations/nop_elimination.cpp index d6123575f6e..f89fcd45a85 100644 --- a/src/common/transformations/src/transformations/common_optimizations/nop_elimination.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/nop_elimination.cpp @@ -12,11 +12,13 @@ #include "itt.hpp" #include "openvino/core/validation_util.hpp" #include "openvino/op/add.hpp" +#include "openvino/op/broadcast.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/convert.hpp" #include "openvino/op/divide.hpp" #include "openvino/op/gather.hpp" +#include "openvino/op/gather_elements.hpp" #include "openvino/op/gru_sequence.hpp" #include "openvino/op/lstm_sequence.hpp" #include "openvino/op/multiply.hpp" @@ -26,11 +28,17 @@ #include "openvino/op/scatter_elements_update.hpp" #include "openvino/op/scatter_nd_update.hpp" #include "openvino/op/scatter_update.hpp" +#include "openvino/op/slice.hpp" #include "openvino/op/split.hpp" #include "openvino/op/squeeze.hpp" +#include "openvino/op/strided_slice.hpp" #include "openvino/op/subtract.hpp" +#include "openvino/op/tile.hpp" #include "openvino/op/transpose.hpp" #include "openvino/op/unsqueeze.hpp" +#include "openvino/op/util/binary_elementwise_comparison.hpp" +#include "openvino/op/util/binary_elementwise_logical.hpp" +#include "openvino/op/util/op_types.hpp" #include "openvino/op/util/pad_base.hpp" #include "openvino/op/variadic_split.hpp" #include "openvino/pass/pattern/op/optional.hpp" diff --git a/src/common/transformations/src/transformations/common_optimizations/pull_through_reduce.cpp b/src/common/transformations/src/transformations/common_optimizations/pull_through_reduce.cpp index 744aa751a58..e1e8f11e3af 100644 --- a/src/common/transformations/src/transformations/common_optimizations/pull_through_reduce.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/pull_through_reduce.cpp @@ -12,6 +12,9 @@ #include "openvino/op/constant.hpp" #include "openvino/op/reshape.hpp" #include "openvino/op/unsqueeze.hpp" +#include "openvino/op/util/arithmetic_reductions_keep_dims.hpp" +#include "openvino/op/util/binary_elementwise_logical.hpp" +#include "openvino/op/util/logical_reduction_keep_dims.hpp" #include "openvino/op/util/reduction_base.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" diff --git a/src/common/transformations/src/transformations/common_optimizations/reduce_reshape_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/reduce_reshape_fusion.cpp index fea65484098..b2f8d98e715 100644 --- a/src/common/transformations/src/transformations/common_optimizations/reduce_reshape_fusion.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/reduce_reshape_fusion.cpp @@ -10,6 +10,9 @@ #include "itt.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/reshape.hpp" +#include "openvino/op/util/arithmetic_reductions_keep_dims.hpp" +#include "openvino/op/util/binary_elementwise_logical.hpp" +#include "openvino/op/util/logical_reduction_keep_dims.hpp" #include "openvino/op/util/reduction_base.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" diff --git a/src/common/transformations/src/transformations/common_optimizations/skip_gather_before_transpose_and_reshape.cpp b/src/common/transformations/src/transformations/common_optimizations/skip_gather_before_transpose_and_reshape.cpp index 634851cfed0..2c21c91fe03 100644 --- a/src/common/transformations/src/transformations/common_optimizations/skip_gather_before_transpose_and_reshape.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/skip_gather_before_transpose_and_reshape.cpp @@ -12,6 +12,7 @@ #include "openvino/op/constant.hpp" #include "openvino/op/reshape.hpp" #include "openvino/op/transpose.hpp" +#include "openvino/op/util/gather_base.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/src/transformations/common_optimizations/strides_optimization.cpp b/src/common/transformations/src/transformations/common_optimizations/strides_optimization.cpp index c7da5cd7c1b..f58f125b319 100644 --- a/src/common/transformations/src/transformations/common_optimizations/strides_optimization.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/strides_optimization.cpp @@ -15,6 +15,7 @@ #include "openvino/op/reshape.hpp" #include "openvino/op/shape_of.hpp" #include "openvino/op/squeeze.hpp" +#include "openvino/op/util/binary_elementwise_arithmetic.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/rt_info/strides_property.hpp" diff --git a/src/common/transformations/src/transformations/common_optimizations/transpose_sinking.cpp b/src/common/transformations/src/transformations/common_optimizations/transpose_sinking.cpp index 20e2f063393..95e350a6e34 100644 --- a/src/common/transformations/src/transformations/common_optimizations/transpose_sinking.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/transpose_sinking.cpp @@ -18,6 +18,9 @@ #include "openvino/op/squeeze.hpp" #include "openvino/op/transpose.hpp" #include "openvino/op/unsqueeze.hpp" +#include "openvino/op/util/arithmetic_reductions_keep_dims.hpp" +#include "openvino/op/util/binary_elementwise_arithmetic.hpp" +#include "openvino/op/util/logical_reduction_keep_dims.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/src/transformations/convert_precision.cpp b/src/common/transformations/src/transformations/convert_precision.cpp index b29ab74981a..b2e80048e66 100644 --- a/src/common/transformations/src/transformations/convert_precision.cpp +++ b/src/common/transformations/src/transformations/convert_precision.cpp @@ -8,16 +8,7 @@ #include #include "itt.hpp" -#include "openvino/opsets/opset1.hpp" -#include "openvino/opsets/opset10.hpp" -#include "openvino/opsets/opset11.hpp" -#include "openvino/opsets/opset13.hpp" -#include "openvino/opsets/opset3.hpp" -#include "openvino/opsets/opset4.hpp" -#include "openvino/opsets/opset5.hpp" -#include "openvino/opsets/opset6.hpp" -#include "openvino/opsets/opset8.hpp" -#include "openvino/opsets/opset9.hpp" +#include "openvino/op/ops.hpp" #include "openvino/pass/constant_folding.hpp" #include "openvino/pass/manager.hpp" #include "openvino/reference/convert.hpp" @@ -172,7 +163,7 @@ bool convert_node_output_precision( bool function_changed) { bool node_changed = false; // Handle case with Constants as they can have consumers from other ov::Model object - const auto constant = ov::as_type_ptr(node); + const auto constant = ov::as_type_ptr(node); const auto it = const_to_internal_output.find(node.get()); if (constant && it != const_to_internal_output.end()) { return fuse_type_to_constant(node, precisions, it->second); @@ -252,8 +243,8 @@ bool convert_function_precision(const std::shared_ptr& f, auto register_constants = [&const_to_internal_output](const std::vector>& ops) { for (auto& node : ops) { for (auto& input : node->inputs()) { - if (auto const_node = - std::dynamic_pointer_cast(input.get_source_output().get_node_shared_ptr())) { + if (auto const_node = std::dynamic_pointer_cast( + input.get_source_output().get_node_shared_ptr())) { const_to_internal_output[const_node.get()].emplace_back(input); } } @@ -311,7 +302,7 @@ bool convert_function_precision(const std::shared_ptr& f, // TODO: we need to split NopElimination pass to separate MatcherPasses and call // Convert elimination here for (auto& node : ops) { - if (auto convert = std::dynamic_pointer_cast(node)) { + if (auto convert = std::dynamic_pointer_cast(node)) { if (pass::constant_folding_is_disabled(node)) continue; // WA for topK, dont remove fake convert @@ -430,53 +421,54 @@ bool ov::pass::ConvertPrecision::run_on_model(const std::shared_ptr& } type_to_fuse_map type_to_fuse{ - {opset4::Convert::get_type_info_static(), fuse_type_to_convert}, - {opset4::ShapeOf::get_type_info_static(), fuse_type_to_shapeof}, - {opset6::Assign::get_type_info_static(), + {ov::op::v0::Convert::get_type_info_static(), fuse_type_to_convert}, + {ov::op::v3::ShapeOf::get_type_info_static(), fuse_type_to_shapeof}, + {ov::op::v6::Assign::get_type_info_static(), m_store_original_precision_as_rt_attribute ? store_original_type_as_attribute : wrap_into_original_type}, - {opset6::ReadValue::get_type_info_static(), + {ov::op::v6::ReadValue::get_type_info_static(), m_store_original_precision_as_rt_attribute ? store_original_type_as_attribute : wrap_into_original_type}, - {opset3::NonMaxSuppression::get_type_info_static(), fuse_type_to_nms3}, - {opset4::NonMaxSuppression::get_type_info_static(), fuse_type_to_nms4}, - {opset5::NonMaxSuppression::get_type_info_static(), fuse_type_to_nms5}, - {opset9::NonMaxSuppression::get_type_info_static(), fuse_type_to_nms9}, + {ov::op::v3::NonMaxSuppression::get_type_info_static(), fuse_type_to_nms3}, + {ov::op::v4::NonMaxSuppression::get_type_info_static(), fuse_type_to_nms4}, + {ov::op::v5::NonMaxSuppression::get_type_info_static(), fuse_type_to_nms5}, + {ov::op::v9::NonMaxSuppression::get_type_info_static(), fuse_type_to_nms9}, {op::v13::NMSRotated::get_type_info_static(), fuse_type_to_nms_rotated}, - {opset8::MatrixNms::get_type_info_static(), fuse_type_to_matrix_nms}, - {opset8::MulticlassNms::get_type_info_static(), fuse_type_to_multiclass_nms}, - {opset9::MulticlassNms::get_type_info_static(), fuse_type_to_multiclass_nms}, - {opset9::GenerateProposals::get_type_info_static(), fuse_type_to_generate_proposals}, - {opset6::CTCGreedyDecoderSeqLen::get_type_info_static(), fuse_type_to_ctc_greedy_decoder_seq_len}, - {opset1::TopK::get_type_info_static(), fuse_type_to_topk}, - {opset4::TopK::get_type_info_static(), fuse_type_to_topk}, - {opset11::TopK::get_type_info_static(), fuse_type_to_topk}, - {opset8::MaxPool::get_type_info_static(), fuse_type_to_maxpool}, - {opset4::NonZero::get_type_info_static(), fuse_type_to_nonzero}, - {opset4::Bucketize::get_type_info_static(), fuse_type_to_bucketize}, - {opset4::Equal::get_type_info_static(), fuse_type_to_binary_comparision}, - {opset4::NotEqual::get_type_info_static(), fuse_type_to_binary_comparision}, - {opset4::Greater::get_type_info_static(), fuse_type_to_binary_comparision}, - {opset4::GreaterEqual::get_type_info_static(), fuse_type_to_binary_comparision}, - {opset4::Less::get_type_info_static(), fuse_type_to_binary_comparision}, - {opset4::LessEqual::get_type_info_static(), fuse_type_to_binary_comparision}, - {opset10::IsFinite::get_type_info_static(), fuse_type_to_binary_comparision}, - {opset10::IsNaN::get_type_info_static(), fuse_type_to_binary_comparision}, - {opset10::IsInf::get_type_info_static(), fuse_type_to_binary_comparision}, - {opset4::LogicalAnd::get_type_info_static(), fuse_type_to_logical}, - {opset4::LogicalOr::get_type_info_static(), fuse_type_to_logical}, - {opset4::LogicalXor::get_type_info_static(), fuse_type_to_logical}, - {opset4::LogicalNot::get_type_info_static(), fuse_type_to_logical}, - {opset1::Xor::get_type_info_static(), fuse_type_to_logical}, - {opset4::ReduceLogicalAnd::get_type_info_static(), fuse_type_to_reduce_logical}, - {opset4::ReduceLogicalOr::get_type_info_static(), fuse_type_to_reduce_logical}, - {opset1::ShapeOf::get_type_info_static(), fuse_type_to_shapeof_v0}, - {opset4::Range::get_type_info_static(), fuse_type_to_range_v4}, - {opset9::Eye::get_type_info_static(), fuse_type_to_eye_v9}, - {opset10::Unique::get_type_info_static(), fuse_type_to_unique_v10}, - {opset8::RandomUniform::get_type_info_static(), fuse_type_to_random_uniform_v8}, - {opset13::Multinomial::get_type_info_static(), fuse_type_to_multinomial_v13}, - {opset1::PriorBox::get_type_info_static(), fuse_type_to_prior_box}, - {opset8::PriorBox::get_type_info_static(), fuse_type_to_prior_box}, - {opset1::PriorBoxClustered::get_type_info_static(), fuse_type_to_prior_box}}; + {ov::op::v8::MatrixNms::get_type_info_static(), fuse_type_to_matrix_nms}, + {ov::op::v8::MulticlassNms::get_type_info_static(), fuse_type_to_multiclass_nms}, + {ov::op::v9::MulticlassNms::get_type_info_static(), fuse_type_to_multiclass_nms}, + {ov::op::v9::GenerateProposals::get_type_info_static(), fuse_type_to_generate_proposals}, + {ov::op::v6::CTCGreedyDecoderSeqLen::get_type_info_static(), fuse_type_to_ctc_greedy_decoder_seq_len}, + {ov::op::v1::TopK::get_type_info_static(), fuse_type_to_topk}, + {ov::op::v3::TopK::get_type_info_static(), fuse_type_to_topk}, + {ov::op::v11::TopK::get_type_info_static(), fuse_type_to_topk}, + {ov::op::v8::MaxPool::get_type_info_static(), fuse_type_to_maxpool}, + {ov::op::v3::NonZero::get_type_info_static(), fuse_type_to_nonzero}, + {ov::op::v3::Bucketize::get_type_info_static(), fuse_type_to_bucketize}, + {ov::op::v1::Equal::get_type_info_static(), fuse_type_to_binary_comparision}, + {ov::op::v1::NotEqual::get_type_info_static(), fuse_type_to_binary_comparision}, + {ov::op::v1::Greater::get_type_info_static(), fuse_type_to_binary_comparision}, + {ov::op::v1::GreaterEqual::get_type_info_static(), fuse_type_to_binary_comparision}, + {ov::op::v1::Less::get_type_info_static(), fuse_type_to_binary_comparision}, + {ov::op::v1::LessEqual::get_type_info_static(), fuse_type_to_binary_comparision}, + {ov::op::v10::IsFinite::get_type_info_static(), fuse_type_to_binary_comparision}, + {ov::op::v10::IsNaN::get_type_info_static(), fuse_type_to_binary_comparision}, + {ov::op::v10::IsInf::get_type_info_static(), fuse_type_to_binary_comparision}, + {ov::op::v1::LogicalAnd::get_type_info_static(), fuse_type_to_logical}, + {ov::op::v1::LogicalOr::get_type_info_static(), fuse_type_to_logical}, + {ov::op::v1::LogicalXor::get_type_info_static(), fuse_type_to_logical}, + {ov::op::v1::LogicalNot::get_type_info_static(), fuse_type_to_logical}, + {ov::op::v0::Xor::get_type_info_static(), fuse_type_to_logical}, + {ov::op::v1::ReduceLogicalAnd::get_type_info_static(), + fuse_type_to_reduce_logical}, + {ov::op::v1::ReduceLogicalOr::get_type_info_static(), fuse_type_to_reduce_logical}, + {ov::op::v0::ShapeOf::get_type_info_static(), fuse_type_to_shapeof_v0}, + {ov::op::v4::Range::get_type_info_static(), fuse_type_to_range_v4}, + {ov::op::v9::Eye::get_type_info_static(), fuse_type_to_eye_v9}, + {ov::op::v10::Unique::get_type_info_static(), fuse_type_to_unique_v10}, + {ov::op::v8::RandomUniform::get_type_info_static(), fuse_type_to_random_uniform_v8}, + {ov::op::v13::Multinomial::get_type_info_static(), fuse_type_to_multinomial_v13}, + {ov::op::v0::PriorBox::get_type_info_static(), fuse_type_to_prior_box}, + {ov::op::v8::PriorBox::get_type_info_static(), fuse_type_to_prior_box}, + {ov::op::v0::PriorBoxClustered::get_type_info_static(), fuse_type_to_prior_box}}; for (const auto& it : m_additional_type_to_fuse_map) { type_to_fuse[it.first] = it.second; @@ -485,8 +477,8 @@ bool ov::pass::ConvertPrecision::run_on_model(const std::shared_ptr& type_to_fuse.insert(m_additional_type_to_fuse_map.begin(), m_additional_type_to_fuse_map.end()); static type_to_fuse_map type_to_extend{ - {opset4::Select::get_type_info_static(), extend_select_type}, - {opset1::Reverse::get_type_info_static(), extend_reverse_type}, + {ov::op::v1::Select::get_type_info_static(), extend_select_type}, + {ov::op::v1::Reverse::get_type_info_static(), extend_reverse_type}, }; bool is_changed = convert_precision(*this, @@ -521,7 +513,7 @@ bool fuse_type_to_shapeof(const std::shared_ptr& node, const precision if (it == precisions.end()) return false; const auto& to = it->second; - if (auto shapeof = ov::as_type_ptr(node)) { + if (auto shapeof = ov::as_type_ptr(node)) { if (to == ov::element::i32 || to == ov::element::i64) { shapeof->set_output_type(to); return true; @@ -535,7 +527,7 @@ bool fuse_type_to_random_uniform_v8(const std::shared_ptr& node, const if (it == precisions.end()) return false; const auto& to = it->second; - if (auto random_uniform = ov::as_type_ptr(node)) { + if (auto random_uniform = ov::as_type_ptr(node)) { if (to.is_integral_number() || to.is_real()) { random_uniform->set_out_type(to); return true; @@ -546,7 +538,7 @@ bool fuse_type_to_random_uniform_v8(const std::shared_ptr& node, const bool fuse_type_to_unique_v10(const std::shared_ptr& node, const precisions_map& precisions) { bool res = false; - if (auto unique = ov::as_type_ptr(node)) { + if (auto unique = ov::as_type_ptr(node)) { auto it = precisions.find(node->get_output_element_type(1)); if (it != precisions.end()) { unique->set_index_element_type(it->second); @@ -566,7 +558,7 @@ bool fuse_type_to_range_v4(const std::shared_ptr& node, const precisio if (it == precisions.end()) return false; const auto& to = it->second; - if (auto range = ov::as_type_ptr(node)) { + if (auto range = ov::as_type_ptr(node)) { if (to.is_integral_number() || to.is_real()) { range->set_output_type(to); return true; @@ -580,7 +572,7 @@ bool fuse_type_to_eye_v9(const std::shared_ptr& node, const precisions if (it == precisions.end()) return false; const auto& to = it->second; - if (auto eye_node = ov::as_type_ptr(node)) { + if (auto eye_node = ov::as_type_ptr(node)) { if (to.is_integral() || to.is_real()) { eye_node->set_out_type(to); return true; @@ -597,14 +589,14 @@ bool fuse_type_to_parameter(const std::shared_ptr& node, return false; bool changed = false; const auto& to = it->second; - if (auto param = ov::as_type_ptr(node)) { + if (auto param = ov::as_type_ptr(node)) { if (convert_input_precision) { param->set_element_type(to); param->validate_and_infer_types(); changed = true; } else { auto param_consumers = param->output(0).get_target_inputs(); - auto convert = std::make_shared(param, to); + auto convert = std::make_shared(param, to); for (auto& input : param_consumers) { const auto consumer = input.get_node(); if (ov::is_type(consumer) || ov::is_type(consumer) || @@ -630,10 +622,10 @@ bool wrap_into_original_type(const std::shared_ptr& node, const precis const auto& to = it->second; const auto& from = it->first; - auto convert_before = std::make_shared(node->input_value(0), from); + auto convert_before = std::make_shared(node->input_value(0), from); node->input(0).replace_source_output(convert_before); auto consumers = node->output(0).get_target_inputs(); - auto convert_after = std::make_shared(node, to); + auto convert_after = std::make_shared(node, to); for (auto& input : consumers) { const auto consumer = input.get_node(); if (ov::is_type(consumer) || ov::is_type(consumer)) { @@ -670,7 +662,7 @@ bool fuse_type_to_convert(const std::shared_ptr& node, const precision if (it == precisions.end()) return false; const auto& to = it->second; - if (auto convert = ov::as_type_ptr(node)) { + if (auto convert = ov::as_type_ptr(node)) { convert->set_convert_element_type(to); return true; } @@ -682,7 +674,7 @@ bool fuse_type_to_nms3(const std::shared_ptr& node, const precisions_m if (it == precisions.end()) return false; const auto& to = it->second; - if (auto nms = ov::as_type_ptr(node)) { + if (auto nms = ov::as_type_ptr(node)) { if (to == ov::element::i32 || to == ov::element::i64) { nms->set_output_type(to); } else { @@ -698,7 +690,7 @@ bool fuse_type_to_nms4(const std::shared_ptr& node, const precisions_m if (it == precisions.end()) return false; const auto& to = it->second; - if (auto nms = ov::as_type_ptr(node)) { + if (auto nms = ov::as_type_ptr(node)) { if (to == ov::element::i32 || to == ov::element::i64) { nms->set_output_type(to); } else { @@ -710,7 +702,7 @@ bool fuse_type_to_nms4(const std::shared_ptr& node, const precisions_m } bool fuse_type_to_nms5(const std::shared_ptr& node, const precisions_map& precisions) { - auto nms = ov::as_type_ptr(node); + auto nms = ov::as_type_ptr(node); if (!nms) { return false; } @@ -752,14 +744,15 @@ bool fuse_type_to_nms5(const std::shared_ptr& node, const precisions_m output_types.push_back(to); } - auto relaxed_op = - std::make_shared>(*nms, ov::element::TypeVector{}, output_types); + auto relaxed_op = std::make_shared>(*nms, + ov::element::TypeVector{}, + output_types); replace_node(node, relaxed_op); return true; } bool fuse_type_to_nms9(const std::shared_ptr& node, const precisions_map& precisions) { - auto nms = ov::as_type_ptr(node); + auto nms = ov::as_type_ptr(node); if (!nms) { return false; } @@ -801,8 +794,9 @@ bool fuse_type_to_nms9(const std::shared_ptr& node, const precisions_m output_types.push_back(to); } - auto relaxed_op = - std::make_shared>(*nms, ov::element::TypeVector{}, output_types); + auto relaxed_op = std::make_shared>(*nms, + ov::element::TypeVector{}, + output_types); replace_node(node, relaxed_op); return true; } @@ -872,7 +866,7 @@ bool update_type(size_t idx, } // namespace bool fuse_type_to_matrix_nms(const std::shared_ptr& node, const precisions_map& precisions) { - auto nms = ov::as_type_ptr(node); + auto nms = ov::as_type_ptr(node); if (!nms) { return false; } @@ -885,9 +879,9 @@ bool fuse_type_to_matrix_nms(const std::shared_ptr& node, const precis bool fuse_type_to_multiclass_nms(const std::shared_ptr& node, const precisions_map& precisions) { std::shared_ptr nms; if (ov::is_type(node)) { - nms = ov::as_type_ptr(node); + nms = ov::as_type_ptr(node); } else { - nms = ov::as_type_ptr(node); + nms = ov::as_type_ptr(node); } if (!nms) { return false; @@ -899,7 +893,7 @@ bool fuse_type_to_multiclass_nms(const std::shared_ptr& node, const pr } bool fuse_type_to_multinomial_v13(const std::shared_ptr& node, const precisions_map& precisions) { - auto multinomial = ov::as_type_ptr(node); + auto multinomial = ov::as_type_ptr(node); if (!multinomial) { return false; } @@ -910,7 +904,7 @@ bool fuse_type_to_multinomial_v13(const std::shared_ptr& node, const p } bool fuse_type_to_generate_proposals(const std::shared_ptr& node, const precisions_map& precisions) { - auto generate_proposals = ov::as_type_ptr(node); + auto generate_proposals = ov::as_type_ptr(node); if (!generate_proposals) { return false; } @@ -930,7 +924,7 @@ bool fuse_type_to_topk(const std::shared_ptr& node, const precisions_m } bool fuse_type_to_maxpool(const std::shared_ptr& node, const precisions_map& precisions) { - if (auto maxpool = ov::as_type_ptr(node)) { + if (auto maxpool = ov::as_type_ptr(node)) { return update_type(1, node, precisions, [&](const element::Type& to) { maxpool->set_index_element_type(to); }); @@ -940,7 +934,7 @@ bool fuse_type_to_maxpool(const std::shared_ptr& node, const precision bool fuse_type_to_ctc_greedy_decoder_seq_len(const std::shared_ptr& node, const precisions_map& precisions) { bool res = false; - if (auto ctc_decoder = ov::as_type_ptr(node)) { + if (auto ctc_decoder = ov::as_type_ptr(node)) { res = update_type(0, node, precisions, [&](const element::Type& to) { ctc_decoder->set_classes_index_type(to); }); @@ -956,7 +950,7 @@ bool fuse_type_to_ctc_greedy_decoder_seq_len(const std::shared_ptr& no } bool fuse_type_to_nonzero(const std::shared_ptr& node, const precisions_map& precisions) { - if (auto nonzero = ov::as_type_ptr(node)) { + if (auto nonzero = ov::as_type_ptr(node)) { return update_type(0, node, precisions, [&](const element::Type& to) { nonzero->set_output_type(to); }); @@ -965,7 +959,7 @@ bool fuse_type_to_nonzero(const std::shared_ptr& node, const precision } bool fuse_type_to_bucketize(const std::shared_ptr& node, const precisions_map& precisions) { - if (auto b = ov::as_type_ptr(node)) { + if (auto b = ov::as_type_ptr(node)) { return update_type(0, node, precisions, [&](const element::Type& to) { b->set_output_type(to); }); @@ -981,10 +975,10 @@ bool fuse_type_to_shapeof_v0(const std::shared_ptr& node, const precis if (auto type_relaxed = std::dynamic_pointer_cast(node)) { type_relaxed->set_overridden_output_type(to); return true; - } else if (auto casted = std::dynamic_pointer_cast(node)) { - auto relaxed_op = std::make_shared>(*casted, - ov::element::TypeVector{}, - ov::element::TypeVector{to}); + } else if (auto casted = std::dynamic_pointer_cast(node)) { + auto relaxed_op = std::make_shared>(*casted, + ov::element::TypeVector{}, + ov::element::TypeVector{to}); replace_node(node, relaxed_op); return true; } @@ -995,11 +989,11 @@ bool extend_select_type(const std::shared_ptr& node, const precisions_ if (auto type_relaxed = std::dynamic_pointer_cast(node)) { type_relaxed->set_origin_input_type(ov::element::boolean, 0); return true; - } else if (auto casted = std::dynamic_pointer_cast(node)) { + } else if (auto casted = std::dynamic_pointer_cast(node)) { auto relaxed_op = - std::make_shared>(*casted, - ov::element::TypeVector{ov::element::boolean}, - ov::element::TypeVector{}); + std::make_shared>(*casted, + ov::element::TypeVector{ov::element::boolean}, + ov::element::TypeVector{}); replace_node(node, relaxed_op); return true; } @@ -1007,9 +1001,9 @@ bool extend_select_type(const std::shared_ptr& node, const precisions_ } bool extend_reverse_type(const std::shared_ptr& node, const precisions_map& precisions) { - if (const auto casted = std::dynamic_pointer_cast(node)) { + if (const auto casted = std::dynamic_pointer_cast(node)) { if (casted->get_mode() == ov::op::v1::Reverse::Mode::MASK) { - auto relaxed_op = std::make_shared>( + auto relaxed_op = std::make_shared>( *casted, ov::element::TypeVector{casted->get_input_element_type(0), ov::element::boolean}, ov::element::TypeVector{casted->get_output_element_type(0)}); @@ -1051,14 +1045,14 @@ inline int32_t convert_value(uint32_t val) { namespace { template -std::shared_ptr change_constant_precision(std::shared_ptr& constant) { +std::shared_ptr change_constant_precision(std::shared_ptr& constant) { using src_type = typename element_type_traits::value_type; using dst_type = typename element_type_traits::value_type; const auto* src_data = constant->get_data_ptr(); const auto size = shape_size(constant->get_shape()); - auto new_constant = std::make_shared(PREC_TO, constant->get_shape()); + auto new_constant = std::make_shared(PREC_TO, constant->get_shape()); new_constant->output(0).set_names(constant->output(0).get_names()); auto* dst_data = const_cast(reinterpret_cast(new_constant->get_data_ptr())); if (dst_data == nullptr) @@ -1072,14 +1066,14 @@ std::shared_ptr change_constant_precision(std::shared_ptr std::shared_ptr change_constant_precision( - std::shared_ptr& constant) { + std::shared_ptr& constant) { using src_type = typename element_type_traits::value_type; using dst_type = typename element_type_traits::value_type; const auto* src_data = constant->get_data_ptr(); const auto size = shape_size(constant->get_shape()); - auto new_constant = std::make_shared(ov::element::Type_t::f16, constant->get_shape()); + auto new_constant = std::make_shared(ov::element::Type_t::f16, constant->get_shape()); new_constant->output(0).set_names(constant->output(0).get_names()); auto* dst_data = const_cast(reinterpret_cast(new_constant->get_data_ptr())); if (dst_data == nullptr) @@ -1092,14 +1086,14 @@ std::shared_ptr change_constant_precision std::shared_ptr change_constant_precision( - std::shared_ptr& constant) { + std::shared_ptr& constant) { using src_type = typename element_type_traits::value_type; using dst_type = typename element_type_traits::value_type; const auto* src_data = constant->get_data_ptr(); const auto size = shape_size(constant->get_shape()); - auto new_constant = std::make_shared(ov::element::Type_t::f32, constant->get_shape()); + auto new_constant = std::make_shared(ov::element::Type_t::f32, constant->get_shape()); new_constant->output(0).set_names(constant->output(0).get_names()); auto* dst_data = const_cast(reinterpret_cast(new_constant->get_data_ptr())); if (dst_data == nullptr) @@ -1192,7 +1186,8 @@ void convert_lp_value(const SRC& src, dst &= new_val; } -std::shared_ptr convert_low_precisions_int(std::shared_ptr& constant, ov::element::Type to) { +std::shared_ptr convert_low_precisions_int(std::shared_ptr& constant, + ov::element::Type to) { // Supported integer precisions static const precisions_set_t supported_integer_precisions = {ov::element::i4, ov::element::u4, ov::element::u1}; // Get source element type and source data @@ -1208,7 +1203,7 @@ std::shared_ptr convert_low_precisions_int(std::shared_ptr(to, constant->get_shape()); + auto new_constant = std::make_shared(to, constant->get_shape()); auto* dst_data = const_cast(reinterpret_cast(new_constant->get_data_ptr())); // Check pointers if (src_data == nullptr || dst_data == nullptr) @@ -1306,7 +1301,7 @@ bool fuse_type_to_constant(const std::shared_ptr& node, if (it == precisions.end()) return false; const auto& to = it->second; - if (auto constant = ov::as_type_ptr(node)) { + if (auto constant = ov::as_type_ptr(node)) { std::shared_ptr new_const; if (from == ov::element::u64 && to == ov::element::i32) { new_const = change_constant_precision(constant); diff --git a/src/common/transformations/src/transformations/flush_fp32_subnormals_to_zero.cpp b/src/common/transformations/src/transformations/flush_fp32_subnormals_to_zero.cpp index 1d324297b34..f9176e4f9a8 100644 --- a/src/common/transformations/src/transformations/flush_fp32_subnormals_to_zero.cpp +++ b/src/common/transformations/src/transformations/flush_fp32_subnormals_to_zero.cpp @@ -9,7 +9,6 @@ #include #include "itt.hpp" -#include "openvino/opsets/opset10.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/utils/utils.hpp" @@ -20,10 +19,10 @@ using namespace pass; ov::pass::FlushFP32SubnormalsToZero::FlushFP32SubnormalsToZero() { MATCHER_SCOPE(FlushFP32SubnormalsToZero); - auto node_pattern = pattern::wrap_type(); + auto node_pattern = pattern::wrap_type(); matcher_pass_callback callback = [=](pattern::Matcher& m) { - auto node = dynamic_pointer_cast(m.get_match_root()); + auto node = dynamic_pointer_cast(m.get_match_root()); if (!node) return false; @@ -43,7 +42,7 @@ ov::pass::FlushFP32SubnormalsToZero::FlushFP32SubnormalsToZero() { if (!has_subnormals) return false; - auto new_constant = std::make_shared(ov::element::f32, node->get_shape()); + auto new_constant = std::make_shared(ov::element::f32, node->get_shape()); auto* dst_data = const_cast(new_constant->get_data_ptr()); for (size_t i = 0; i < size; ++i) { diff --git a/src/common/transformations/src/transformations/low_precision/mark_dequantization_subgraph.cpp b/src/common/transformations/src/transformations/low_precision/mark_dequantization_subgraph.cpp index 57ee1b3c207..1c1586baef0 100644 --- a/src/common/transformations/src/transformations/low_precision/mark_dequantization_subgraph.cpp +++ b/src/common/transformations/src/transformations/low_precision/mark_dequantization_subgraph.cpp @@ -4,7 +4,8 @@ #include "transformations/low_precision/mark_dequantization_subgraph.hpp" -#include "openvino/opsets/opset10.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/subtract.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/rt_info/dequantization_node.hpp" @@ -25,11 +26,12 @@ ov::pass::MarkDequantizationSubgraph::MarkDequantizationSubgraph(const element:: // Multiply // auto input_pattern = pattern::any_input(); - auto convert_pattern = pattern::wrap_type({input_pattern}, pattern::consumers_count(1)); + auto convert_pattern = pattern::wrap_type({input_pattern}, pattern::consumers_count(1)); auto zero_point_pattern = pattern::any_input(); - auto subtract_pattern = pattern::wrap_type({convert_pattern, zero_point_pattern}); - auto multiply_pattern = pattern::wrap_type({subtract_pattern, pattern::any_input()}); - auto multiply_no_subtract_pattern = pattern::wrap_type({convert_pattern, pattern::any_input()}); + auto subtract_pattern = pattern::wrap_type({convert_pattern, zero_point_pattern}); + auto multiply_pattern = pattern::wrap_type({subtract_pattern, pattern::any_input()}); + auto multiply_no_subtract_pattern = + pattern::wrap_type({convert_pattern, pattern::any_input()}); auto root = std::make_shared(OutputVector{multiply_pattern, multiply_no_subtract_pattern}); ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) -> bool { @@ -45,7 +47,7 @@ ov::pass::MarkDequantizationSubgraph::MarkDequantizationSubgraph(const element:: auto subtract_it = pattern_map.find(subtract_pattern); if (subtract_it == pattern_map.end()) { for (size_t i = 0; i < multiply->get_input_size(); i++) { - const auto node = ov::as_type_ptr(multiply->get_input_node_shared_ptr(i)); + const auto node = ov::as_type_ptr(multiply->get_input_node_shared_ptr(i)); if (node && std::find(precisions.begin(), precisions.end(), node->get_input_element_type(0)) != precisions.end()) { convert = node; @@ -65,7 +67,7 @@ ov::pass::MarkDequantizationSubgraph::MarkDequantizationSubgraph(const element:: ov::disable_constant_folding(convert); // It is also necessary to avoid precision conversion for constant nodes with input_precision auto keep_const_precision = [&](Node* node) { - if (auto constant = ov::as_type(node)) { + if (auto constant = ov::as_type(node)) { const auto& const_et = constant->get_element_type(); if (std::find(precisions.begin(), precisions.end(), const_et) != precisions.end()) ov::enable_keep_const_precision(convert->get_input_node_shared_ptr(0)); @@ -79,8 +81,9 @@ ov::pass::MarkDequantizationSubgraph::MarkDequantizationSubgraph(const element:: // mark Subtract as dequantization node ov::mark_as_dequantization_node(subtract_it->second.get_node_shared_ptr()); auto zero_point = pattern_map.at(zero_point_pattern).get_node_shared_ptr(); - if (ov::is_type(zero_point) && input_precision == zero_point->get_input_element_type(0) && - ov::is_type(zero_point->get_input_node_ptr(0))) { + if (ov::is_type(zero_point) && + input_precision == zero_point->get_input_element_type(0) && + ov::is_type(zero_point->get_input_node_ptr(0))) { if (!fold_subtract_const) { // disable ConstantFolding also for Convert on zero_point // so we don't have to constantfold it and then convert it back to diff --git a/src/common/transformations/src/transformations/op_conversions/convert_gather_to_compressed.cpp b/src/common/transformations/src/transformations/op_conversions/convert_gather_to_compressed.cpp index c2601b9a41e..e75234b2541 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_gather_to_compressed.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_gather_to_compressed.cpp @@ -9,9 +9,9 @@ #include "openvino/core/rt_info.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/convert.hpp" +#include "openvino/op/multiply.hpp" #include "openvino/op/reshape.hpp" #include "openvino/op/subtract.hpp" -#include "openvino/opsets/opset10.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "openvino/pass/pattern/op/pattern.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" @@ -49,11 +49,11 @@ ov::pass::ConvertGatherToGatherCompressed::ConvertGatherToGatherCompressed() { auto reshape_m = wrap_type({mul_m, reshape_const_m}, reshape_3d_to_2d); auto last_convert_input = std::make_shared(ov::OutputVector{reshape_m, mul_m}); - auto last_convert_m = wrap_type({last_convert_input}); + auto last_convert_m = wrap_type({last_convert_input}); auto dicts_input_m = std::make_shared(ov::OutputVector{reshape_m, last_convert_m, mul_m}); - auto gather_m = wrap_type({dicts_input_m, any_input(), wrap_type()}); + auto gather_m = wrap_type({dicts_input_m, any_input(), wrap_type()}); ov::matcher_pass_callback callback = [=](ov::pass::pattern::Matcher& m) { const auto& pattern_map = m.get_pattern_value_map(); @@ -63,7 +63,7 @@ ov::pass::ConvertGatherToGatherCompressed::ConvertGatherToGatherCompressed() { OPENVINO_ASSERT(pattern_map.count(convert_m)); ov::Shape dicts_shape = pattern_map.at(dicts_m).get_node_shared_ptr()->get_shape(); auto gather_node = - std::dynamic_pointer_cast(pattern_map.at(gather_m).get_node_shared_ptr()); + std::dynamic_pointer_cast(pattern_map.at(gather_m).get_node_shared_ptr()); if (!gather_node || transformation_callback(gather_node)) { return false; } diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms_rotated_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms_rotated_to_nms_ie_internal.cpp index 1da24df80ee..3476fc29d78 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms_rotated_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms_rotated_to_nms_ie_internal.cpp @@ -11,6 +11,7 @@ #include "openvino/core/rt_info.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/convert.hpp" +#include "openvino/op/nms_rotated.hpp" #include "openvino/op/non_max_suppression.hpp" #include "openvino/op/reshape.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" diff --git a/src/common/transformations/src/transformations/op_conversions/convert_reduce_to_reshape.cpp b/src/common/transformations/src/transformations/op_conversions/convert_reduce_to_reshape.cpp index 5b323503a36..4be20f7de70 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_reduce_to_reshape.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_reduce_to_reshape.cpp @@ -5,6 +5,13 @@ #include "transformations/op_conversions/convert_reduce_to_reshape.hpp" #include "itt.hpp" +#include "openvino/op/reduce_logical_and.hpp" +#include "openvino/op/reduce_logical_or.hpp" +#include "openvino/op/reduce_max.hpp" +#include "openvino/op/reduce_mean.hpp" +#include "openvino/op/reduce_min.hpp" +#include "openvino/op/reduce_prod.hpp" +#include "openvino/op/reduce_sum.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" bool CvtReduceBase::is_redundant(ov::Shape input, ov::Shape output) { diff --git a/src/common/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp b/src/common/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp index 0a6e8142aad..d2cd621ab24 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp @@ -14,6 +14,7 @@ #include "openvino/core/validation_util.hpp" #include "openvino/op/add.hpp" #include "openvino/op/broadcast.hpp" +#include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/gather.hpp" #include "openvino/op/gru_cell.hpp" @@ -24,12 +25,16 @@ #include "openvino/op/lstm_cell.hpp" #include "openvino/op/lstm_sequence.hpp" #include "openvino/op/parameter.hpp" +#include "openvino/op/range.hpp" #include "openvino/op/reshape.hpp" #include "openvino/op/result.hpp" +#include "openvino/op/reverse_sequence.hpp" #include "openvino/op/rnn_cell.hpp" #include "openvino/op/rnn_sequence.hpp" #include "openvino/op/scatter_nd_update.hpp" +#include "openvino/op/scatter_update.hpp" #include "openvino/op/shape_of.hpp" +#include "openvino/op/squeeze.hpp" #include "openvino/op/tensor_iterator.hpp" #include "openvino/op/transpose.hpp" #include "openvino/op/unsqueeze.hpp" @@ -559,12 +564,12 @@ ov::pass::ConvertLoopToLSTMSequence::ConvertLoopToLSTMSequence() { auto sequence_index_or_label = std::make_shared(OutputVector{sequence_index_label, sequence_index_reshaped_label}); auto gather_body_label = - pattern::wrap_type({X_body_label, sequence_index_or_label, gather_axis_label}, - pattern::rank_equals(2)); + pattern::wrap_type({X_body_label, sequence_index_or_label, gather_axis_label}, + pattern::rank_equals(2)); auto W_label = pattern::any_input(); auto R_label = pattern::any_input(); auto B_label = pattern::wrap_type(); - auto lstm_cell_label = pattern::wrap_type( + auto lstm_cell_label = pattern::wrap_type( {gather_body_label, H_body_label, C_body_label, W_label, R_label, B_label}); auto scatter_index_new_shape_label = pattern::wrap_type(); auto scatter_index_body_label = diff --git a/src/common/transformations/src/transformations/op_conversions/group_normalization_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/group_normalization_decomposition.cpp index e54cfaae6f0..a68532c827f 100644 --- a/src/common/transformations/src/transformations/op_conversions/group_normalization_decomposition.cpp +++ b/src/common/transformations/src/transformations/op_conversions/group_normalization_decomposition.cpp @@ -13,6 +13,7 @@ #include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/divide.hpp" +#include "openvino/op/group_normalization.hpp" #include "openvino/op/multiply.hpp" #include "openvino/op/mvn.hpp" #include "openvino/op/parameter.hpp" diff --git a/src/common/transformations/src/transformations/rt_info/primitives_priority_attribute.cpp b/src/common/transformations/src/transformations/rt_info/primitives_priority_attribute.cpp index 3f2331f399b..634a86a0c6d 100644 --- a/src/common/transformations/src/transformations/rt_info/primitives_priority_attribute.cpp +++ b/src/common/transformations/src/transformations/rt_info/primitives_priority_attribute.cpp @@ -12,7 +12,9 @@ #include #include "openvino/core/node.hpp" -#include "openvino/opsets/opset1.hpp" +#include "openvino/op/convolution.hpp" +#include "openvino/op/group_conv.hpp" +#include "openvino/op/matmul.hpp" using namespace ov; @@ -31,11 +33,11 @@ std::string ov::getPrimitivesPriority(const std::shared_ptr& node) { Any PrimitivesPriority::merge(const ov::NodeVector& nodes) const { auto canBeMerged = [](const std::shared_ptr& node) -> bool { - if (std::dynamic_pointer_cast(node) || - std::dynamic_pointer_cast(node) || - std::dynamic_pointer_cast(node) || - std::dynamic_pointer_cast(node) || - std::dynamic_pointer_cast(node)) { + if (std::dynamic_pointer_cast(node) || + std::dynamic_pointer_cast(node) || + std::dynamic_pointer_cast(node) || + std::dynamic_pointer_cast(node) || + std::dynamic_pointer_cast(node)) { return true; } return false; diff --git a/src/common/transformations/src/transformations/symbolic_transformations/dereshape_matmul.cpp b/src/common/transformations/src/transformations/symbolic_transformations/dereshape_matmul.cpp index de35c596a64..f5ee0222c5f 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/dereshape_matmul.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/dereshape_matmul.cpp @@ -9,9 +9,11 @@ #include "openvino/core/validation_util.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/convert.hpp" +#include "openvino/op/divide.hpp" #include "openvino/op/matmul.hpp" #include "openvino/op/reshape.hpp" #include "openvino/op/util/binary_elementwise_arithmetic.hpp" +#include "openvino/op/util/op_types.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/symbolic_transformations/utils.hpp" diff --git a/src/common/transformations/src/transformations/symbolic_transformations/reshape_optimizations.cpp b/src/common/transformations/src/transformations/symbolic_transformations/reshape_optimizations.cpp index 804d3c8d9bc..eee0c5d4db4 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/reshape_optimizations.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/reshape_optimizations.cpp @@ -6,6 +6,7 @@ #include "compare.hpp" #include "itt.hpp" +#include "openvino/op/reshape.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/symbolic_transformations/utils.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/src/transformations/symbolic_transformations/symbolic_optimizations.cpp b/src/common/transformations/src/transformations/symbolic_transformations/symbolic_optimizations.cpp index 1886fb8ab39..1c6cd30db15 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/symbolic_optimizations.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/symbolic_optimizations.cpp @@ -7,7 +7,11 @@ #include "itt.hpp" #include "openvino/core/descriptor_tensor.hpp" #include "openvino/core/validation_util.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/range.hpp" #include "openvino/op/reshape.hpp" +#include "openvino/op/select.hpp" +#include "openvino/op/softmax.hpp" #include "openvino/op/util/symbolic_info.hpp" #include "openvino/pass/manager.hpp" #include "openvino/pass/pattern/op/or.hpp" diff --git a/src/common/transformations/src/transformations/transpose_sinking/ts_binary.cpp b/src/common/transformations/src/transformations/transpose_sinking/ts_binary.cpp index 4f383c50b59..206bb9faaac 100644 --- a/src/common/transformations/src/transformations/transpose_sinking/ts_binary.cpp +++ b/src/common/transformations/src/transformations/transpose_sinking/ts_binary.cpp @@ -9,6 +9,10 @@ #include "openvino/op/fake_quantize.hpp" #include "openvino/op/prelu.hpp" #include "openvino/op/transpose.hpp" +#include "openvino/op/unsqueeze.hpp" +#include "openvino/op/util/binary_elementwise_arithmetic.hpp" +#include "openvino/op/util/binary_elementwise_comparison.hpp" +#include "openvino/op/util/binary_elementwise_logical.hpp" #include "openvino/op/util/op_types.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" diff --git a/src/common/transformations/src/transformations/transpose_sinking/ts_shape_of.cpp b/src/common/transformations/src/transformations/transpose_sinking/ts_shape_of.cpp index 2d6e73dd639..a82b168a04b 100644 --- a/src/common/transformations/src/transformations/transpose_sinking/ts_shape_of.cpp +++ b/src/common/transformations/src/transformations/transpose_sinking/ts_shape_of.cpp @@ -5,6 +5,7 @@ #include "transformations/transpose_sinking/ts_shape_of.hpp" #include "itt.hpp" +#include "openvino/op/gather.hpp" #include "openvino/op/util/shape_of_base.hpp" #include "transformations/transpose_sinking/ts_utils.hpp" diff --git a/src/common/transformations/src/transformations/transpose_sinking/ts_unary.cpp b/src/common/transformations/src/transformations/transpose_sinking/ts_unary.cpp index 0af6166dddb..b4859c1febc 100644 --- a/src/common/transformations/src/transformations/transpose_sinking/ts_unary.cpp +++ b/src/common/transformations/src/transformations/transpose_sinking/ts_unary.cpp @@ -10,11 +10,17 @@ #include "openvino/op/clamp.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/convert.hpp" +#include "openvino/op/convert_like.hpp" #include "openvino/op/elu.hpp" +#include "openvino/op/hard_sigmoid.hpp" #include "openvino/op/is_finite.hpp" #include "openvino/op/is_inf.hpp" +#include "openvino/op/is_nan.hpp" +#include "openvino/op/log_softmax.hpp" #include "openvino/op/logical_not.hpp" +#include "openvino/op/selu.hpp" #include "openvino/op/softplus.hpp" +#include "openvino/op/swish.hpp" #include "openvino/op/transpose.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" diff --git a/src/common/transformations/src/transformations/utils/utils.cpp b/src/common/transformations/src/transformations/utils/utils.cpp index df1edc05b67..d162e5701ba 100644 --- a/src/common/transformations/src/transformations/utils/utils.cpp +++ b/src/common/transformations/src/transformations/utils/utils.cpp @@ -10,13 +10,21 @@ #include #include "openvino/core/validation_util.hpp" +#include "openvino/op/add.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/constant.hpp" +#include "openvino/op/divide.hpp" #include "openvino/op/gather.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/parameter.hpp" +#include "openvino/op/relu.hpp" #include "openvino/op/reshape.hpp" +#include "openvino/op/shape_of.hpp" +#include "openvino/op/sigmoid.hpp" +#include "openvino/op/subtract.hpp" +#include "openvino/op/tanh.hpp" #include "openvino/op/util/multi_subgraph_base.hpp" -#include "openvino/opsets/opset1.hpp" -#include "openvino/opsets/opset3.hpp" +#include "openvino/op/util/shape_of_base.hpp" namespace ov { namespace op { @@ -151,11 +159,11 @@ bool check_for_broadcast(const ov::PartialShape& ref_shape, const ov::PartialSha std::shared_ptr activation(const std::string& activation_name, const ov::Output& apply_to) { if (activation_name == "relu") { - return std::make_shared(apply_to); + return std::make_shared(apply_to); } else if (activation_name == "sigmoid") { - return std::make_shared(apply_to); + return std::make_shared(apply_to); } else if (activation_name == "tanh") { - return std::make_shared(apply_to); + return std::make_shared(apply_to); } else { OPENVINO_THROW("Unsupported activation function"); } @@ -277,21 +285,22 @@ bool shapes_equal_except_dynamic_expected_batch(const ov::PartialShape& expected void visit_shape_path(Node* node, std::unordered_set& visited, std::function func) { auto is_shapeof = [](ov::Node* node) { - return ov::is_type(node) || ov::is_type(node); + return ov::is_type(node) || ov::is_type(node); }; visit_path_impl(node, visited, func, is_shapeof); } void visit_constant_path(ov::Node* node, std::unordered_set& visited, std::function func) { auto check_parameter = [](ov::Node* node) { - OPENVINO_ASSERT(!ov::is_type(node), "visit_constant_path is called for non-constant path."); + OPENVINO_ASSERT(!ov::is_type(node), + "visit_constant_path is called for non-constant path."); return false; }; visit_path_impl(node, visited, func, check_parameter); } bool is_dequantization_subgraph(const Output& node) { - if (!is_type(node.get_node())) { + if (!is_type(node.get_node())) { return false; } @@ -299,9 +308,9 @@ bool is_dequantization_subgraph(const Output& node) { Node* sub = nullptr; Node* convert = nullptr; - if (is_type(mul_inputs[0].get_node())) { + if (is_type(mul_inputs[0].get_node())) { sub = mul_inputs[0].get_node(); - } else if (is_type(mul_inputs[0].get_node())) { + } else if (is_type(mul_inputs[0].get_node())) { convert = mul_inputs[0].get_node(); } else { return false; @@ -309,7 +318,7 @@ bool is_dequantization_subgraph(const Output& node) { if (sub) { auto sub_inputs = sub->input_values(); - if (is_type(sub_inputs[0].get_node())) { + if (is_type(sub_inputs[0].get_node())) { convert = sub_inputs[0].get_node(); } } @@ -326,8 +335,8 @@ bool is_dequantization_subgraph(const Output& node) { bool can_eliminate_eltwise_node(const std::shared_ptr& eltwise, const Output& constant, const Output& non_constant_input) { - if (!is_type(eltwise) && !is_type(eltwise) && !is_type(eltwise) && - !is_type(eltwise)) { + if (!is_type(eltwise) && !is_type(eltwise) && + !is_type(eltwise) && !is_type(eltwise)) { return false; } @@ -336,7 +345,7 @@ bool can_eliminate_eltwise_node(const std::shared_ptr& eltwise, } // check if constant has a single value with either 0 (for Add, Subtract) or 1 (for Multiply, Divide) - auto constant_ptr = std::dynamic_pointer_cast(constant.get_node_shared_ptr()); + auto constant_ptr = std::dynamic_pointer_cast(constant.get_node_shared_ptr()); if (!constant_ptr) { return false; } @@ -383,7 +392,7 @@ bool can_eliminate_eltwise_node(const std::shared_ptr& eltwise, return false; } float expected_const = 0; - if (is_type(eltwise) || is_type(eltwise)) { + if (is_type(eltwise) || is_type(eltwise)) { expected_const = 1; } if (actual_const != expected_const) { diff --git a/src/common/transformations/tests/common_optimizations/fuse_rotary_positional_embeddings.cpp b/src/common/transformations/tests/common_optimizations/fuse_rotary_positional_embeddings.cpp index 1d7423e14b8..8d1dd936fc2 100644 --- a/src/common/transformations/tests/common_optimizations/fuse_rotary_positional_embeddings.cpp +++ b/src/common/transformations/tests/common_optimizations/fuse_rotary_positional_embeddings.cpp @@ -7,7 +7,11 @@ #include #include "common_test_utils/ov_test_utils.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/concat.hpp" +#include "openvino/op/multiply.hpp" #include "openvino/op/parameter.hpp" +#include "openvino/op/split.hpp" #include "openvino/op/variadic_split.hpp" #include "ov_ops/rotary_positional_embeddings.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/tests/common_optimizations/gelu_fusion.cpp b/src/common/transformations/tests/common_optimizations/gelu_fusion.cpp index e2769724bc4..837d2ba6d45 100644 --- a/src/common/transformations/tests/common_optimizations/gelu_fusion.cpp +++ b/src/common/transformations/tests/common_optimizations/gelu_fusion.cpp @@ -20,6 +20,7 @@ #include "openvino/op/constant.hpp" #include "openvino/op/divide.hpp" #include "openvino/op/erf.hpp" +#include "openvino/op/gelu.hpp" #include "openvino/op/multiply.hpp" #include "openvino/op/parameter.hpp" #include "openvino/op/power.hpp" diff --git a/src/common/transformations/tests/common_optimizations/nop_elimination.cpp b/src/common/transformations/tests/common_optimizations/nop_elimination.cpp index 3ec700ef062..46a85d40619 100644 --- a/src/common/transformations/tests/common_optimizations/nop_elimination.cpp +++ b/src/common/transformations/tests/common_optimizations/nop_elimination.cpp @@ -16,9 +16,7 @@ #include "common_test_utils/ov_test_utils.hpp" #include "common_test_utils/test_common.hpp" #include "openvino/core/model.hpp" -#include "openvino/opsets/opset1.hpp" -#include "openvino/opsets/opset10.hpp" -#include "openvino/opsets/opset9.hpp" +#include "openvino/op/ops.hpp" #include "openvino/pass/constant_folding.hpp" #include "openvino/pass/manager.hpp" #include "transformations/init_node_info.hpp" @@ -147,20 +145,20 @@ TEST(nop_elimination, reshape_v1_1D) { TEST(nop_elimination, squeeze_reshape_elimination_check_info) { std::shared_ptr f; { - auto arg = std::make_shared(element::f32, PartialShape{8, 16, 1, 3}); + auto arg = std::make_shared(element::f32, PartialShape{8, 16, 1, 3}); - auto relu = std::make_shared(arg); + auto relu = std::make_shared(arg); relu->set_friendly_name("relu"); - auto squeeze_axes = opset4::Constant::create(element::i64, Shape{1}, {2}); - auto squeeze = std::make_shared(relu, squeeze_axes); + auto squeeze_axes = ov::op::v0::Constant::create(element::i64, Shape{1}, {2}); + auto squeeze = std::make_shared(relu, squeeze_axes); squeeze->set_friendly_name("squeeze"); - auto reshape_shape = opset4::Constant::create(element::i64, Shape{4}, {8, 16, 1, 3}); - auto reshape = std::make_shared(squeeze, reshape_shape, false); + auto reshape_shape = ov::op::v0::Constant::create(element::i64, Shape{4}, {8, 16, 1, 3}); + auto reshape = std::make_shared(squeeze, reshape_shape, false); reshape->set_friendly_name("reshape"); - auto abs = std::make_shared(reshape); + auto abs = std::make_shared(reshape); f = std::make_shared(NodeVector{abs}, ParameterVector{arg}); } @@ -182,20 +180,20 @@ TEST(nop_elimination, squeeze_reshape_elimination_check_info) { TEST(nop_elimination, squeeze_unsqueeze_elimination) { std::shared_ptr f; { - auto arg = std::make_shared(element::f32, PartialShape{8, 16, 1, 3}); + auto arg = std::make_shared(element::f32, PartialShape{8, 16, 1, 3}); - auto relu = std::make_shared(arg); + auto relu = std::make_shared(arg); relu->set_friendly_name("relu"); - auto squeeze_axes = opset4::Constant::create(element::i64, Shape{1}, {2}); - auto squeeze = std::make_shared(relu, squeeze_axes); + auto squeeze_axes = ov::op::v0::Constant::create(element::i64, Shape{1}, {2}); + auto squeeze = std::make_shared(relu, squeeze_axes); squeeze->set_friendly_name("squeeze"); - auto unsqueeze_axes = opset4::Constant::create(element::i64, Shape{1}, {2}); - auto unsqueeze = std::make_shared(squeeze, unsqueeze_axes); + auto unsqueeze_axes = ov::op::v0::Constant::create(element::i64, Shape{1}, {2}); + auto unsqueeze = std::make_shared(squeeze, unsqueeze_axes); unsqueeze->set_friendly_name("unsqueeze"); - auto abs = std::make_shared(unsqueeze); + auto abs = std::make_shared(unsqueeze); f = std::make_shared(NodeVector{abs}, ParameterVector{arg}); } @@ -217,13 +215,13 @@ TEST(nop_elimination, squeeze_unsqueeze_elimination) { TEST(nop_elimination, squeeze_unsqueeze_elimination_dynamic_without_squeeze_axis) { std::shared_ptr f; { - auto arg = std::make_shared(element::f32, PartialShape{-1, 16, 1, 3}); + auto arg = std::make_shared(element::f32, PartialShape{-1, 16, 1, 3}); - auto squeeze = std::make_shared(arg); + auto squeeze = std::make_shared(arg); squeeze->set_friendly_name("squeeze"); - auto unsqueeze_axes = opset4::Constant::create(element::i64, Shape{1}, {2}); - auto unsqueeze = std::make_shared(squeeze, unsqueeze_axes); + auto unsqueeze_axes = ov::op::v0::Constant::create(element::i64, Shape{1}, {2}); + auto unsqueeze = std::make_shared(squeeze, unsqueeze_axes); unsqueeze->set_friendly_name("unsqueeze"); f = std::make_shared(NodeVector{unsqueeze}, ParameterVector{arg}); @@ -250,17 +248,17 @@ TEST(nop_elimination, reshape_elimination_v1_dynamic) { TEST(nop_elimination, reshape_elimination_v1_check_consumer_count) { std::shared_ptr f; { - auto arg = std::make_shared(element::f32, PartialShape{8, 16, 1, 3}); + auto arg = std::make_shared(element::f32, PartialShape{8, 16, 1, 3}); - auto reshape_1_shape = opset4::Constant::create(element::i64, Shape{2}, {128, 3}); - auto reshape_1 = std::make_shared(arg, reshape_1_shape, false); + auto reshape_1_shape = ov::op::v0::Constant::create(element::i64, Shape{2}, {128, 3}); + auto reshape_1 = std::make_shared(arg, reshape_1_shape, false); reshape_1->set_friendly_name("reshape_1"); - auto reshape_2_shape = opset4::Constant::create(element::i64, Shape{4}, {8, 16, 1, 3}); - auto reshape_2 = std::make_shared(reshape_1, reshape_2_shape, false); + auto reshape_2_shape = ov::op::v0::Constant::create(element::i64, Shape{4}, {8, 16, 1, 3}); + auto reshape_2 = std::make_shared(reshape_1, reshape_2_shape, false); reshape_2->set_friendly_name("reshape_2"); - auto relu = std::make_shared(reshape_1); + auto relu = std::make_shared(reshape_1); relu->set_friendly_name("relu"); f = std::make_shared(NodeVector{reshape_2, relu}, ParameterVector{arg}); @@ -809,14 +807,14 @@ TEST(nop_elimination, squeeze_unsqueeze_elimination_negative) { auto check_usecase = [](const Shape& shape, const std::vector& indices_val) { auto indices = op::v0::Constant::create(element::i64, Shape{indices_val.size()}, indices_val); auto input = make_shared(element::f32, shape); - auto squeeze = make_shared(input, indices); + auto squeeze = make_shared(input, indices); auto baseline_f = make_shared(squeeze, ParameterVector{input}); auto optimized_f = baseline_f->clone(); pass::Manager manager; manager.register_pass(); manager.run_passes(optimized_f); - ASSERT_EQ(count_ops_of_type(baseline_f), 1); - ASSERT_EQ(count_ops_of_type(optimized_f), 1); + ASSERT_EQ(count_ops_of_type(baseline_f), 1); + ASSERT_EQ(count_ops_of_type(optimized_f), 1); }; check_usecase(Shape{1, 1, 1}, std::vector{0, 1, 2}); @@ -1043,7 +1041,7 @@ TEST_P(EliminateEltwiseTests, eliminate_eltwise) { } if (type_params.op_type == OpType::SUBTRACT_WITH_CONVERT) { - constant = std::make_shared(constant, type); + constant = std::make_shared(constant, type); } shared_ptr A = parameter; @@ -1059,28 +1057,28 @@ TEST_P(EliminateEltwiseTests, eliminate_eltwise) { shared_ptr node; switch (type_params.op_type) { case OpType::ADD: - node = make_shared(A, B); + node = make_shared(A, B); break; case OpType::SUBTRACT: case OpType::SUBTRACT_WITH_CONVERT: - node = make_shared(A, B); + node = make_shared(A, B); break; case OpType::MULTIPLY: - node = make_shared(A, B); + node = make_shared(A, B); break; case OpType::DIVIDE: - node = make_shared(A, B); + node = make_shared(A, B); break; default: ASSERT_FALSE(true) << "Invalid OpType"; } - auto abs = make_shared(node); + auto abs = make_shared(node); model = make_shared(abs, ParameterVector{parameter}); manager.register_pass(); if (can_fuse) { - auto abs = make_shared(parameter); + auto abs = make_shared(parameter); model_ref = make_shared(abs, ParameterVector{parameter}); } @@ -1153,16 +1151,16 @@ INSTANTIATE_TEST_SUITE_P(EliminateEltwise, TEST_F(TransformationTestsF, eliminate_eltwise_dequantization_subgraph) { { - auto constant = opset8::Constant::create(element::i8, Shape{}, {2}); - auto convert = make_shared(constant, element::f32); - auto sub = make_shared(convert, opset8::Constant::create(element::f32, Shape{}, {0})); - auto mul = make_shared(sub, opset8::Constant::create(element::f32, Shape{}, {1})); + auto constant = ov::op::v0::Constant::create(element::i8, Shape{}, {2}); + auto convert = make_shared(constant, element::f32); + auto sub = make_shared(convert, ov::op::v0::Constant::create(element::f32, Shape{}, {0})); + auto mul = make_shared(sub, ov::op::v0::Constant::create(element::f32, Shape{}, {1})); model = make_shared(mul, ParameterVector{}); } { - auto constant = opset8::Constant::create(element::i8, Shape{}, {2}); - auto convert = make_shared(constant, element::f32); - auto mul = make_shared(convert, opset8::Constant::create(element::f32, Shape{}, {1})); + auto constant = ov::op::v0::Constant::create(element::i8, Shape{}, {2}); + auto convert = make_shared(constant, element::f32); + auto mul = make_shared(convert, ov::op::v0::Constant::create(element::f32, Shape{}, {1})); model_ref = make_shared(mul, ParameterVector{}); } @@ -1204,51 +1202,51 @@ TEST_P(SplitConcatElimination, eliminate_split_concat_subgraph) { EXPECT_TRUE(seq_len % p.split_len == 0) << "Seq_len must be divisible by split_len."; ParameterVector params; - auto param = make_shared(element::f32, Shape{batch, seq_len, input_size}); + auto param = make_shared(element::f32, Shape{batch, seq_len, input_size}); shared_ptr data = param; shared_ptr sequence; auto gate = static_cast(p.rnn_type); - auto axis_const = make_shared(element::i64, Shape{}, p.split_axis); - auto H = make_shared(element::f32, Shape{batch, num_dir, hidden_size}); - auto C = make_shared(element::f32, Shape{batch, num_dir, hidden_size}); - auto seq_lengths = make_shared(element::i64, Shape{batch}); - auto W = make_shared(element::f32, Shape{num_dir, gate * hidden_size, input_size}); - auto R = make_shared(element::f32, Shape{num_dir, gate * hidden_size, hidden_size}); - auto B = make_shared(element::f32, Shape{num_dir, gate * hidden_size}); + auto axis_const = make_shared(element::i64, Shape{}, p.split_axis); + auto H = make_shared(element::f32, Shape{batch, num_dir, hidden_size}); + auto C = make_shared(element::f32, Shape{batch, num_dir, hidden_size}); + auto seq_lengths = make_shared(element::i64, Shape{batch}); + auto W = make_shared(element::f32, Shape{num_dir, gate * hidden_size, input_size}); + auto R = make_shared(element::f32, Shape{num_dir, gate * hidden_size, hidden_size}); + auto B = make_shared(element::f32, Shape{num_dir, gate * hidden_size}); auto direction = op::RecurrentSequenceDirection::FORWARD; if (p.rnn_type == RNNType::RNN) { - sequence = make_shared(data, H, seq_lengths, W, R, B, hidden_size, direction); - data = make_shared(sequence->output(0), axis_const); + sequence = make_shared(data, H, seq_lengths, W, R, B, hidden_size, direction); + data = make_shared(sequence->output(0), axis_const); params = {H, seq_lengths, W, R, B}; } else if (p.rnn_type == RNNType::GRU) { - sequence = make_shared(data, H, seq_lengths, W, R, B, hidden_size, direction); - data = make_shared(sequence->output(0), axis_const); + sequence = make_shared(data, H, seq_lengths, W, R, B, hidden_size, direction); + data = make_shared(sequence->output(0), axis_const); params = {H, seq_lengths, W, R, B}; } else if (p.rnn_type == RNNType::LSTM) { - sequence = make_shared(data, H, C, seq_lengths, W, R, B, hidden_size, direction); - data = make_shared(sequence->output(0), axis_const); + sequence = make_shared(data, H, C, seq_lengths, W, R, B, hidden_size, direction); + data = make_shared(sequence->output(0), axis_const); params = {H, C, seq_lengths, W, R, B}; } params.push_back(param); shared_ptr split; if (p.split_type == SplitType::Split) { - split = make_shared(data->output(0), axis_const, p.seq_len / p.split_len); + split = make_shared(data->output(0), axis_const, p.seq_len / p.split_len); } else if (p.split_type == SplitType::VariadicSplit) { - auto split_lengths = make_shared(element::i64, + auto split_lengths = make_shared(element::i64, Shape{seq_len / p.split_len}, std::vector(seq_len / p.split_len, p.split_len)); - split = make_shared(data->output(0), axis_const, split_lengths); + split = make_shared(data->output(0), axis_const, split_lengths); } auto outputs_to_concat = split->outputs(); if (sequence) { outputs_to_concat[outputs_to_concat.size() - 1] = sequence->output(1); } - auto concat = make_shared(outputs_to_concat, p.concat_axis); - auto sigmoid = make_shared(concat); - auto res = make_shared(sigmoid); + auto concat = make_shared(outputs_to_concat, p.concat_axis); + auto sigmoid = make_shared(concat); + auto res = make_shared(sigmoid); auto model = make_shared(ResultVector{res}, ParameterVector{params}); pass::Manager pass_manager; @@ -1259,11 +1257,11 @@ TEST_P(SplitConcatElimination, eliminate_split_concat_subgraph) { // the transformation won't be applied if split_len is not equal to 1 size_t expect_concat = p.split_len == 1 ? 0 : 1; size_t expect_split = p.split_len == 1 ? 0 : 1; - EXPECT_EQ(count_ops_of_type(model), expect_concat) + EXPECT_EQ(count_ops_of_type(model), expect_concat) << "SplitConcatElimination transformation has failed. " "The number of Concat ops is not " + to_string(expect_concat); - EXPECT_EQ(count_ops_of_type(model) + count_ops_of_type(model), + EXPECT_EQ(count_ops_of_type(model) + count_ops_of_type(model), expect_split) << "SplitConcatElimination transformation has failed. " "The number of Split/VariadicSplit ops is not " + @@ -1288,17 +1286,17 @@ INSTANTIATE_TEST_SUITE_P(SplitConcatElimination, SplitConcatElimination, testing TEST(SplitConcatElimination, split_inputs_not_in_order) { int64_t axis = 1; - auto axis_const = make_shared(element::i64, Shape{}, axis); + auto axis_const = make_shared(element::i64, Shape{}, axis); - auto param = make_shared(element::f32, Shape{2, 10}); - auto split = make_shared(param->output(0), axis_const, 10); + auto param = make_shared(element::f32, Shape{2, 10}); + auto split = make_shared(param->output(0), axis_const, 10); OutputVector outputs_to_concat = split->outputs(); // change order of inputs to Concat, in this case the transformation won't be applied std::reverse(outputs_to_concat.begin(), outputs_to_concat.end()); - auto concat = make_shared(outputs_to_concat, axis); - auto sigmoid = make_shared(concat); - auto res = make_shared(sigmoid); + auto concat = make_shared(outputs_to_concat, axis); + auto sigmoid = make_shared(concat); + auto res = make_shared(sigmoid); auto model = make_shared(ResultVector{res}, ParameterVector{param}); pass::Manager pass_manager; @@ -1306,25 +1304,25 @@ TEST(SplitConcatElimination, split_inputs_not_in_order) { pass_manager.register_pass(); pass_manager.run_passes(model); // the transformation shouldn't be applied - EXPECT_EQ(count_ops_of_type(model), 1) << "SplitConcatElimination transformation has failed. " + EXPECT_EQ(count_ops_of_type(model), 1) << "SplitConcatElimination transformation has failed. " "The number of Concat ops is not 1"; - EXPECT_EQ(count_ops_of_type(model), 1) << "SplitConcatElimination transformation has failed. " + EXPECT_EQ(count_ops_of_type(model), 1) << "SplitConcatElimination transformation has failed. " "The number of Split ops is not 1"; } TEST(SplitConcatElimination, no_sequence_found) { int64_t axis = 1; - auto axis_const = make_shared(element::i64, Shape{}, axis); + auto axis_const = make_shared(element::i64, Shape{}, axis); - auto param = make_shared(element::f32, Shape{2, 10}); - auto param_2 = make_shared(element::f32, Shape{2, 1}); - auto split = make_shared(param->output(0), axis_const, 10); + auto param = make_shared(element::f32, Shape{2, 10}); + auto param_2 = make_shared(element::f32, Shape{2, 1}); + auto split = make_shared(param->output(0), axis_const, 10); OutputVector outputs_to_concat = split->outputs(); outputs_to_concat[outputs_to_concat.size() - 1] = param_2; - auto concat = make_shared(outputs_to_concat, axis); - auto sigmoid = make_shared(concat); - auto res = make_shared(sigmoid); + auto concat = make_shared(outputs_to_concat, axis); + auto sigmoid = make_shared(concat); + auto res = make_shared(sigmoid); auto model = make_shared(ResultVector{res}, ParameterVector{param, param_2}); pass::Manager pass_manager; @@ -1332,9 +1330,9 @@ TEST(SplitConcatElimination, no_sequence_found) { pass_manager.register_pass(); pass_manager.run_passes(model); // the transformation shouldn't be applied - EXPECT_EQ(count_ops_of_type(model), 1) << "SplitConcatElimination transformation has failed. " + EXPECT_EQ(count_ops_of_type(model), 1) << "SplitConcatElimination transformation has failed. " "The number of Concat ops is not 1"; - EXPECT_EQ(count_ops_of_type(model), 1) << "SplitConcatElimination transformation has failed. " + EXPECT_EQ(count_ops_of_type(model), 1) << "SplitConcatElimination transformation has failed. " "The number of Split ops is not 1"; } @@ -1396,84 +1394,84 @@ TEST(nop_elimination, not_gather_to_squeeze_with_vector_indices) { TEST_F(TransformationTestsF, Nopv1Broadcast) { { - auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); - auto broadcast_shape = opset10::Constant::create(element::i32, Shape{4}, {1, 1, 1, 1}); + auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); + auto broadcast_shape = ov::op::v0::Constant::create(element::i32, Shape{4}, {1, 1, 1, 1}); auto broadcast = std::make_shared(data, broadcast_shape); auto relu = std::make_shared(broadcast); - auto result = std::make_shared(relu); + auto result = std::make_shared(relu); model = std::make_shared(ResultVector{result}, ParameterVector{data}); manager.register_pass(); } { - auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); + auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); auto relu = std::make_shared(data); - auto result = std::make_shared(relu); + auto result = std::make_shared(relu); model_ref = std::make_shared(ResultVector{result}, ParameterVector{data}); } } TEST_F(TransformationTestsF, Nopv3Broadcast) { { - auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); - auto broadcast_shape = opset10::Constant::create(element::i32, Shape{4}, {1, 1, 1, 1}); + auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); + auto broadcast_shape = ov::op::v0::Constant::create(element::i32, Shape{4}, {1, 1, 1, 1}); auto broadcast = std::make_shared(data, broadcast_shape); auto relu = std::make_shared(broadcast); - auto result = std::make_shared(relu); + auto result = std::make_shared(relu); model = std::make_shared(ResultVector{result}, ParameterVector{data}); manager.register_pass(); } { - auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); + auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); auto relu = std::make_shared(data); - auto result = std::make_shared(relu); + auto result = std::make_shared(relu); model_ref = std::make_shared(ResultVector{result}, ParameterVector{data}); } } TEST_F(TransformationTestsF, NopTile) { { - auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); - auto repeats = opset10::Constant::create(element::i32, Shape{4}, {1, 1, 1, 1}); + auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); + auto repeats = ov::op::v0::Constant::create(element::i32, Shape{4}, {1, 1, 1, 1}); auto tile = std::make_shared(data, repeats); auto relu = std::make_shared(tile); - auto result = std::make_shared(relu); + auto result = std::make_shared(relu); model = std::make_shared(ResultVector{result}, ParameterVector{data}); manager.register_pass(); } { - auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); + auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); auto relu = std::make_shared(data); - auto result = std::make_shared(relu); + auto result = std::make_shared(relu); model_ref = std::make_shared(ResultVector{result}, ParameterVector{data}); } } TEST_F(TransformationTestsF, NopSliceBeforeGatherElements) { { - auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); + auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); - auto start = opset10::Constant::create(element::i32, Shape{1}, {0}); - auto stop = opset10::Constant::create(element::i32, Shape{1}, {2}); - auto step = opset10::Constant::create(element::i32, Shape{1}, {1}); - auto axis = opset10::Constant::create(element::i32, Shape{1}, {-1}); + auto start = ov::op::v0::Constant::create(element::i32, Shape{1}, {0}); + auto stop = ov::op::v0::Constant::create(element::i32, Shape{1}, {2}); + auto step = ov::op::v0::Constant::create(element::i32, Shape{1}, {1}); + auto axis = ov::op::v0::Constant::create(element::i32, Shape{1}, {-1}); auto slice = std::make_shared(data, start, stop, step, axis); - auto indices = std::make_shared(element::i64, PartialShape{-1, -1, -1, -1}); + auto indices = std::make_shared(element::i64, PartialShape{-1, -1, -1, -1}); auto gather_elements = std::make_shared(slice, indices, 2); auto relu = std::make_shared(gather_elements); - auto result = std::make_shared(relu); + auto result = std::make_shared(relu); model = std::make_shared(ResultVector{result}, ParameterVector{data, indices}); manager.register_pass(); } { - auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); - auto indices = std::make_shared(element::i64, PartialShape{-1, -1, -1, -1}); + auto data = std::make_shared(element::f32, PartialShape{-1, -1, -1, -1}); + auto indices = std::make_shared(element::i64, PartialShape{-1, -1, -1, -1}); auto gather_elements = std::make_shared(data, indices, 2); auto relu = std::make_shared(gather_elements); - auto result = std::make_shared(relu); + auto result = std::make_shared(relu); model_ref = std::make_shared(ResultVector{result}, ParameterVector{data, indices}); } } @@ -1628,7 +1626,7 @@ TEST_F(TransformationTestsF, SqueezeBinaryReshape) { manager.register_pass(); } { - auto data = std::make_shared(element::f32, PartialShape{1}); + auto data = std::make_shared(element::f32, PartialShape{1}); auto binary = std::make_shared(data, op::v0::Constant::create(element::f32, Shape{1}, {0.2})); auto relu = std::make_shared(binary); model_ref = std::make_shared(OutputVector{relu}, ParameterVector{data}); diff --git a/src/common/transformations/tests/op_conversions/convert_reduce_to_reshape.cpp b/src/common/transformations/tests/op_conversions/convert_reduce_to_reshape.cpp index 4023c0d0552..58e9d329ff1 100644 --- a/src/common/transformations/tests/op_conversions/convert_reduce_to_reshape.cpp +++ b/src/common/transformations/tests/op_conversions/convert_reduce_to_reshape.cpp @@ -7,6 +7,13 @@ #include #include "common_test_utils/ov_test_utils.hpp" +#include "openvino/op/reduce_logical_and.hpp" +#include "openvino/op/reduce_logical_or.hpp" +#include "openvino/op/reduce_max.hpp" +#include "openvino/op/reduce_mean.hpp" +#include "openvino/op/reduce_min.hpp" +#include "openvino/op/reduce_prod.hpp" +#include "openvino/op/reduce_sum.hpp" #include "openvino/opsets/opset.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/tests/op_conversions/convert_subtract.cpp b/src/common/transformations/tests/op_conversions/convert_subtract.cpp index e9457e56087..fb835d0cdb5 100644 --- a/src/common/transformations/tests/op_conversions/convert_subtract.cpp +++ b/src/common/transformations/tests/op_conversions/convert_subtract.cpp @@ -7,6 +7,7 @@ #include #include "common_test_utils/ov_test_utils.hpp" +#include "openvino/opsets/opset8.hpp" #include "transformations/low_precision/mark_dequantization_subgraph.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/tests/symbolic_transformations/dereshape_matmul.cpp b/src/common/transformations/tests/symbolic_transformations/dereshape_matmul.cpp index 16d21d3fa4e..0d5c3e23567 100644 --- a/src/common/transformations/tests/symbolic_transformations/dereshape_matmul.cpp +++ b/src/common/transformations/tests/symbolic_transformations/dereshape_matmul.cpp @@ -10,9 +10,14 @@ #include "common_test_utils/type_prop.hpp" #include "openvino/core/model.hpp" #include "openvino/core/validation_util.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/concat.hpp" +#include "openvino/op/divide.hpp" #include "openvino/op/matmul.hpp" +#include "openvino/op/multiply.hpp" #include "openvino/op/parameter.hpp" #include "openvino/op/reshape.hpp" +#include "openvino/op/util/op_types.hpp" #include "transformations/utils/utils.hpp" using namespace ov; diff --git a/src/common/transformations/tests/transpose_sinking/ts_reset_no_sinking_attribute.cpp b/src/common/transformations/tests/transpose_sinking/ts_reset_no_sinking_attribute.cpp index 7897bd088f5..fe7651d7e6b 100644 --- a/src/common/transformations/tests/transpose_sinking/ts_reset_no_sinking_attribute.cpp +++ b/src/common/transformations/tests/transpose_sinking/ts_reset_no_sinking_attribute.cpp @@ -10,6 +10,9 @@ #include #include "common_test_utils/ov_test_utils.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/parameter.hpp" +#include "openvino/op/transpose.hpp" #include "transformations/rt_info/transpose_sinking_attr.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/tests/transpose_sinking/ts_shape_of_test.cpp b/src/common/transformations/tests/transpose_sinking/ts_shape_of_test.cpp index a8a7c77b74c..d9461f71baf 100644 --- a/src/common/transformations/tests/transpose_sinking/ts_shape_of_test.cpp +++ b/src/common/transformations/tests/transpose_sinking/ts_shape_of_test.cpp @@ -5,6 +5,9 @@ #include "transformations/transpose_sinking/ts_shape_of.hpp" #include "common_test_utils/ov_test_utils.hpp" +#include "openvino/op/abs.hpp" +#include "openvino/op/gather.hpp" +#include "openvino/op/shape_of.hpp" #include "transformations/transpose_sinking/ts_fuse.hpp" using namespace ov; diff --git a/src/core/tests/pass/constant_folding.cpp b/src/core/tests/pass/constant_folding.cpp index 66a1ee923cf..0b99b57c9fb 100644 --- a/src/core/tests/pass/constant_folding.cpp +++ b/src/core/tests/pass/constant_folding.cpp @@ -10,12 +10,7 @@ #include "common_test_utils/ov_test_utils.hpp" #include "common_test_utils/test_tools.hpp" #include "openvino/core/constant_fold_utils.hpp" -#include "openvino/op/acosh.hpp" -#include "openvino/op/add.hpp" -#include "openvino/op/constant.hpp" -#include "openvino/op/convert_like.hpp" -#include "openvino/op/loop.hpp" -#include "openvino/op/multiply.hpp" +#include "openvino/op/ops.hpp" #include "ov_ops/type_relaxed.hpp" #include "transformations/common_optimizations/disable_shapeof_constant_folding.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/core/tests/pattern.cpp b/src/core/tests/pattern.cpp index 43d9cdf9582..e3c2f3f9cdf 100644 --- a/src/core/tests/pattern.cpp +++ b/src/core/tests/pattern.cpp @@ -19,8 +19,11 @@ #include "openvino/op/broadcast.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/cos.hpp" +#include "openvino/op/cosh.hpp" #include "openvino/op/divide.hpp" +#include "openvino/op/equal.hpp" #include "openvino/op/exp.hpp" +#include "openvino/op/greater.hpp" #include "openvino/op/multiply.hpp" #include "openvino/op/parameter.hpp" #include "openvino/op/reduce_sum.hpp" diff --git a/src/frontends/tensorflow_common/src/helper_transforms/embedding_segments_feature_fusing.cpp b/src/frontends/tensorflow_common/src/helper_transforms/embedding_segments_feature_fusing.cpp index e7aa54fc927..5a4d3d4aaa0 100644 --- a/src/frontends/tensorflow_common/src/helper_transforms/embedding_segments_feature_fusing.cpp +++ b/src/frontends/tensorflow_common/src/helper_transforms/embedding_segments_feature_fusing.cpp @@ -10,6 +10,7 @@ #include "helper_ops/sparse_fill_empty_rows.hpp" #include "helper_ops/sparse_segment_ops.hpp" #include "openvino/op/broadcast.hpp" +#include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/convert.hpp" #include "openvino/op/embedding_segments_sum.hpp" @@ -17,6 +18,8 @@ #include "openvino/op/greater_eq.hpp" #include "openvino/op/non_zero.hpp" #include "openvino/op/reshape.hpp" +#include "openvino/op/select.hpp" +#include "openvino/op/shape_of.hpp" #include "openvino/op/split.hpp" #include "openvino/op/squeeze.hpp" #include "openvino/op/strided_slice.hpp" diff --git a/src/frontends/tensorflow_common/src/helper_transforms/gru_block_cell_replacer.cpp b/src/frontends/tensorflow_common/src/helper_transforms/gru_block_cell_replacer.cpp index 89226b46270..a218b8298e8 100644 --- a/src/frontends/tensorflow_common/src/helper_transforms/gru_block_cell_replacer.cpp +++ b/src/frontends/tensorflow_common/src/helper_transforms/gru_block_cell_replacer.cpp @@ -12,6 +12,7 @@ #include "openvino/op/constant.hpp" #include "openvino/op/gru_cell.hpp" #include "openvino/op/shape_of.hpp" +#include "openvino/op/slice.hpp" #include "openvino/op/split.hpp" #include "openvino/op/transpose.hpp" #include "openvino/op/variadic_split.hpp" diff --git a/src/inference/src/check_network_batchable.cpp b/src/inference/src/check_network_batchable.cpp index d3dfd20b488..9a6c3f6aff6 100644 --- a/src/inference/src/check_network_batchable.cpp +++ b/src/inference/src/check_network_batchable.cpp @@ -15,7 +15,7 @@ bool model_has_suitable_do(const std::shared_ptr& model) { for (auto& result_node : model->get_results()) { auto do_node = result_node->input_value(0).get_node_shared_ptr(); std::shared_ptr convert_node; - if (ov::is_type(do_node)) { // cases with do->convert->result + if (ov::is_type(do_node)) { // cases with do->convert->result convert_node = do_node; do_node = convert_node->get_input_node_shared_ptr(0); } @@ -77,7 +77,7 @@ std::shared_ptr apply_batch_affinity(const std::shared_ptrget_results()) { auto do_node = result_node->input_value(0).get_node_shared_ptr(); std::shared_ptr convert_node; - if (ov::is_type(do_node)) { // cases with do->convert->result + if (ov::is_type(do_node)) { // cases with do->convert->result convert_node = do_node; do_node = convert_node->get_input_node_shared_ptr(0); } diff --git a/src/inference/tests/unit/query_model_test.cpp b/src/inference/tests/unit/query_model_test.cpp index f7a4ea80794..30dde3f94c7 100644 --- a/src/inference/tests/unit/query_model_test.cpp +++ b/src/inference/tests/unit/query_model_test.cpp @@ -7,13 +7,24 @@ #include "openvino/core/rt_info.hpp" #include "openvino/op/add.hpp" +#include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/convert.hpp" +#include "openvino/op/divide.hpp" +#include "openvino/op/gather.hpp" +#include "openvino/op/interpolate.hpp" +#include "openvino/op/log.hpp" #include "openvino/op/log_softmax.hpp" +#include "openvino/op/matmul.hpp" #include "openvino/op/parameter.hpp" +#include "openvino/op/prelu.hpp" #include "openvino/op/reduce_l2.hpp" #include "openvino/op/reshape.hpp" #include "openvino/op/result.hpp" +#include "openvino/op/shape_of.hpp" +#include "openvino/op/subtract.hpp" +#include "openvino/op/transpose.hpp" +#include "openvino/op/util/op_types.hpp" #include "openvino/pass/constant_folding.hpp" #include "openvino/pass/manager.hpp" #include "openvino/runtime/iplugin.hpp" diff --git a/src/plugins/auto/src/plugin.cpp b/src/plugins/auto/src/plugin.cpp index 47606af3b59..98bc48b06c4 100644 --- a/src/plugins/auto/src/plugin.cpp +++ b/src/plugins/auto/src/plugin.cpp @@ -12,6 +12,9 @@ #include +#include "openvino/op/convolution.hpp" +#include "openvino/op/fake_quantize.hpp" +#include "openvino/op/group_conv.hpp" #include "openvino/runtime/auto/properties.hpp" #include "openvino/runtime/device_id_parser.hpp" #include "openvino/runtime/internal_properties.hpp" diff --git a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp index fb110778152..f886070ca39 100644 --- a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp +++ b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp @@ -6,6 +6,7 @@ #include "cpu_map_scheduling.hpp" #include "graph.h" +#include "openvino/op/fake_quantize.hpp" #include "openvino/runtime/performance_heuristics.hpp" #include "openvino/runtime/threading/cpu_streams_info.hpp" #include "openvino/runtime/threading/istreams_executor.hpp" diff --git a/src/plugins/intel_cpu/src/nodes/rnn.cpp b/src/plugins/intel_cpu/src/nodes/rnn.cpp index 564a2de9b07..927805e1879 100644 --- a/src/plugins/intel_cpu/src/nodes/rnn.cpp +++ b/src/plugins/intel_cpu/src/nodes/rnn.cpp @@ -18,6 +18,11 @@ #include "ov_ops/augru_cell.hpp" #include "ov_ops/augru_sequence.hpp" +#include "openvino/op/gru_cell.hpp" +#include "openvino/op/gru_sequence.hpp" +#include "openvino/op/lstm_sequence.hpp" +#include "openvino/op/rnn_cell.hpp" +#include "openvino/op/rnn_sequence.hpp" #include "openvino/core/node.hpp" #include diff --git a/src/plugins/intel_cpu/src/nodes/split.cpp b/src/plugins/intel_cpu/src/nodes/split.cpp index f2dac441bb8..71b48c618d9 100644 --- a/src/plugins/intel_cpu/src/nodes/split.cpp +++ b/src/plugins/intel_cpu/src/nodes/split.cpp @@ -13,6 +13,8 @@ #include #include "utils/ngraph_utils.hpp" #include +#include "openvino/op/split.hpp" +#include "openvino/op/variadic_split.hpp" #define THROW_ERROR(...) OPENVINO_THROW("Split layer with name '", getName(), "' ", __VA_ARGS__) diff --git a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp index 4371adcc9f9..3d9f7a2217d 100644 --- a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp +++ b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp @@ -11,6 +11,8 @@ #include "transformations/utils/utils.hpp" #include "utils/general_utils.h" #include "utils/debug_capabilities.h" +#include "openvino/op/tensor_iterator.hpp" +#include "openvino/op/loop.hpp" #include #include diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/split_fc.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/split_fc.cpp index 4a7149b9b44..27207b3e051 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/split_fc.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/split_fc.cpp @@ -12,6 +12,7 @@ #include "openvino/op/multiply.hpp" #include "openvino/op/reshape.hpp" #include "openvino/op/subtract.hpp" +#include "openvino/op/transpose.hpp" #include "openvino/op/variadic_split.hpp" #include "transformations/cpu_opset/common/op/fully_connected.hpp" diff --git a/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_group_conv.cpp b/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_group_conv.cpp index 26054e46dbf..c4a29c45e4f 100644 --- a/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_group_conv.cpp +++ b/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_group_conv.cpp @@ -67,7 +67,7 @@ TEST(TransformationTests, CheckConvertGroupConvIsApplied) { ov::Strides{1}); concat_inputs.push_back(conv); } - auto concat = std::make_shared(concat_inputs, 1); + auto concat = std::make_shared(concat_inputs, 1); model_ref = std::make_shared(ov::NodeVector{ concat }, ov::ParameterVector{ param }); } auto res = compare_functions(model, model_ref); diff --git a/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_group_conv1d.cpp b/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_group_conv1d.cpp index 19b98c5c752..ff4b8c4b974 100644 --- a/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_group_conv1d.cpp +++ b/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_group_conv1d.cpp @@ -42,7 +42,7 @@ template static std::shared_ptr createTransformedGraph(ov::Shape param_shape, ov::Shape weights_shape) { auto getUnsqueeze = [&](const ov::Output& node) { auto rank = node.get_partial_shape().rank().get_length(); - return std::make_shared(node, + return std::make_shared(node, ov::opset1::Constant::create(ov::element::i64, ov::Shape{1}, {rank})); }; auto type = ov::element::f32; diff --git a/src/plugins/intel_gpu/src/plugin/ops/eltwise.cpp b/src/plugins/intel_gpu/src/plugin/ops/eltwise.cpp index ac28e2acc49..0c70da0938d 100644 --- a/src/plugins/intel_gpu/src/plugin/ops/eltwise.cpp +++ b/src/plugins/intel_gpu/src/plugin/ops/eltwise.cpp @@ -15,12 +15,17 @@ #include "openvino/op/squared_difference.hpp" #include "openvino/op/equal.hpp" #include "openvino/op/not_equal.hpp" +#include "openvino/op/is_finite.hpp" +#include "openvino/op/is_inf.hpp" +#include "openvino/op/is_nan.hpp" #include "openvino/op/less.hpp" #include "openvino/op/less_eq.hpp" +#include "openvino/op/mod.hpp" #include "openvino/op/greater.hpp" #include "openvino/op/greater_eq.hpp" #include "openvino/op/logical_and.hpp" #include "openvino/op/logical_or.hpp" +#include "openvino/op/logical_xor.hpp" #include "openvino/op/xor.hpp" #include "openvino/op/power.hpp" #include "openvino/op/floor_mod.hpp" diff --git a/src/plugins/intel_gpu/src/plugin/ops/loop.cpp b/src/plugins/intel_gpu/src/plugin/ops/loop.cpp index 21314503caa..c5ae7bbdef5 100644 --- a/src/plugins/intel_gpu/src/plugin/ops/loop.cpp +++ b/src/plugins/intel_gpu/src/plugin/ops/loop.cpp @@ -5,6 +5,7 @@ #include "intel_gpu/plugin/common_utils.hpp" #include "intel_gpu/plugin/plugin.hpp" +#include "openvino/op/add.hpp" #include "openvino/op/tensor_iterator.hpp" #include "openvino/op/loop.hpp" #include "openvino/op/constant.hpp" diff --git a/src/plugins/intel_gpu/src/plugin/ops/unary.cpp b/src/plugins/intel_gpu/src/plugin/ops/unary.cpp index df98a31eef1..5f18c6557ae 100644 --- a/src/plugins/intel_gpu/src/plugin/ops/unary.cpp +++ b/src/plugins/intel_gpu/src/plugin/ops/unary.cpp @@ -33,7 +33,9 @@ #include "openvino/op/sinh.hpp" #include "openvino/op/cos.hpp" #include "openvino/op/cosh.hpp" +#include "openvino/op/softsign.hpp" #include "openvino/op/swish.hpp" +#include "openvino/op/sqrt.hpp" #include "openvino/op/hswish.hpp" #include "openvino/op/mish.hpp" #include "openvino/op/gelu.hpp" diff --git a/src/plugins/intel_gpu/src/plugin/transformations/convert_fc_to_compressed.cpp b/src/plugins/intel_gpu/src/plugin/transformations/convert_fc_to_compressed.cpp index 856af5c5852..01b72cd14a6 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/convert_fc_to_compressed.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/convert_fc_to_compressed.cpp @@ -11,6 +11,7 @@ #include "openvino/op/constant.hpp" #include "openvino/op/subtract.hpp" #include "openvino/op/matmul.hpp" +#include "openvino/op/multiply.hpp" #include "openvino/op/convert.hpp" #include "openvino/op/transpose.hpp" #include "openvino/op/reshape.hpp" diff --git a/src/plugins/intel_gpu/src/plugin/transformations/indirect_kv_cache.cpp b/src/plugins/intel_gpu/src/plugin/transformations/indirect_kv_cache.cpp index 14b58e642a8..94c2c054883 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/indirect_kv_cache.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/indirect_kv_cache.cpp @@ -17,6 +17,7 @@ #include "openvino/op/gather.hpp" #include "openvino/op/matmul.hpp" #include "openvino/op/read_value.hpp" +#include "openvino/op/util/op_types.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "openvino/pass/pattern/op/or.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_fusion.cpp b/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_fusion.cpp index b444252009f..5101ad3bb81 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_fusion.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/kv_cache_fusion.cpp @@ -11,8 +11,10 @@ #include "intel_gpu/plugin/common_utils.hpp" #include "openvino/core/node_vector.hpp" #include "openvino/core/rt_info.hpp" +#include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/convert.hpp" +#include "openvino/op/gather.hpp" #include "openvino/op/parameter.hpp" #include "openvino/op/read_value.hpp" #include "openvino/op/sink.hpp" diff --git a/src/plugins/intel_gpu/tests/unit/transformations/clamp_fp16_output_test.cpp b/src/plugins/intel_gpu/tests/unit/transformations/clamp_fp16_output_test.cpp index 5bdb492ea04..b5cb1671c45 100644 --- a/src/plugins/intel_gpu/tests/unit/transformations/clamp_fp16_output_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/transformations/clamp_fp16_output_test.cpp @@ -17,6 +17,8 @@ #include "openvino/op/reshape.hpp" #include "openvino/op/add.hpp" #include "openvino/op/maximum.hpp" +#include "openvino/op/matmul.hpp" +#include "openvino/op/softmax.hpp" #include #include #include diff --git a/src/plugins/intel_gpu/tests/unit/transformations/convert_binary_conv_to_conv_test.cpp b/src/plugins/intel_gpu/tests/unit/transformations/convert_binary_conv_to_conv_test.cpp index 23c30f0e95e..6e26cac55cb 100644 --- a/src/plugins/intel_gpu/tests/unit/transformations/convert_binary_conv_to_conv_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/transformations/convert_binary_conv_to_conv_test.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/src/plugins/intel_gpu/tests/unit/transformations/indirect_kv_cache_test.cpp b/src/plugins/intel_gpu/tests/unit/transformations/indirect_kv_cache_test.cpp index 276d11662f3..074d3420b28 100644 --- a/src/plugins/intel_gpu/tests/unit/transformations/indirect_kv_cache_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/transformations/indirect_kv_cache_test.cpp @@ -14,6 +14,7 @@ #include "openvino/core/partial_shape.hpp" #include "openvino/op/parameter.hpp" #include "openvino/op/result.hpp" +#include "openvino/op/gather.hpp" #include "openvino/pass/manager.hpp" #include diff --git a/src/plugins/intel_gpu/tests/unit/transformations/kv_cache_fusion_test.cpp b/src/plugins/intel_gpu/tests/unit/transformations/kv_cache_fusion_test.cpp index fb2eed7792c..bf07814c705 100644 --- a/src/plugins/intel_gpu/tests/unit/transformations/kv_cache_fusion_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/transformations/kv_cache_fusion_test.cpp @@ -17,6 +17,8 @@ #include "intel_gpu/op/read_value.hpp" #include "openvino/core/node_vector.hpp" #include "openvino/core/partial_shape.hpp" +#include "openvino/op/concat.hpp" +#include "openvino/op/gather.hpp" #include "openvino/op/parameter.hpp" #include "openvino/op/result.hpp" #include "openvino/op/sink.hpp" diff --git a/src/plugins/intel_npu/src/al/src/sync_infer_request.cpp b/src/plugins/intel_npu/src/al/src/sync_infer_request.cpp index 7a0bfbbb3a6..5b50caf8f3f 100644 --- a/src/plugins/intel_npu/src/al/src/sync_infer_request.cpp +++ b/src/plugins/intel_npu/src/al/src/sync_infer_request.cpp @@ -5,6 +5,7 @@ #include "sync_infer_request.hpp" #include "intel_npu/al/prefix.hpp" +#include "openvino/op/util/op_types.hpp" #include "openvino/runtime/make_tensor.hpp" #include "openvino/runtime/plugin_itt.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/plugins/template/src/plugin.cpp b/src/plugins/template/src/plugin.cpp index b87dbdf618d..bfdd4a35600 100644 --- a/src/plugins/template/src/plugin.cpp +++ b/src/plugins/template/src/plugin.cpp @@ -7,6 +7,7 @@ #include #include "itt.hpp" +#include "openvino/op/ops.hpp" #include "openvino/pass/manager.hpp" #include "openvino/runtime/internal_properties.hpp" #include "openvino/runtime/properties.hpp" diff --git a/src/tests/ov_helpers/ov_snippets_models/src/subgraph_mha.cpp b/src/tests/ov_helpers/ov_snippets_models/src/subgraph_mha.cpp index 9b863dda1bf..aa468fb08f0 100644 --- a/src/tests/ov_helpers/ov_snippets_models/src/subgraph_mha.cpp +++ b/src/tests/ov_helpers/ov_snippets_models/src/subgraph_mha.cpp @@ -509,7 +509,7 @@ std::shared_ptr MHAWOTransposeOnInputsFunction::initOriginal() const const auto mulConst = ov::test::utils::deprecated::make_constant(precision, ov::Shape({1}), std::vector{1}, true); const auto mul = std::make_shared(param1, mulConst); const auto matMul0 = std::make_shared(param0, mul, transA, transB); - const auto softmax = std::make_shared(matMul0, -1); + const auto softmax = std::make_shared(matMul0, -1); const auto matMul1 = std::make_shared(softmax, param2, transA, transB); const auto transpose3 = std::make_shared(matMul1, transpose3Const); @@ -526,7 +526,7 @@ std::shared_ptr MHAWOTransposeFunction::initOriginal() const { float transA = false; float transB = false; const auto matMul0 = std::make_shared(param0, param1, transA, transB); - const auto softmax = std::make_shared(matMul0, -1); + const auto softmax = std::make_shared(matMul0, -1); const auto matMul1 = std::make_shared(softmax, param2, transA, transB); ov::ResultVector results{std::make_shared(matMul1)}; @@ -553,7 +553,7 @@ std::shared_ptr MHAWOTransposeSplitMFunction::initReference() const { auto data2 = std::make_shared(precisions[2], reshape2->get_shape()); const auto matMul0 = std::make_shared(data0, data1); - const auto softmax = std::make_shared(matMul0, -1); + const auto softmax = std::make_shared(matMul0, -1); const auto matMul1 = std::make_shared(softmax, data2); const auto subgraph = std::make_shared(ov::NodeVector{reshape0, reshape1, reshape2}, @@ -698,7 +698,7 @@ std::shared_ptr MHAQuantMatMul0Function::initOriginal() const { const auto matMul0 = std::make_shared(transpose0, fq1); const auto add = std::make_shared(matMul0, addParam); - const auto softMax = std::make_shared(add, -1); + const auto softMax = std::make_shared(add, -1); const auto matMul1 = std::make_shared(softMax, transpose2); auto fq2 = ov::test::utils::make_fake_quantize(matMul1, ov::element::f32, 256, {1}, @@ -950,7 +950,7 @@ std::shared_ptr MHATransposedInputFunction::initOriginal() const { } const auto matMul0 = std::make_shared(param0, matmul0_in1, false, m_transposed_b); - const auto softmax = std::make_shared(matMul0, -1); + const auto softmax = std::make_shared(matMul0, -1); const auto matMul1 = std::make_shared(softmax, param2); ov::ResultVector results{std::make_shared(matMul1)}; @@ -993,7 +993,7 @@ std::shared_ptr MHATransposedInputFunction::initReference() const { } const auto matMul0 = std::make_shared(param0, matmul0_in1); - const auto softmax = std::make_shared(matMul0, -1); + const auto softmax = std::make_shared(matMul0, -1); const auto matMul1 = std::make_shared(softmax, param2); auto subgraph = std::make_shared(ov::NodeVector{data0, in1, data2}, @@ -1036,7 +1036,7 @@ std::shared_ptr MHAWithExtractedReshapeFunction::initOriginal() const const auto target_shape_const_2 = ov::opset1::Constant::create(ov::element::i32, ov::Shape{mm_out_shape.size()}, mm_out_shape); const auto reshape_2 = std::make_shared(add_2, target_shape_const_2, false); - const auto softmax = std::make_shared(reshape_2, -1); + const auto softmax = std::make_shared(reshape_2, -1); const auto matmul_1 = std::make_shared(softmax, param_4); ov::ResultVector results{std::make_shared(matmul_1)}; @@ -1074,7 +1074,7 @@ std::shared_ptr MHAWithExtractedReshapeFunction::initReference() cons const auto matmul_0 = std::make_shared(param_0, param_1); const auto add_internal = std::make_shared(matmul_0, param_2); - const auto softmax = std::make_shared(add_internal, -1); + const auto softmax = std::make_shared(add_internal, -1); const auto matmul_1 = std::make_shared(softmax, param_3); auto subgraph_model = std::make_shared(NodeVector{matmul_1}, ov::ParameterVector{param_0, param_1, param_2, param_3});