From cbf037b9a8439f7235bf30bee3e1767484d55303 Mon Sep 17 00:00:00 2001 From: Alexandra Sidorova Date: Fri, 4 Nov 2022 15:15:19 +0300 Subject: [PATCH] [Snippets] Fixed SnippetsMarkSkipped for dynamic branches (#13751) --- .../snippets_mark_skipped.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/intel_cpu/src/ngraph_transformations/snippets_mark_skipped.cpp b/src/plugins/intel_cpu/src/ngraph_transformations/snippets_mark_skipped.cpp index 83f0ebb2c6c..f14a8d67691 100644 --- a/src/plugins/intel_cpu/src/ngraph_transformations/snippets_mark_skipped.cpp +++ b/src/plugins/intel_cpu/src/ngraph_transformations/snippets_mark_skipped.cpp @@ -204,14 +204,23 @@ bool isSuitableSubtractAsZeroPointsParent(const std::shared_ptr &nod const bool is_group_conv = ov::is_type(child); if (!is_conv && !is_group_conv) return false; - const auto weight_shape = child->get_input_shape(1); + const auto weight_pshape = child->get_input_partial_shape(1); + if (weight_pshape.is_dynamic()) + return false; + const auto weight_shape = weight_pshape.get_shape(); const bool is_depthwise = is_group_conv && weight_shape[1] == 1 && weight_shape[2] == 1; - const bool deptwise_is_suitable = implication(is_depthwise, child->get_input_shape(0).size() < 5); + const auto depthwise_rank = child->get_input_partial_shape(0).rank(); + if (depthwise_rank.is_dynamic()) + return false; + const bool deptwise_is_suitable = implication(is_depthwise, depthwise_rank.get_length() < 5); if (!deptwise_is_suitable) return false; const auto zp_weights = node->get_input_node_shared_ptr(1); - const auto zp_weight_shape = zp_weights->get_output_shape(0); + const auto zp_weight_pshape = zp_weights->get_output_partial_shape(0); + if (zp_weight_pshape.is_dynamic()) + return false; + const auto zp_weight_shape = zp_weight_pshape.get_shape(); auto correct_shape = ov::Shape(zp_weight_shape.size(), 1); if (zp_weight_shape.size() > 1) correct_shape[1] = zp_weight_shape[1]; @@ -289,6 +298,7 @@ bool isSuitableChildForFusingMatMul(const std::shared_ptr &node, con if (!can_be_converted_to_FC) { // can with rank() > 2 // Algorithm::EltwisePowerStatic is ignored + // Note: we can call get_output_shape() because before we checked for static input shapes if (node->get_output_shape(0).size() > 2) { if (ov::is_type(node) || ov::is_type(node) ||