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

[CPU][ARM64] Enable FakeQuantize tokenization and decomposition #28700

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
Expand Up @@ -1100,17 +1100,18 @@ void Transformations::MainSnippets(void) {
ov::is_type<ov::op::v0::Clamp>(n) || ov::is_type<ov::op::v0::Ceiling>(n) ||
ov::is_type<ov::op::v0::Convert>(n) || ov::is_type<ov::op::v1::Divide>(n) ||
ov::is_type<ov::op::v0::Elu>(n) || ov::is_type<ov::op::v0::Exp>(n) ||
ov::is_type<ov::op::v1::Equal>(n) || ov::is_type<ov::op::v0::Floor>(n) ||
ov::is_type<ov::op::v1::FloorMod>(n) || ov::is_type<ov::op::v0::Gelu>(n) ||
ov::is_type<ov::op::v7::Gelu>(n) || ov::is_type<ov::op::v1::Greater>(n) ||
ov::is_type<ov::op::v1::GreaterEqual>(n) || ov::is_type<ov::op::v4::HSwish>(n) ||
ov::is_type<ov::op::v1::LessEqual>(n) || ov::is_type<ov::op::v1::Maximum>(n) ||
ov::is_type<ov::op::v1::Minimum>(n) || ov::is_type<ov::op::v4::Mish>(n) ||
ov::is_type<ov::op::v1::Mod>(n) || ov::is_type<ov::op::v1::Multiply>(n) ||
ov::is_type<ov::op::v0::PRelu>(n) || ov::is_type<ov::op::v0::Relu>(n) ||
ov::is_type<ov::op::v5::Round>(n) || ov::is_type<ov::op::v0::Sigmoid>(n) ||
ov::is_type<ov::op::v0::Sqrt>(n) || ov::is_type<ov::op::v1::Subtract>(n) ||
ov::is_type<ov::op::v4::Swish>(n) || ov::is_type<ov::op::v0::Tanh>(n));
ov::is_type<ov::op::v1::Equal>(n) || ov::is_type<ov::op::v0::FakeQuantize>(n) ||
ov::is_type<ov::op::v0::Floor>(n) || ov::is_type<ov::op::v1::FloorMod>(n) ||
ov::is_type<ov::op::v0::Gelu>(n) || ov::is_type<ov::op::v7::Gelu>(n) ||
ov::is_type<ov::op::v1::Greater>(n) || ov::is_type<ov::op::v1::GreaterEqual>(n) ||
ov::is_type<ov::op::v4::HSwish>(n) || ov::is_type<ov::op::v1::LessEqual>(n) ||
ov::is_type<ov::op::v1::Maximum>(n) || ov::is_type<ov::op::v1::Minimum>(n) ||
ov::is_type<ov::op::v4::Mish>(n) || ov::is_type<ov::op::v1::Mod>(n) ||
ov::is_type<ov::op::v1::Multiply>(n) || ov::is_type<ov::op::v0::PRelu>(n) ||
ov::is_type<ov::op::v0::Relu>(n) || ov::is_type<ov::op::v5::Round>(n) ||
ov::is_type<ov::op::v0::Sigmoid>(n) || ov::is_type<ov::op::v0::Sqrt>(n) ||
ov::is_type<ov::op::v1::Subtract>(n) || ov::is_type<ov::op::v4::Swish>(n) ||
ov::is_type<ov::op::v0::Tanh>(n));
#else
// CPU Plugin support Swish in Subgraph via conversion to SwichCPU which assumes second input to be constant,
// and CPU Plugin does not support Mish for x64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ std::vector<std::string> disabledTestPatterns() {
retVector.emplace_back(R"(smoke_Snippets.*\[.*\?.*\].*)");
retVector.emplace_back(R"(smoke_Snippets_Eltwise.*\[1.1..10.1..8.1..4\].*)");
// smoke_Snippets test cases are not supported on arm64 platforms, except for smoke_Snippets_Eltwise
retVector.emplace_back(R"(smoke_Snippets(?!_Eltwise|_Convert).*)");
retVector.emplace_back(R"(smoke_Snippets(?!_Eltwise|_Convert|_FQDecomposition_).*)");
// arm snippets doesn't support sve_128 that required by dnnl injector jit_uni_eltwise_injector_f32 yet
retVector.emplace_back(R"(smoke_Snippets_Eltwise_TwoResults.*)");
retVector.emplace_back(R"(smoke_Snippets_Eltwise/TwoInputsAndOutputs.*)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(testValuesDecompositionScalars),
::testing::ValuesIn(operations),
// reorder (nChw[16|8]c) + MaxPool + Subgraph + reorder(nchw)
::testing::Values(std::pair<size_t, size_t>{4, 1}),
::testing::Values(std::pair<size_t, size_t>{1, 1}),
::testing::Values(ov::test::utils::DEVICE_CPU)),
FakeQuantizeDecompositionTest::getTestCaseName);

Expand All @@ -85,7 +85,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(testValuesDecompositionPerChannel),
::testing::ValuesIn(operations),
// reorder (nChw[16|8]c) + MaxPool + reorder(nChw[16|8]c) x6 + Subgraph + reorder(nchw)
a-sidorova marked this conversation as resolved.
Show resolved Hide resolved
::testing::Values(std::pair<size_t, size_t>{10, 1}),
::testing::Values(std::pair<size_t, size_t>{1, 1}),
::testing::Values(ov::test::utils::DEVICE_CPU)),
FakeQuantizeDecompositionTest::getTestCaseName);

Expand All @@ -96,7 +96,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(testValuesDecompositionPerChannelInput),
::testing::ValuesIn(operations),
// reorder (nChw[16|8]c) + MaxPool + reorder(nChw[16|8]c) x4 + Subgraph + reorder(nchw)
::testing::Values(std::pair<size_t, size_t>{8, 1}),
::testing::Values(std::pair<size_t, size_t>{1, 1}),
::testing::Values(ov::test::utils::DEVICE_CPU)),
FakeQuantizeDecompositionTest::getTestCaseName);
} // namespace decompositionInSubgraph
Expand Down Expand Up @@ -138,6 +138,7 @@ std::vector<std::pair<std::shared_ptr<ov::Node>, std::pair<std::string, std::str
{std::make_shared<ov::op::v1::Convolution>(), {"Convolution", "Convolution,fakeQuantize"}},
};

#ifdef OPENVINO_ARCH_X86_64
a-sidorova marked this conversation as resolved.
Show resolved Hide resolved
INSTANTIATE_TEST_SUITE_P(
smoke_Snippets,
FakeQuantizeDecompositionTest,
Expand All @@ -148,7 +149,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(std::pair<size_t, size_t>{5, 0}),
a-sidorova marked this conversation as resolved.
Show resolved Hide resolved
::testing::Values(ov::test::utils::DEVICE_CPU)),
FakeQuantizeDecompositionTest::getTestCaseName);

#endif
} // namespace legacyFuse

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void FakeQuantizeDecompositionTest::SetUp() {
values.inputType,
values.fakeQuantizeShapes,
values.zeroPoint,
ov::test::snippets::FunctionHelper::makePrerequisitesOriginal(),
{},
op);
}

Expand Down
Loading