From 345cabacf1e4295e54859e59eb98b45c62f75a80 Mon Sep 17 00:00:00 2001 From: Alexandra Sidorova Date: Tue, 20 Feb 2024 17:27:52 +0400 Subject: [PATCH 1/2] [CPU] Moved Ngram fusion with SymbolicOpts --- .../cpu_opset/convert_to_cpu_specific_opset.hpp | 2 -- .../src/transformations/transformation_pipeline.cpp | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp index e334d11babe0ee..f44f41c150a0ce 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp @@ -50,8 +50,6 @@ inline void ConvertToCPUSpecificOpset(std::shared_ptr &nGraphFunc) { type_to_fuse_map{{}}, false, false); - auto symbolic_pipeline = CPU_REGISTER_PASS_COMMON(manager, ov::pass::SymbolicOptimizations, false); - symbolic_pipeline->get_manager()->register_pass(); CPU_REGISTER_PASS_COMMON(manager, ov::pass::Validate); manager.run_passes(nGraphFunc); diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp index a4522436fbbaaf..3b57852fb1e33c 100644 --- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp +++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp @@ -708,6 +708,11 @@ void Transformations::PostLpt() { CPU_REGISTER_PASS_X64(postLPTPassManager, RoPEFusion); CPU_REGISTER_PASS_X64(postLPTPassManager, StatefulSDPAFusion); + + // Should be before Snippets pipeline because Ngram pattern contains eltwise nodes that can be tokenized by Snippets. + auto symbolic_pipeline = CPU_REGISTER_PASS_COMMON(postLPTPassManager, ov::pass::SymbolicOptimizations, false); + symbolic_pipeline->get_manager()->register_pass(); + postLPTPassManager.run_passes(model); } From 4c57bc7f08eb66705d8d20baa5b0b2b53ef9b84c Mon Sep 17 00:00:00 2001 From: Alexandra Sidorova Date: Mon, 26 Feb 2024 14:13:01 +0400 Subject: [PATCH 2/2] [CPU] Moved header includes --- .../transformations/cpu_opset/convert_to_cpu_specific_opset.hpp | 2 -- .../intel_cpu/src/transformations/transformation_pipeline.cpp | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp index f44f41c150a0ce..4139d5c6cf8042 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp @@ -15,11 +15,9 @@ #include "common/pass/convert_to_swish_cpu.hpp" #include "common/pass/move_fc_reshape_to_weights.hpp" #include "transformations/convert_precision.hpp" -#include "transformations/symbolic_transformations/symbolic_optimizations.hpp" #include "transformations/utils/utils.hpp" #include "common/pass/rnn_sequences_optimization.hpp" #include "transformations/common_optimizations/reshape_sequence_fusion.hpp" -#include "common/pass/ngram_fusion.hpp" #include "transformations/defs.hpp" #include "itt.hpp" diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp index 3b57852fb1e33c..817f346d670c5f 100644 --- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp +++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp @@ -83,6 +83,7 @@ #include "transformations/opset_conversions/convert_opset2_to_opset1.hpp" #include "transformations/opset_conversions/convert_opset3_to_opset2.hpp" #include "transformations/smart_reshape/matmul_sr.hpp" +#include "transformations/symbolic_transformations/symbolic_optimizations.hpp" #include "transformations/init_node_info.hpp" #include "utils/ngraph_transformation.hpp" #include "utils/print_model.hpp" @@ -113,6 +114,7 @@ #include "transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.hpp" #include "transformations/cpu_opset/common/pass/insert_convert_after_extension.hpp" #include "transformations/cpu_opset/common/pass/move_eltwise_up_data_movement.hpp" +#include "transformations/cpu_opset/common/pass/ngram_fusion.hpp" #include "transformations/cpu_opset/common/pass/permute_slice_n_interpolation.hpp" #include "transformations/cpu_opset/common/pass/swap_convert_transpose.hpp" #include "transformations/cpu_opset/common/pass/rope_fusion.hpp"