From af00bea6a54bc4af7495a803642419821e2583f4 Mon Sep 17 00:00:00 2001 From: Srinjoy Date: Mon, 27 Jan 2025 21:35:27 +0530 Subject: [PATCH 1/6] Enable FakeQuantize op tokenization and decomposition tests --- .../intel_cpu/src/transformations/transformation_pipeline.cpp | 3 ++- .../functional/shared_tests_instances/skip_tests_config.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp index da61917a146db0..c9778baace76b4 100644 --- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp +++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp @@ -1110,7 +1110,8 @@ void Transformations::MainSnippets(void) { ov::is_type(n) || ov::is_type(n) || ov::is_type(n) || ov::is_type(n) || ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n)); + ov::is_type(n) || ov::is_type(n) || + ov::is_type(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 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 4eb4fa819e3224..9f807e49668374 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 @@ -460,7 +460,7 @@ std::vector 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.*)"); From ddb65185befd54e151f791bab0cd7fc691117df7 Mon Sep 17 00:00:00 2001 From: Srinjoy Date: Mon, 27 Jan 2025 21:43:48 +0530 Subject: [PATCH 2/6] Fix missing reorder and MaxPool ops, disable legacyFuse tests on non-x64 platforms --- .../snippets/fake_quantize_decomposition_test.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp index 4e2cba4cebc6b8..c04eccd846a034 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp @@ -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{4, 1}), + ::testing::Values(std::pair{1, 1}), ::testing::Values(ov::test::utils::DEVICE_CPU)), FakeQuantizeDecompositionTest::getTestCaseName); @@ -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) - ::testing::Values(std::pair{10, 1}), + ::testing::Values(std::pair{1, 1}), ::testing::Values(ov::test::utils::DEVICE_CPU)), FakeQuantizeDecompositionTest::getTestCaseName); @@ -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{8, 1}), + ::testing::Values(std::pair{1, 1}), ::testing::Values(ov::test::utils::DEVICE_CPU)), FakeQuantizeDecompositionTest::getTestCaseName); } // namespace decompositionInSubgraph @@ -138,6 +138,7 @@ std::vector, std::pair(), {"Convolution", "Convolution,fakeQuantize"}}, }; +#ifdef OPENVINO_ARCH_X86_64 INSTANTIATE_TEST_SUITE_P( smoke_Snippets, FakeQuantizeDecompositionTest, @@ -148,7 +149,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values(std::pair{5, 0}), ::testing::Values(ov::test::utils::DEVICE_CPU)), FakeQuantizeDecompositionTest::getTestCaseName); - +#endif } // namespace legacyFuse } // namespace From c29c68bf3a9785e76e7e53bbcc8b7d2a81ffeb4d Mon Sep 17 00:00:00 2001 From: Srinjoy Date: Mon, 27 Jan 2025 21:50:15 +0530 Subject: [PATCH 3/6] Replace MaxPool insertions with empty vector in test Set Up --- .../shared/src/snippets/fake_quantize_decomposition_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/functional/plugin/shared/src/snippets/fake_quantize_decomposition_test.cpp b/src/tests/functional/plugin/shared/src/snippets/fake_quantize_decomposition_test.cpp index 6d738751767405..43668ee49cdae5 100644 --- a/src/tests/functional/plugin/shared/src/snippets/fake_quantize_decomposition_test.cpp +++ b/src/tests/functional/plugin/shared/src/snippets/fake_quantize_decomposition_test.cpp @@ -61,7 +61,7 @@ void FakeQuantizeDecompositionTest::SetUp() { values.inputType, values.fakeQuantizeShapes, values.zeroPoint, - ov::test::snippets::FunctionHelper::makePrerequisitesOriginal(), + {}, op); } From 06e325dea76f0588f94c1b042d015e04511080e8 Mon Sep 17 00:00:00 2001 From: Srinjoy Date: Mon, 27 Jan 2025 22:20:42 +0530 Subject: [PATCH 4/6] Reorder FakeQuantize op in is_supported_op list --- .../transformation_pipeline.cpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp index c9778baace76b4..cd5ec8eff15ff2 100644 --- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp +++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp @@ -1100,18 +1100,18 @@ void Transformations::MainSnippets(void) { ov::is_type(n) || ov::is_type(n) || ov::is_type(n) || ov::is_type(n) || ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n) || ov::is_type(n) || - ov::is_type(n)); + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(n) || ov::is_type(n) || + ov::is_type(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 From f7cc92d0a5fff47ce5584353a9255a72b935b84b Mon Sep 17 00:00:00 2001 From: Srinjoy Date: Tue, 28 Jan 2025 00:14:50 +0530 Subject: [PATCH 5/6] Improve readability in test file --- .../snippets/fake_quantize_decomposition_test.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp index c04eccd846a034..60f4e1562ea947 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp @@ -73,7 +73,6 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Combine( ::testing::ValuesIn(testValuesDecompositionScalars), ::testing::ValuesIn(operations), - // reorder (nChw[16|8]c) + MaxPool + Subgraph + reorder(nchw) ::testing::Values(std::pair{1, 1}), ::testing::Values(ov::test::utils::DEVICE_CPU)), FakeQuantizeDecompositionTest::getTestCaseName); @@ -84,7 +83,6 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Combine( ::testing::ValuesIn(testValuesDecompositionPerChannel), ::testing::ValuesIn(operations), - // reorder (nChw[16|8]c) + MaxPool + reorder(nChw[16|8]c) x6 + Subgraph + reorder(nchw) ::testing::Values(std::pair{1, 1}), ::testing::Values(ov::test::utils::DEVICE_CPU)), FakeQuantizeDecompositionTest::getTestCaseName); @@ -95,13 +93,12 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Combine( ::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{1, 1}), ::testing::Values(ov::test::utils::DEVICE_CPU)), FakeQuantizeDecompositionTest::getTestCaseName); } // namespace decompositionInSubgraph - +#ifdef OPENVINO_ARCH_X86_64 namespace legacyFuse { const std::vector testValuesLegacyFuse = { { @@ -138,7 +135,6 @@ std::vector, std::pair(), {"Convolution", "Convolution,fakeQuantize"}}, }; -#ifdef OPENVINO_ARCH_X86_64 INSTANTIATE_TEST_SUITE_P( smoke_Snippets, FakeQuantizeDecompositionTest, @@ -149,7 +145,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values(std::pair{5, 0}), ::testing::Values(ov::test::utils::DEVICE_CPU)), FakeQuantizeDecompositionTest::getTestCaseName); -#endif } // namespace legacyFuse +#endif } // namespace From 7c7c7500a65eccb56dc203e8513870814e384aca Mon Sep 17 00:00:00 2001 From: Srinjoy Date: Tue, 28 Jan 2025 11:36:02 +0530 Subject: [PATCH 6/6] Update expected node count and brief comment in legacyFuse tests --- .../snippets/fake_quantize_decomposition_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp index 60f4e1562ea947..8c3dbc0f7ed108 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/fake_quantize_decomposition_test.cpp @@ -141,8 +141,8 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Combine( ::testing::ValuesIn(testValuesLegacyFuse), ::testing::ValuesIn(operations), - // reorder (nChw[16|8]c) + MaxPool + reorder(nhwc) + Convolution(with internal weight reordering) + reorder(nchw) - ::testing::Values(std::pair{5, 0}), + // reorder (nChw[16|8]c) + Convolution(with internal weight reordering) + reorder(nchw) + ::testing::Values(std::pair{3, 0}), ::testing::Values(ov::test::utils::DEVICE_CPU)), FakeQuantizeDecompositionTest::getTestCaseName); } // namespace legacyFuse