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] Remove DownsampleInterpolate avoid pattern as unused (#36278)
Orest Churaa26fe9f5c339
diff --git a/src/plugins/intel_npu/src/plugin/npuw/partitioning/online/snapshot.cpp b/src/plugins/intel_npu/src/plugin/npuw/partitioning/online/snapshot.cppindex f5bf560401a..977ea691e32 100644--- a/src/plugins/intel_npu/src/plugin/npuw/partitioning/online/snapshot.cpp+++ b/src/plugins/intel_npu/src/plugin/npuw/partitioning/online/snapshot.cpp@@ -658,11 +658,10 @@ void Snapshot::earlyAvoids() {case PatternType::PATTERN: {// FIXME: refactor as more patterns are supportedif (avoid.pattern != "RMSNorm" && avoid.pattern != "SinCos" && avoid.pattern != "GemmaRoPE" &&- avoid.pattern != "DownsampleInterpolate" && avoid.pattern != "FloorModFP32" &&- avoid.pattern != "CumSumSinGen" && avoid.pattern != "BoxMullerNoise" &&- avoid.pattern != "AngleComplex") {+ avoid.pattern != "FloorModFP32" && avoid.pattern != "CumSumSinGen" &&+ avoid.pattern != "BoxMullerNoise" && avoid.pattern != "AngleComplex") {LOG_WARN("OPENVINO_NPUW_AVOID only supports RMSNorm, SinCos, GemmaRoPE, "- "DownsampleInterpolate, FloorModFP32, CumSumSinGen, BoxMullerNoise "+ "FloorModFP32, CumSumSinGen, BoxMullerNoise ""and AngleComplex as patterns ""(don't confuse with operations). ""Avoid pattern "@@ -676,8 +675,6 @@ void Snapshot::earlyAvoids() {rewr.add_matcher<ov::npuw::patterns::avoid::SinCos>(shared_from_this(), avoid.device);} else if (avoid.pattern == "GemmaRoPE") {rewr.add_matcher<ov::npuw::patterns::avoid::GemmaRoPE>(shared_from_this(), avoid.device);- } else if (avoid.pattern == "DownsampleInterpolate") {- rewr.add_matcher<ov::npuw::patterns::avoid::DownsampleInterpolate>(shared_from_this(), avoid.device);} else if (avoid.pattern == "FloorModFP32") {rewr.add_matcher<ov::npuw::patterns::avoid::FloorModFP32>(shared_from_this(), avoid.device);} else if (avoid.pattern == "CumSumSinGen") {diff --git a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/avoid.cpp b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/avoid.cppindex 17906724eaa..1998c95e6f6 100644--- a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/avoid.cpp+++ b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/avoid.cpp@@ -171,48 +171,6 @@ GemmaRoPE::GemmaRoPE(const std::shared_ptr<ov::npuw::online::Snapshot>& snapshot};register_matcher(std::make_shared<opp::Matcher>(sin_cos, "TagGemmaRoPE"), std::move(callback));}-//-------------------------------------------------------------------------------// Pattern: Interpolate in downsampling case-//-// Matches any Interpolate (v4/v11) node. The callback inspects the actual-// partial shapes: if at least one spatial dimension shrinks (input > output),-// the node is marked as "avoid" for the given device.-//-DownsampleInterpolate::DownsampleInterpolate(const std::shared_ptr<ov::npuw::online::Snapshot>& snapshot,- const std::string& avoid_device) {- auto interpolate = opp::wrap_type<ov::op::v4::Interpolate, ov::op::v11::Interpolate>();-- auto node_to_gptr = snapshot->getNodeToGroupMap();-- auto callback = [=](ov::pass::pattern::Matcher& m) {- auto& node_to_output = m.get_pattern_value_map();- auto matched_node = node_to_output.at(interpolate).get_node_shared_ptr();-- // Compare input and output spatial shapes to detect downsampling- const auto& in_shape = matched_node->get_input_partial_shape(0);- const auto& out_shape = matched_node->get_output_partial_shape(0);-- if (in_shape.rank().is_static() && out_shape.rank().is_static() &&- in_shape.rank().get_length() == out_shape.rank().get_length()) {- bool is_downsample = false;- // Check spatial dimensions (skip batch and channel: indices 2..rank-1)- for (auto i = 2; i < in_shape.rank().get_length(); ++i) {- if (in_shape[i].is_static() && out_shape[i].is_static() &&- in_shape[i].get_length() > out_shape[i].get_length()) {- is_downsample = true;- break;- }- }- if (is_downsample) {- LOG_DEBUG("Avoiding downsampling Interpolate: " << matched_node->get_friendly_name());- node_to_gptr->at(matched_node)->avoid(avoid_device);- }- }-- return false; // root hasn't changed- };- register_matcher(std::make_shared<opp::Matcher>(interpolate, "TagDownsampleInterpolateAvoid"), std::move(callback));-}//------------------------------------------------------------------------------// Pattern: FloorMod and its direct input producerdiff --git a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/avoid.hpp b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/avoid.hppindex 59a63a091b7..06cbd18e9dd 100644--- a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/avoid.hpp+++ b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/avoid.hpp@@ -40,14 +40,6 @@ public:GemmaRoPE(const std::shared_ptr<ov::npuw::online::Snapshot>& snapshot, const std::string& avoid_device);};-// Pattern: Interpolate in downsampling case (input spatial dims > output spatial dims)-// Matches any Interpolate node and checks at callback time whether it is downsampling.-class DownsampleInterpolate : public ov::pass::MatcherPass {-public:- OPENVINO_MATCHER_PASS_RTTI("npuw::patterns::avoid::DownsampleInterpolate");- DownsampleInterpolate(const std::shared_ptr<ov::npuw::online::Snapshot>& snapshot, const std::string& avoid_device);-};-// Pattern: FloorMod and its direct input producer — both need FP32 precision.class FloorModFP32 : public ov::pass::MatcherPass {public: