Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ARM CPU] Fix eltwise op tests (Divide) #17029

Merged
merged 14 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2020-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#include "decompose_integer_divide.hpp"
#include <ngraph/opsets/opset1.hpp>
#include <ngraph/rt_info.hpp>

namespace ov {
namespace intel_cpu {

DecomposeIntegerDivide::DecomposeIntegerDivide() {
register_matcher(std::make_shared<ngraph::pattern::Matcher>(ngraph::pattern::wrap_type<ngraph::opset1::Divide>(), "DecomposeIntegerDivide"),
[](ngraph::pattern::Matcher& m) {
auto divide = std::dynamic_pointer_cast<ngraph::opset1::Divide>(m.get_match_root());
if (!divide) {
return false;
}
if (!divide->get_element_type().is_integral_number()) {
return false;
}

auto new_divide = std::make_shared<ngraph::opset1::Divide>(divide->input_value(0), divide->input_value(1));
auto new_floor = std::make_shared<ngraph::opset1::Floor>(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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (C) 2020-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include <ngraph/pattern/op/wrap_type.hpp>
#include <ngraph/pass/graph_rewrite.hpp>

namespace ov {
namespace intel_cpu {

class DecomposeIntegerDivide: public ngraph::pass::MatcherPass {
public:
OPENVINO_RTTI("DecomposeIntegerDivide", "0");
DecomposeIntegerDivide();
};

} // namespace intel_cpu
} // namespace ov
Original file line number Diff line number Diff line change
Expand Up @@ -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/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"
Expand Down Expand Up @@ -262,6 +263,9 @@ void Transformations::PreLpt(const std::vector<ov::element::Type>& defaultPrecis
CPU_REGISTER_PASS_ARM(manager, ConvertConv1D);
CPU_REGISTER_PASS_ARM(manager, ConvertGroupConv1D);
CPU_REGISTER_PASS_ARM(manager, ConvertGroupConvolution);
// 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,6 @@ std::vector<std::string> 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_Decomposition_(3|4)D/Mvn6LayerTest.CompareWithRefs.*)");
retVector.emplace_back(R"(smoke_AvgPool_ExplicitPad_CeilRounding/PoolingLayerTest.CompareWithRefs.*)");
retVector.emplace_back(R"(smoke_TestsDFT_(1|2|3|4)d/DFTLayerTest.CompareWithRefs.*)");
Expand All @@ -217,7 +209,6 @@ std::vector<std::string> 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_If/SimpleIfTest.CompareWithRefs.*)");
retVector.emplace_back(R"(smoke_If/SimpleIfNotConstConditionTest.CompareWithRefs.*)");
#endif
Expand Down