OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[NPUW] Extend optimize_v_tensor patterns with optional FakeConvert (#31642)
Alexey Smirnovd05f47f99f44
diff --git a/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.cpp b/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.cppindex b5552bc9ee2..8bdef791454 100644--- a/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.cpp+++ b/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.cpp@@ -126,8 +126,10 @@ private:auto transpose = opp::wrap_type<ov::op::v1::Transpose>({opp::any_input(), opp::any_input()});auto convert = opp::optional<ov::op::v0::Convert>({param->output(0)});auto concat = opp::wrap_type<ov::op::v0::Concat>({convert, transpose});+ auto fake_convert =+ opp::optional<ov::op::v13::FakeConvert>({concat->output(0), opp::any_input(), opp::any_input()});auto softmax = opp::wrap_type<ov::op::v8::Softmax>({opp::any_input()});- auto matmul = opp::wrap_type<ov::op::v0::MatMul>({softmax, concat});+ auto matmul = opp::wrap_type<ov::op::v0::MatMul>({softmax, fake_convert});auto callback = [=](ov::pass::pattern::Matcher& m) {auto& node_to_output = m.get_pattern_value_map();@@ -163,10 +165,12 @@ private:auto transpose = opp::wrap_type<ov::op::v1::Transpose>({opp::any_input(), opp::any_input()});auto convert = opp::optional<ov::op::v0::Convert>({param->output(0)});auto concat = opp::wrap_type<ov::op::v0::Concat>({convert, transpose});+ auto fake_convert =+ opp::optional<ov::op::v13::FakeConvert>({concat->output(0), opp::any_input(), opp::any_input()});// only difference is that broadcast wrapped into unsquese/reshape, while transposed tensor didn't changeconst auto unsqueeze_axes = opp::wrap_type<ov::op::v0::Constant>();- auto unsqueeze = opp::wrap_type<ov::op::v0::Unsqueeze>({concat, unsqueeze_axes});+ auto unsqueeze = opp::wrap_type<ov::op::v0::Unsqueeze>({fake_convert, unsqueeze_axes});auto broadcast = opp::wrap_type<ov::op::v1::Broadcast, ov::op::v3::Broadcast>({unsqueeze, opp::any_input()});auto reshape = opp::wrap_type<ov::op::v1::Reshape>({broadcast, opp::any_input()});