From ac774954e079bbc5512f3228b88ee1904c93fba1 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Fri, 14 Apr 2023 16:06:03 +0200 Subject: [PATCH 1/5] update skip list --- .../shared_tests_instances/skip_tests_config.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp index 69d701b85b4b86..ccbeb61e62fddc 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp @@ -215,11 +215,11 @@ std::vector disabledTestPatterns() { retVector.emplace_back(R"(smoke_LPT.*)"); retVector.emplace_back(R"(smoke_CPU_OVClassLoadNetworkAndCheckWithSecondaryPropertiesTest/OVClassLoadNetworkAndCheckSecondaryPropertiesTest.LoadNetworkAndCheckSecondaryPropertiesTest.*)"); retVector.emplace_back(R"(smoke_CPU_OVClassLoadNetworkAndCheckWithSecondaryPropertiesDoubleTest/OVClassLoadNetworkAndCheckSecondaryPropertiesTest.LoadNetworkAndCheckSecondaryPropertiesTest.*)"); - retVector.emplace_back(R"(smoke_Activation_Basic/ActivationLayerTest.CompareWithRefs.*)"); - retVector.emplace_back(R"(smoke_Integer_Activation_Basic/ActivationLayerTest.CompareWithRefs/(Tanh|Negative|Sqrt).*)"); - retVector.emplace_back(R"(smoke_Activation_Basic_Prelu_Const/ActivationLayerTest.CompareWithRefs/(LeakyRelu|PReLu).*)"); - retVector.emplace_back(R"(smoke_Activation_Basic_Prelu_Param/ActivationParamLayerTest.CompareWithRefs/(LeakyRelu|PReLu).*)"); - retVector.emplace_back(R"(smoke_CompareWithRefs/ComparisonLayerTest.ComparisonTests.*)"); +// retVector.emplace_back(R"(smoke_Activation_Basic/ActivationLayerTest.CompareWithRefs.*)"); +// retVector.emplace_back(R"(smoke_Integer_Activation_Basic/ActivationLayerTest.CompareWithRefs/(Tanh|Negative|Sqrt).*)"); +// retVector.emplace_back(R"(smoke_Activation_Basic_Prelu_Const/ActivationLayerTest.CompareWithRefs/(LeakyRelu|PReLu).*)"); +// retVector.emplace_back(R"(smoke_Activation_Basic_Prelu_Param/ActivationParamLayerTest.CompareWithRefs/(LeakyRelu|PReLu).*)"); +// retVector.emplace_back(R"(smoke_CompareWithRefs/ComparisonLayerTest.ComparisonTests.*)"); retVector.emplace_back(R"(smoke_DeformableConvolution2D_ExplicitPadding/DeformableConvolutionLayerTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_DeformableConvolution2D_AutoPadValid/DeformableConvolutionLayerTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_DeformableConvolution2D_DeformableGroups_ExplicitPadding/DeformableConvolutionLayerTest.CompareWithRefs.*)"); @@ -253,7 +253,7 @@ std::vector disabledTestPatterns() { retVector.emplace_back(R"(smoke_Quantized.*)"); retVector.emplace_back(R"(smoke_NegativeQuantizedMatMulMultiplyFusion.*)"); retVector.emplace_back(R"(MultipleLSTMCellTest/MultipleLSTMCellTest.CompareWithRefs.*)"); - retVector.emplace_back(R"(smoke_MultipleAdd_Nd/MultiplyAddLayerTest.CompareWithRefs.*)"); +// retVector.emplace_back(R"(smoke_MultipleAdd_Nd/MultiplyAddLayerTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_MVNMultiplyAdd_1D/MVNMultiplyAdd.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_If/SimpleIfTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_If/SimpleIfNotConstConditionTest.CompareWithRefs.*)"); From cac841bf27192383e295d8926676b70087ecfb3f Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Mon, 17 Apr 2023 17:25:56 +0200 Subject: [PATCH 2/5] skip change --- .../functional/shared_tests_instances/skip_tests_config.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp index ccbeb61e62fddc..1bb79e3c220774 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp @@ -226,9 +226,9 @@ std::vector disabledTestPatterns() { retVector.emplace_back(R"(smoke_DeformableConvolution2D_SingleTestCase/DeformableConvolutionLayerTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_DeformableConvolution2D_MultipleGroups/DeformableConvolutionLayerTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_DeformableConvolution2D_MultipleGroups_2/DeformableConvolutionLayerTest.CompareWithRefs.*)"); - retVector.emplace_back(R"(smoke_CompareWithRefs_static/EltwiseLayerTest.EltwiseTests.*)"); - retVector.emplace_back(R"(smoke_CompareWithRefs_static_check_collapsing/EltwiseLayerTest.EltwiseTests.*)"); - retVector.emplace_back(R"(smoke_SingleThread/EltwiseLayerTest.EltwiseTests.*)"); +// retVector.emplace_back(R"(smoke_CompareWithRefs_static/EltwiseLayerTest.EltwiseTests.*)"); +// retVector.emplace_back(R"(smoke_CompareWithRefs_static_check_collapsing/EltwiseLayerTest.EltwiseTests.*)"); +// retVector.emplace_back(R"(smoke_SingleThread/EltwiseLayerTest.EltwiseTests.*)"); retVector.emplace_back(R"(smoke_GRUSequenceCommonZeroClip/GRUSequenceTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_GRUSequenceCommonClip/GRUSequenceTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_StaticShapeLoop/StaticShapeLoopTest.CompareWithRefs.*)"); From 6977af9fb711f3131f8cc9233e6c7ede30a5004c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 18 Apr 2023 17:48:09 +0200 Subject: [PATCH 3/5] fix divide --- .../cpu_opset/arm/pass/convert_i32_div.cpp | 32 +++++++++++++++++++ .../cpu_opset/arm/pass/convert_i32_div.hpp | 19 +++++++++++ .../transformation_pipeline.cpp | 2 ++ .../skip_tests_config.cpp | 10 ------ 4 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.cpp create mode 100644 src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.hpp diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.cpp new file mode 100644 index 00000000000000..4ab422066b8a1c --- /dev/null +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.cpp @@ -0,0 +1,32 @@ +// Copyright (C) 2020-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 + +#include "convert_i32_div.hpp" +#include +#include + +namespace ov { +namespace intel_cpu { + +ConvertI32Div::ConvertI32Div() { + register_matcher(std::make_shared(ngraph::pattern::wrap_type(), "ConvertI32Div"), + [](ngraph::pattern::Matcher& m) { + auto divide = std::dynamic_pointer_cast(m.get_match_root()); + if (!divide) { + return false; + } + if (divide->get_element_type() != ov::element::i32) { + return false; + } + + auto new_divide = std::make_shared(divide->input_value(0), divide->input_value(1)); + auto new_floor = std::make_shared(new_divide); + new_floor->set_friendly_name(divide->get_friendly_name()); + ngraph::copy_runtime_info(divide, new_floor); + ngraph::replace_node(divide, new_floor); + return true; + }); +} + +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.hpp new file mode 100644 index 00000000000000..7f2a13b2046098 --- /dev/null +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.hpp @@ -0,0 +1,19 @@ +// Copyright (C) 2020-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include + +namespace ov { +namespace intel_cpu { + +class ConvertI32Div: public ngraph::pass::MatcherPass { +public: + OPENVINO_RTTI("ConvertI32Div", "0"); + ConvertI32Div(); +}; + +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp index 6f7bfd7d7a517b..a70b981ce3829a 100644 --- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp +++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp @@ -99,6 +99,7 @@ #include "transformations/cpu_opset/arm/pass/convert_group_conv1d.hpp" #include "transformations/cpu_opset/arm/pass/convert_reduce_multi_axis.hpp" #include "transformations/cpu_opset/arm/pass/mish_decomposition.hpp" +#include "transformations/cpu_opset/arm/pass/convert_i32_div.hpp" #include "transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.hpp" #include "transformations/cpu_opset/common/pass/move_eltwise_up_data_movement.hpp" #include "transformations/cpu_opset/common/pass/ref_convert_i64_i32.hpp" @@ -262,6 +263,7 @@ void Transformations::PreLpt(const std::vector& defaultPrecis CPU_REGISTER_PASS_ARM(manager, ConvertConv1D); CPU_REGISTER_PASS_ARM(manager, ConvertGroupConv1D); CPU_REGISTER_PASS_ARM(manager, ConvertGroupConvolution); + CPU_REGISTER_PASS_ARM(manager, ConvertI32Div); // SpaceToDepth/ DepthToSpace node implementation supports only equal input/output tensors with rank <= 5 CPU_SET_CALLBACK_COMMON(manager, diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp index 68fb18d25d3f4d..70fd440fe079fc 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp @@ -205,14 +205,6 @@ std::vector disabledTestPatterns() { retVector.emplace_back(R"(smoke_CPU_OVClassCompileModelAndCheckWithSecondaryPropertiesDoubleTest.*)"); } retVector.emplace_back(R"(smoke_LPT.*)"); -// retVector.emplace_back(R"(smoke_Activation_Basic/ActivationLayerTest.CompareWithRefs.*)"); -// retVector.emplace_back(R"(smoke_Integer_Activation_Basic/ActivationLayerTest.CompareWithRefs/(Tanh|Negative|Sqrt).*)"); -// retVector.emplace_back(R"(smoke_Activation_Basic_Prelu_Const/ActivationLayerTest.CompareWithRefs/(LeakyRelu|PReLu).*)"); -// retVector.emplace_back(R"(smoke_Activation_Basic_Prelu_Param/ActivationParamLayerTest.CompareWithRefs/(LeakyRelu|PReLu).*)"); -// retVector.emplace_back(R"(smoke_CompareWithRefs/ComparisonLayerTest.ComparisonTests.*)"); -// retVector.emplace_back(R"(smoke_CompareWithRefs_static/EltwiseLayerTest.EltwiseTests.*)"); -// retVector.emplace_back(R"(smoke_CompareWithRefs_static_check_collapsing/EltwiseLayerTest.EltwiseTests.*)"); -// retVector.emplace_back(R"(smoke_SingleThread/EltwiseLayerTest.EltwiseTests.*)"); retVector.emplace_back(R"(smoke_StaticShapeLoop/StaticShapeLoopTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_StaticShapeLoop/StaticShapeLoopTest.CompareWithPredefinedRefs.*)"); retVector.emplace_back(R"(smoke_TrivialLoop/TrivialLoopTest.AutoSlicingInputWithDynCondition_(CheckPredefinedValues|CheckReference).*)"); @@ -225,8 +217,6 @@ std::vector disabledTestPatterns() { retVector.emplace_back(R"(smoke_Quantized.*)"); retVector.emplace_back(R"(smoke_NegativeQuantizedMatMulMultiplyFusion.*)"); retVector.emplace_back(R"(MultipleLSTMCellTest/MultipleLSTMCellTest.CompareWithRefs.*)"); -// retVector.emplace_back(R"(smoke_MultipleAdd_Nd/MultiplyAddLayerTest.CompareWithRefs.*)"); - retVector.emplace_back(R"(smoke_MVNMultiplyAdd_1D/MVNMultiplyAdd.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_If/SimpleIfTest.CompareWithRefs.*)"); retVector.emplace_back(R"(smoke_If/SimpleIfNotConstConditionTest.CompareWithRefs.*)"); #endif From 2e4437f7e4f17a81037570f522b279b14fe7baaf Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 19 Apr 2023 15:01:52 +0200 Subject: [PATCH 4/5] review fixes --- .../{convert_i32_div.cpp => decompose_integer_divide.cpp} | 8 ++++---- .../{convert_i32_div.hpp => decompose_integer_divide.hpp} | 6 +++--- .../src/transformations/transformation_pipeline.cpp | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) rename src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/{convert_i32_div.cpp => decompose_integer_divide.cpp} (80%) rename src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/{convert_i32_div.hpp => decompose_integer_divide.hpp} (65%) diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.cpp similarity index 80% rename from src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.cpp rename to src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.cpp index 4ab422066b8a1c..6567de95f038b5 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.cpp @@ -1,21 +1,21 @@ // Copyright (C) 2020-2023 Intel Corporation // SPDX-License-Identifier: Apache-2.0 -#include "convert_i32_div.hpp" +#include "decompose_integer_divide.hpp" #include #include namespace ov { namespace intel_cpu { -ConvertI32Div::ConvertI32Div() { - register_matcher(std::make_shared(ngraph::pattern::wrap_type(), "ConvertI32Div"), +DecomposeIntegerDivide::DecomposeIntegerDivide() { + register_matcher(std::make_shared(ngraph::pattern::wrap_type(), "DecomposeIntegerDivide"), [](ngraph::pattern::Matcher& m) { auto divide = std::dynamic_pointer_cast(m.get_match_root()); if (!divide) { return false; } - if (divide->get_element_type() != ov::element::i32) { + if (divide->get_element_type().is_integral_number()) { return false; } diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.hpp similarity index 65% rename from src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.hpp rename to src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.hpp index 7f2a13b2046098..c9d23bee89d6fb 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/convert_i32_div.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.hpp @@ -9,10 +9,10 @@ namespace ov { namespace intel_cpu { -class ConvertI32Div: public ngraph::pass::MatcherPass { +class DecomposeIntegerDivide: public ngraph::pass::MatcherPass { public: - OPENVINO_RTTI("ConvertI32Div", "0"); - ConvertI32Div(); + OPENVINO_RTTI("DecomposeIntegerDivide", "0"); + DecomposeIntegerDivide(); }; } // namespace intel_cpu diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp index a70b981ce3829a..36dcdd1f456076 100644 --- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp +++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp @@ -99,7 +99,7 @@ #include "transformations/cpu_opset/arm/pass/convert_group_conv1d.hpp" #include "transformations/cpu_opset/arm/pass/convert_reduce_multi_axis.hpp" #include "transformations/cpu_opset/arm/pass/mish_decomposition.hpp" -#include "transformations/cpu_opset/arm/pass/convert_i32_div.hpp" +#include "transformations/cpu_opset/arm/pass/decompose_integer_divide.hpp" #include "transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.hpp" #include "transformations/cpu_opset/common/pass/move_eltwise_up_data_movement.hpp" #include "transformations/cpu_opset/common/pass/ref_convert_i64_i32.hpp" @@ -263,7 +263,9 @@ void Transformations::PreLpt(const std::vector& defaultPrecis CPU_REGISTER_PASS_ARM(manager, ConvertConv1D); CPU_REGISTER_PASS_ARM(manager, ConvertGroupConv1D); CPU_REGISTER_PASS_ARM(manager, ConvertGroupConvolution); - CPU_REGISTER_PASS_ARM(manager, ConvertI32Div); + // The plugin computes Divide in floating point precision. + // To preserve correct math for integer division we need to insert explicit Floor operation. + CPU_REGISTER_PASS_ARM(manager, DecomposeIntegerDivide); // SpaceToDepth/ DepthToSpace node implementation supports only equal input/output tensors with rank <= 5 CPU_SET_CALLBACK_COMMON(manager, From eb66094fcd52fe35c0ffd0d9bc9430b87893399b Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 19 Apr 2023 15:03:22 +0200 Subject: [PATCH 5/5] review fixes #2 --- .../cpu_opset/arm/pass/decompose_integer_divide.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.cpp index 6567de95f038b5..e36947cb5cb88c 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/decompose_integer_divide.cpp @@ -15,7 +15,7 @@ DecomposeIntegerDivide::DecomposeIntegerDivide() { if (!divide) { return false; } - if (divide->get_element_type().is_integral_number()) { + if (!divide->get_element_type().is_integral_number()) { return false; }