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
[cpu] Use port mask from static shape inference (#27615)
Pawel Raaszcb049b13c97f
diff --git a/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp b/src/plugins/intel_cpu/src/nodes/batch_to_space.cppindex 8ec1fdab85e..80713e90750 100644--- a/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp+++ b/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp@@ -29,7 +29,7 @@ bool BatchToSpace::isSupportedOperation(const std::shared_ptr<const ov::Node>& o}BatchToSpace::BatchToSpace(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(1, 2, 3))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp b/src/plugins/intel_cpu/src/nodes/bin_conv.cppindex f2de2d20a17..d1e82235ba9 100644--- a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp+++ b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp@@ -899,7 +899,7 @@ bool BinaryConvolution::isSupportedOperation(const std::shared_ptr<const ov::Nod}BinaryConvolution::BinaryConvolution(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (isSupportedOperation(op, errorMessage)) {errorPrefix = "BinaryConvolution node with name '" + getName() + "' ";diff --git a/src/plugins/intel_cpu/src/nodes/broadcast.cpp b/src/plugins/intel_cpu/src/nodes/broadcast.cppindex ac8dd814ae9..c88803e07de 100644--- a/src/plugins/intel_cpu/src/nodes/broadcast.cpp+++ b/src/plugins/intel_cpu/src/nodes/broadcast.cpp@@ -47,7 +47,7 @@ bool Broadcast::isSupportedOperation(const std::shared_ptr<const ov::Node>& op,}Broadcast::Broadcast(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(TARGET_SHAPE_IDX, AXES_MAPPING_IDX))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/col2im.cpp b/src/plugins/intel_cpu/src/nodes/col2im.cppindex 7faa4920613..4b83e78fd82 100644--- a/src/plugins/intel_cpu/src/nodes/col2im.cpp+++ b/src/plugins/intel_cpu/src/nodes/col2im.cpp@@ -10,7 +10,7 @@ namespace ov {namespace intel_cpu {namespace node {Col2Im::Col2Im(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(1, 2))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/concat.cpp b/src/plugins/intel_cpu/src/nodes/concat.cppindex ed8e34328fb..635f37b2d05 100644--- a/src/plugins/intel_cpu/src/nodes/concat.cpp+++ b/src/plugins/intel_cpu/src/nodes/concat.cpp@@ -50,7 +50,7 @@ bool Concat::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std}Concat::Concat(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/conv.cpp b/src/plugins/intel_cpu/src/nodes/conv.cppindex cbdb35db271..7cf7698e989 100644--- a/src/plugins/intel_cpu/src/nodes/conv.cpp+++ b/src/plugins/intel_cpu/src/nodes/conv.cpp@@ -240,7 +240,7 @@ bool Convolution::isSupportedOperation(const std::shared_ptr<const ov::Node>& op}Convolution::Convolution(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)), withBiases(false), withSum(false), withDWConv(false),+ : Node(op, context, NgraphShapeInferFactory(op)), withBiases(false), withSum(false), withDWConv(false),isGrouped(false), dw_conv_oc(0), dw_conv_ih(0), dw_conv_iw(0), dw_conv_in_dt(memory::data_type::undef),groupNum(1lu), IC(1), groupIC(1), groupOC(1), eltwisePrecision(ov::element::f32) {std::string errorMessage;diff --git a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cppindex 85c41acedf6..0b467fe452e 100644--- a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp+++ b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp@@ -27,7 +27,7 @@ bool CTCGreedyDecoder::isSupportedOperation(const std::shared_ptr<const ov::Node}CTCGreedyDecoder::CTCGreedyDecoder(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cppindex be343076281..63db3968094 100644--- a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp+++ b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp@@ -27,7 +27,7 @@ bool CTCGreedyDecoderSeqLen::isSupportedOperation(const std::shared_ptr<const ov}CTCGreedyDecoderSeqLen::CTCGreedyDecoderSeqLen(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp b/src/plugins/intel_cpu/src/nodes/ctc_loss.cppindex 3161c9a0e87..6d09b0aea7e 100644--- a/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp+++ b/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp@@ -26,7 +26,7 @@ bool CTCLoss::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, st}CTCLoss::CTCLoss(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/cum_sum.cpp b/src/plugins/intel_cpu/src/nodes/cum_sum.cppindex 8327084839c..e411283e661 100644--- a/src/plugins/intel_cpu/src/nodes/cum_sum.cpp+++ b/src/plugins/intel_cpu/src/nodes/cum_sum.cpp@@ -29,7 +29,8 @@ bool CumSum::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, stdreturn true;}-CumSum::CumSum(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context) : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+CumSum::CumSum(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/def_conv.cpp b/src/plugins/intel_cpu/src/nodes/def_conv.cppindex eb56902c653..0167a18673c 100644--- a/src/plugins/intel_cpu/src/nodes/def_conv.cpp+++ b/src/plugins/intel_cpu/src/nodes/def_conv.cpp@@ -745,7 +745,7 @@ bool DefConvKey::operator==(const DefConvKey &rhs) const {} // namespaceDeformableConvolution::DeformableConvolution(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp b/src/plugins/intel_cpu/src/nodes/depth_to_space.cppindex 15d521a423c..eb3789068ad 100644--- a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp+++ b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp@@ -67,7 +67,7 @@ bool DepthToSpace::isSupportedOperation(const std::shared_ptr<const ov::Node>& o}DepthToSpace::DepthToSpace(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/detection_output.cpp b/src/plugins/intel_cpu/src/nodes/detection_output.cppindex cb9ec41ba4f..99702780b83 100644--- a/src/plugins/intel_cpu/src/nodes/detection_output.cpp+++ b/src/plugins/intel_cpu/src/nodes/detection_output.cpp@@ -49,7 +49,7 @@ bool DetectionOutput::isSupportedOperation(const std::shared_ptr<const ov::Node>}DetectionOutput::DetectionOutput(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/dft.cpp b/src/plugins/intel_cpu/src/nodes/dft.cppindex 32ec9ef9630..76ecbbb3661 100644--- a/src/plugins/intel_cpu/src/nodes/dft.cpp+++ b/src/plugins/intel_cpu/src/nodes/dft.cpp@@ -42,8 +42,8 @@ bool DFT::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::sreturn true;}-DFT::DFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context) :- Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+DFT::DFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cppindex dc69892dabb..b5fbaee9828 100644--- a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp+++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp@@ -29,7 +29,7 @@ bool EmbeddingBagOffset::isSupportedOperation(const std::shared_ptr<const ov::No}EmbeddingBagOffset::EmbeddingBagOffset(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)),+ : Node(op, context, NgraphShapeInferFactory(op)),EmbeddingBag(op, 3lu, 1lu, 4lu, 3lu) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cppindex 0b490a28a81..fd2e0b6141f 100644--- a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp+++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp@@ -28,7 +28,7 @@ bool EmbeddingBagPacked::isSupportedOperation(const std::shared_ptr<const ov::No}EmbeddingBagPacked::EmbeddingBagPacked(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)),+ : Node(op, context, NgraphShapeInferFactory(op)),EmbeddingBag(op, 2lu, 1lu, 2lu, 3lu) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {diff --git a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cppindex 1b2e28e6039..2a012c6b941 100644--- a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp+++ b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp@@ -26,7 +26,7 @@ bool EmbeddingSegmentsSum::isSupportedOperation(const std::shared_ptr<const ov::}EmbeddingSegmentsSum::EmbeddingSegmentsSum(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(NUM_SEGMENTS_IDX))),+ : Node(op, context, NgraphShapeInferFactory(op)),EmbeddingBag(op, 4lu, 1lu, 5lu, 4lu) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cppindex cb21606638c..441e013af2c 100644--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp@@ -236,7 +236,7 @@ bool ExperimentalDetectronDetectionOutput::isSupportedOperation(const std::shareExperimentalDetectronDetectionOutput::ExperimentalDetectronDetectionOutput(const std::shared_ptr<ov::Node>& op,const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cppindex 26adc6fc573..33f17c8d95f 100644--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp@@ -286,7 +286,7 @@ bool ExperimentalDetectronGenerateProposalsSingleImage::isSupportedOperationExperimentalDetectronGenerateProposalsSingleImage::ExperimentalDetectronGenerateProposalsSingleImage(const std::shared_ptr<ov::Node>& op,const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cppindex dc01230ee50..eead95def0a 100644--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp@@ -26,10 +26,9 @@ bool ExperimentalDetectronPriorGridGenerator::isSupportedOperation(const std::shreturn true;}-ExperimentalDetectronPriorGridGenerator::ExperimentalDetectronPriorGridGenerator(- const std::shared_ptr<ov::Node>& op,- const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ExperimentalDetectronPriorGridGenerator::ExperimentalDetectronPriorGridGenerator(const std::shared_ptr<ov::Node>& op,+ const GraphContext::CPtr context)+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cppindex a94337145eb..c92e3c2594d 100644--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp@@ -293,10 +293,9 @@ bool ExperimentalDetectronROIFeatureExtractor::isSupportedOperation(const std::sreturn true;}-ExperimentalDetectronROIFeatureExtractor::ExperimentalDetectronROIFeatureExtractor(- const std::shared_ptr<ov::Node>& op,- const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ExperimentalDetectronROIFeatureExtractor::ExperimentalDetectronROIFeatureExtractor(const std::shared_ptr<ov::Node>& op,+ const GraphContext::CPtr context)+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cppindex ac778b0d4d9..46b60fcdb83 100644--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp@@ -30,7 +30,7 @@ bool ExperimentalDetectronTopKROIs::isSupportedOperation(const std::shared_ptr<cExperimentalDetectronTopKROIs::ExperimentalDetectronTopKROIs(const std::shared_ptr<ov::Node>& op,const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cppindex 7c3dda49931..8b5d0b51061 100644--- a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp+++ b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp@@ -329,7 +329,7 @@ bool ExtractImagePatchesKey::operator==(const ExtractImagePatchesKey& rhs) const} // namespaceExtractImagePatches::ExtractImagePatches(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp b/src/plugins/intel_cpu/src/nodes/gather_elements.cppindex f0fd14121b2..8653bda8c48 100644--- a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp+++ b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp@@ -30,7 +30,7 @@ bool GatherElements::isSupportedOperation(const std::shared_ptr<const ov::Node>&}GatherElements::GatherElements(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp b/src/plugins/intel_cpu/src/nodes/gather_nd.cppindex 2dc91dd1255..8c81f9b770a 100644--- a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp+++ b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp@@ -32,7 +32,7 @@ bool GatherND::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, s}GatherND::GatherND(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp b/src/plugins/intel_cpu/src/nodes/gather_tree.cppindex f318290defb..5834cd1e104 100644--- a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp+++ b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp@@ -29,7 +29,7 @@ bool GatherTree::isSupportedOperation(const std::shared_ptr<const ov::Node>& op,}GatherTree::GatherTree(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/grid_sample.cppindex c8eed21bb31..c8b73360539 100644--- a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp+++ b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp@@ -39,7 +39,7 @@ bool GridSample::isSupportedOperation(const std::shared_ptr<const ov::Node>& op,#if defined(OPENVINO_ARCH_X86_64)GridSample::GridSample(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(1))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {THROW_CPU_NODE_ERR(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/grn.cpp b/src/plugins/intel_cpu/src/nodes/grn.cppindex f20e7d6b90a..10de2ef2286 100644--- a/src/plugins/intel_cpu/src/nodes/grn.cpp+++ b/src/plugins/intel_cpu/src/nodes/grn.cpp@@ -26,7 +26,7 @@ bool GRN::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::s}GRN::GRN(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/interaction.cpp b/src/plugins/intel_cpu/src/nodes/interaction.cppindex 6f604f4a9e2..5ec48e7a263 100644--- a/src/plugins/intel_cpu/src/nodes/interaction.cpp+++ b/src/plugins/intel_cpu/src/nodes/interaction.cpp@@ -164,7 +164,7 @@ private:#endif // OPENVINO_ARCH_X86_64Interaction::Interaction(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/inverse.cpp b/src/plugins/intel_cpu/src/nodes/inverse.cppindex 6eeecfad722..bff23846966 100644--- a/src/plugins/intel_cpu/src/nodes/inverse.cpp+++ b/src/plugins/intel_cpu/src/nodes/inverse.cpp@@ -16,7 +16,7 @@ namespace intel_cpu {namespace node {Inverse::Inverse(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {THROW_CPU_NODE_ERR(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp b/src/plugins/intel_cpu/src/nodes/llm_mlp.cppindex 8df1f5498da..8c598c06414 100644--- a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp+++ b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp@@ -501,7 +501,7 @@ struct LLMMLP::Executor : public LLMMLP::ExecutorBase {#endifLLMMLP::LLMMLP(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;const auto & config = context->getConfig();if (!isSupportedOperation(op, errorMessage, config.fcDynamicQuantizationGroupSize)) {diff --git a/src/plugins/intel_cpu/src/nodes/log_softmax.cpp b/src/plugins/intel_cpu/src/nodes/log_softmax.cppindex 7c0c90ddb2c..8cc1c2bfb8d 100644--- a/src/plugins/intel_cpu/src/nodes/log_softmax.cpp+++ b/src/plugins/intel_cpu/src/nodes/log_softmax.cpp@@ -26,7 +26,7 @@ bool LogSoftmax::isSupportedOperation(const std::shared_ptr<const ov::Node>& op,}LogSoftmax::LogSoftmax(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/memory.cpp b/src/plugins/intel_cpu/src/nodes/memory.cppindex 1c6e2aca6fa..b43085f3e62 100644--- a/src/plugins/intel_cpu/src/nodes/memory.cpp+++ b/src/plugins/intel_cpu/src/nodes/memory.cpp@@ -116,7 +116,7 @@ bool MemoryOutputBase::isSupportedOperation(const std::shared_ptr<const ov::Node}MemoryOutputBase::MemoryOutputBase(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) , MemoryNode(op) {+ : Node(op, context, NgraphShapeInferFactory(op)), MemoryNode(op) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/mha.cpp b/src/plugins/intel_cpu/src/nodes/mha.cppindex 9364058c5d1..97c2d9be4d4 100644--- a/src/plugins/intel_cpu/src/nodes/mha.cpp+++ b/src/plugins/intel_cpu/src/nodes/mha.cpp@@ -747,7 +747,7 @@ bool MHA::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::s}MHA::MHA(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/multinomial.cpp b/src/plugins/intel_cpu/src/nodes/multinomial.cppindex 24958b4e2b9..4ea11b2b44f 100644--- a/src/plugins/intel_cpu/src/nodes/multinomial.cpp+++ b/src/plugins/intel_cpu/src/nodes/multinomial.cpp@@ -14,7 +14,7 @@ namespace intel_cpu {namespace node {Multinomial::Multinomial(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(NUM_SAMPLES_PORT))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {THROW_CPU_NODE_ERR(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/mvn.cpp b/src/plugins/intel_cpu/src/nodes/mvn.cppindex 76471b0cca7..6405a3f1511 100644--- a/src/plugins/intel_cpu/src/nodes/mvn.cpp+++ b/src/plugins/intel_cpu/src/nodes/mvn.cpp@@ -1774,7 +1774,7 @@ bool MVN::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::s}MVN::MVN(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/pad.cpp b/src/plugins/intel_cpu/src/nodes/pad.cppindex 10cdb2a19b7..fb31a0a08fd 100644--- a/src/plugins/intel_cpu/src/nodes/pad.cpp+++ b/src/plugins/intel_cpu/src/nodes/pad.cpp@@ -42,7 +42,7 @@ bool Pad::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::s}Pad::Pad(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(PADS_BEGIN_ID, PADS_END_ID))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/pooling.cpp b/src/plugins/intel_cpu/src/nodes/pooling.cppindex 71e5c38f0e0..c7b687d83c2 100644--- a/src/plugins/intel_cpu/src/nodes/pooling.cpp+++ b/src/plugins/intel_cpu/src/nodes/pooling.cpp@@ -164,7 +164,7 @@ bool Pooling::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, st}Pooling::Pooling(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/proposal.cpp b/src/plugins/intel_cpu/src/nodes/proposal.cppindex f2cfb448755..cb29e4907de 100644--- a/src/plugins/intel_cpu/src/nodes/proposal.cpp+++ b/src/plugins/intel_cpu/src/nodes/proposal.cpp@@ -92,7 +92,7 @@ bool Proposal::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, s}Proposal::Proposal(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cppindex e0c130e0ba6..80b1f577572 100644--- a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp+++ b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp@@ -58,7 +58,7 @@ bool PSROIPooling::isSupportedOperation(const std::shared_ptr<const ov::Node>& o}PSROIPooling::PSROIPooling(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp b/src/plugins/intel_cpu/src/nodes/qkv_proj.cppindex 00c8b6f9b17..f732fe883f8 100644--- a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp+++ b/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp@@ -324,7 +324,7 @@ void QKVProjection::execute(dnnl::stream strm) {}QKVProjection::QKVProjection(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;const auto & config = context->getConfig();diff --git a/src/plugins/intel_cpu/src/nodes/random_uniform.cpp b/src/plugins/intel_cpu/src/nodes/random_uniform.cppindex 808ad10c440..b40796bf8d9 100644--- a/src/plugins/intel_cpu/src/nodes/random_uniform.cpp+++ b/src/plugins/intel_cpu/src/nodes/random_uniform.cpp@@ -29,7 +29,7 @@ bool RandomUniform::isSupportedOperation(const std::shared_ptr<const ov::Node>&}RandomUniform::RandomUniform(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(0, 1, 2))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {THROW_CPU_NODE_ERR(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/rdft.cpp b/src/plugins/intel_cpu/src/nodes/rdft.cppindex c7752a3d29b..4e506fb7712 100644--- a/src/plugins/intel_cpu/src/nodes/rdft.cpp+++ b/src/plugins/intel_cpu/src/nodes/rdft.cpp@@ -72,8 +72,8 @@ static std::vector<int> getDefaultSignalSizes(const VectorDims& inputShape, consreturn signalSizes;}-RDFT::RDFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context) :- Node(op, context, NgraphShapeInferFactory(op, PortMask(1, 2))) {+RDFT::RDFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/reduce.cpp b/src/plugins/intel_cpu/src/nodes/reduce.cppindex 6cfc94a02b9..7c18421ad3d 100644--- a/src/plugins/intel_cpu/src/nodes/reduce.cpp+++ b/src/plugins/intel_cpu/src/nodes/reduce.cpp@@ -1895,7 +1895,7 @@ bool Reduce::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std}Reduce::Reduce(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(REDUCE_INDEXES))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (isSupportedOperation(op, errorMessage)) {errorPrefix = "Reduce node with name '" + getName() + "'";diff --git a/src/plugins/intel_cpu/src/nodes/reference.cpp b/src/plugins/intel_cpu/src/nodes/reference.cppindex 185815acd8c..2c83a4ea452 100644--- a/src/plugins/intel_cpu/src/nodes/reference.cpp+++ b/src/plugins/intel_cpu/src/nodes/reference.cpp@@ -4,14 +4,29 @@#include "reference.h"#include "common/cpu_memcpy.h"+#include "shape_inference/shape_inference_ngraph.hpp"namespace ov {namespace intel_cpu {++class ReferenceShapeInferFactory : public ShapeInferFactory {+public:+ ReferenceShapeInferFactory(std::shared_ptr<ov::Node> op) : m_op{std::move(op)} {}++ ShapeInferPtr makeShapeInfer() const override {+ return std::make_shared<NgraphShapeInfer>(make_shape_inference(m_op), FULL_PORT_MASK);+ }++private:+ std::shared_ptr<ov::Node> m_op;+};+namespace node {-Reference::Reference(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context,- const std::string& errorMessage) :- Node(op, context, NgraphShapeInferFactory(op, FULL_PORT_MASK)), ovCoreNode(op), additionalErrorMessage(errorMessage) {+Reference::Reference(const std::shared_ptr<ov::Node>& op,+ const GraphContext::CPtr& context,+ const std::string& errorMessage)+ : Node(op, context, ReferenceShapeInferFactory(op)), ovCoreNode(op), additionalErrorMessage(errorMessage) {if (!op->has_evaluate()) {OPENVINO_THROW_NOT_IMPLEMENTED("Cannot fallback on ngraph reference implementation (Ngraph::Node::evaluate() is not implemented)");@@ -70,7 +85,7 @@ void Reference::executeDynamicImpl(dnnl::stream strm) {}}} else {- THROW_CPU_NODE_ERR("got unexpected shape infer result status during the inference.");+ THROW_CPU_NODE_ERR("got unexpected shape infer result status during the inference.");}if (!ovCoreNode->evaluate(outputs, inputs)) {THROW_CPU_NODE_ERR("evaluation failed for core operation: ", std::string(ovCoreNode->get_type_name()));@@ -110,9 +125,10 @@ bool Reference::needShapeInfer() const {ov::TensorVector Reference::prepareInputs() const {ov::TensorVector inputs;for (size_t i = 0lu; i < inputShapes.size(); i++) {- void *srcDataPtr = getSrcDataAtPort(i);- ov::Shape shape = ovCoreNode->get_input_partial_shape(i).rank().get_length() == 0 ?- ov::Shape{} : getParentEdgeAt(i)->getMemory().getStaticDims();+ void* srcDataPtr = getSrcDataAtPort(i);+ ov::Shape shape = ovCoreNode->get_input_partial_shape(i).rank().get_length() == 0+ ? ov::Shape{}+ : getParentEdgeAt(i)->getMemory().getStaticDims();if (std::any_of(shape.begin(), shape.end(), [](const size_t dim) { return dim == 0lu; } )) {inputs.push_back(ov::Tensor(ovCoreNode->get_input_element_type(i), shape));@@ -127,9 +143,10 @@ ov::TensorVector Reference::prepareInputs() const {ov::TensorVector Reference::prepareOutputs() const {ov::TensorVector outputs;for (size_t i = 0lu; i < outputShapes.size(); i++) {- void *dstDataPtr = getDstDataAtPort(i);- ov::Shape shape = ovCoreNode->get_output_partial_shape(i).rank().get_length() == 0 ?- ov::Shape{} : getChildEdgeAt(i)->getMemory().getStaticDims();+ void* dstDataPtr = getDstDataAtPort(i);+ ov::Shape shape = ovCoreNode->get_output_partial_shape(i).rank().get_length() == 0+ ? ov::Shape{}+ : getChildEdgeAt(i)->getMemory().getStaticDims();if (std::any_of(shape.begin(), shape.end(), [](const size_t dim) { return dim == 0lu; } )) {outputs.push_back(ov::Tensor(ovCoreNode->get_output_element_type(i), shape));diff --git a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp b/src/plugins/intel_cpu/src/nodes/region_yolo.cppindex 8ea69feea30..c575237f48e 100644--- a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp+++ b/src/plugins/intel_cpu/src/nodes/region_yolo.cpp@@ -247,7 +247,7 @@ bool RegionYolo::needPrepareParams() const {}RegionYolo::RegionYolo(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp b/src/plugins/intel_cpu/src/nodes/reorg_yolo.cppindex 1f37e15edae..49ad9b9cec5 100644--- a/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp+++ b/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp@@ -26,7 +26,7 @@ bool ReorgYolo::isSupportedOperation(const std::shared_ptr<const ov::Node>& op,}ReorgYolo::ReorgYolo(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cppindex b51eab4bef3..66139415588 100644--- a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp+++ b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp@@ -27,7 +27,7 @@ bool ReverseSequence::isSupportedOperation(const std::shared_ptr<const ov::Node>}ReverseSequence::ReverseSequence(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/roi_align.cpp b/src/plugins/intel_cpu/src/nodes/roi_align.cppindex 27f9426dca6..2190ebd9445 100644--- a/src/plugins/intel_cpu/src/nodes/roi_align.cpp+++ b/src/plugins/intel_cpu/src/nodes/roi_align.cpp@@ -674,7 +674,7 @@ bool ROIAlign::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, s}ROIAlign::ROIAlign(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (isSupportedOperation(op, errorMessage)) {errorPrefix = "ROIPooling layer with name '" + getName() + "' ";diff --git a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cppindex e75bef1213d..fbe8127b9f2 100644--- a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp+++ b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp@@ -14,7 +14,7 @@ namespace intel_cpu {namespace node {ROIAlignRotated::ROIAlignRotated(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {const auto roiAlign = ov::as_type_ptr<const ov::opset15::ROIAlignRotated>(op);pooledH = roiAlign->get_pooled_h();pooledW = roiAlign->get_pooled_w();diff --git a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/roi_pooling.cppindex 7458457c7b5..816adb3ffa0 100644--- a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp+++ b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp@@ -388,7 +388,7 @@ bool ROIPooling::isSupportedOperation(const std::shared_ptr<const ov::Node>& op,}ROIPooling::ROIPooling(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/roll.cpp b/src/plugins/intel_cpu/src/nodes/roll.cppindex 6f75361c13c..7b17dff9746 100644--- a/src/plugins/intel_cpu/src/nodes/roll.cpp+++ b/src/plugins/intel_cpu/src/nodes/roll.cpp@@ -33,8 +33,8 @@ bool Roll::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::return true;}-Roll::Roll(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context) :- Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+Roll::Roll(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (isSupportedOperation(op, errorMessage)) {layerErrorPrefix = "Roll layer with name '" + getName() + "'";diff --git a/src/plugins/intel_cpu/src/nodes/rope.cpp b/src/plugins/intel_cpu/src/nodes/rope.cppindex 73a23c5e7cd..9144eaaae84 100644--- a/src/plugins/intel_cpu/src/nodes/rope.cpp+++ b/src/plugins/intel_cpu/src/nodes/rope.cpp@@ -22,7 +22,7 @@ namespace intel_cpu {namespace node {RoPE::RoPE(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW("CPU: " + errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp b/src/plugins/intel_cpu/src/nodes/scatter_update.cppindex 76c9acd218d..68376724612 100644--- a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp+++ b/src/plugins/intel_cpu/src/nodes/scatter_update.cpp@@ -58,11 +58,13 @@ bool ScatterUpdate::isExecutable() const {}ScatterUpdate::ScatterUpdate(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)),- dataSize(0lu), indicesSize(0lu), axisSize(0lu),- dataPrec(ov::element::undefined),- indicesPrec(ov::element::undefined),- axisPrec(ov::element::undefined) {+ : Node(op, context, NgraphShapeInferFactory(op)),+ dataSize(0lu),+ indicesSize(0lu),+ axisSize(0lu),+ dataPrec(ov::element::undefined),+ indicesPrec(ov::element::undefined),+ axisPrec(ov::element::undefined) {std::string errorMessage;if (isSupportedOperation(op, errorMessage)) {errorPrefix = std::string(op->get_type_name()) + " node with name '" + getName() + "'";diff --git a/src/plugins/intel_cpu/src/nodes/search_sorted.cpp b/src/plugins/intel_cpu/src/nodes/search_sorted.cppindex e8817765916..69e57398bd3 100644--- a/src/plugins/intel_cpu/src/nodes/search_sorted.cpp+++ b/src/plugins/intel_cpu/src/nodes/search_sorted.cpp@@ -11,7 +11,7 @@ namespace ov {namespace intel_cpu {namespace node {SearchSorted::SearchSorted(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cppindex dd45a639e98..974001a78c9 100644--- a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp+++ b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp@@ -67,7 +67,7 @@ bool ShuffleChannels::isSupportedOperation(const std::shared_ptr<const ov::Node>}ShuffleChannels::ShuffleChannels(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp b/src/plugins/intel_cpu/src/nodes/space_to_batch.cppindex f3da2510241..044200ba183 100644--- a/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp+++ b/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp@@ -25,7 +25,7 @@ bool SpaceToBatch::isSupportedOperation(const std::shared_ptr<const ov::Node>& o}SpaceToBatch::SpaceToBatch(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(1, 2, 3))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp b/src/plugins/intel_cpu/src/nodes/space_to_depth.cppindex 6753a9510bd..0fcb1900355 100644--- a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp+++ b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp@@ -73,7 +73,7 @@ bool SpaceToDepth::isSupportedOperation(const std::shared_ptr<const ov::Node>& o}SpaceToDepth::SpaceToDepth(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, EMPTY_PORT_MASK)) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/split.cpp b/src/plugins/intel_cpu/src/nodes/split.cppindex 72af54e619d..aca963536d8 100644--- a/src/plugins/intel_cpu/src/nodes/split.cpp+++ b/src/plugins/intel_cpu/src/nodes/split.cpp@@ -45,8 +45,8 @@ bool Split::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std:return true;}-Split::Split(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context) :- Node(op, context, NgraphShapeInferFactory(op, PortMask(1, 2))) {+Split::Split(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/stft.cpp b/src/plugins/intel_cpu/src/nodes/stft.cppindex d03bded6ad5..47855a7eff7 100644--- a/src/plugins/intel_cpu/src/nodes/stft.cpp+++ b/src/plugins/intel_cpu/src/nodes/stft.cpp@@ -26,7 +26,7 @@ bool STFT::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::}STFT::STFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(2, 3))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {THROW_CPU_NODE_ERR(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/string_tensor_pack.cpp b/src/plugins/intel_cpu/src/nodes/string_tensor_pack.cppindex 5ecb15b57fb..f8d6c2c78fe 100644--- a/src/plugins/intel_cpu/src/nodes/string_tensor_pack.cpp+++ b/src/plugins/intel_cpu/src/nodes/string_tensor_pack.cpp@@ -10,7 +10,7 @@ namespace ov {namespace intel_cpu {namespace node {StringTensorPack::StringTensorPack(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(0, 1))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/tile.cpp b/src/plugins/intel_cpu/src/nodes/tile.cppindex 447898e6390..1d197a9c1d6 100644--- a/src/plugins/intel_cpu/src/nodes/tile.cpp+++ b/src/plugins/intel_cpu/src/nodes/tile.cpp@@ -35,8 +35,8 @@ bool Tile::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::return true;}-Tile::Tile(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context) :- Node(op, context, NgraphShapeInferFactory(op, PortMask(TILE_REPEATS))) {+Tile::Tile(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);diff --git a/src/plugins/intel_cpu/src/nodes/topk.cpp b/src/plugins/intel_cpu/src/nodes/topk.cppindex 04602d5bfe6..1210fbe5ae8 100644--- a/src/plugins/intel_cpu/src/nodes/topk.cpp+++ b/src/plugins/intel_cpu/src/nodes/topk.cpp@@ -1823,7 +1823,7 @@ bool TopK::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::}TopK::TopK(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr context)- : Node(op, context, NgraphShapeInferFactory(op, PortMask(TOPK_K))) {+ : Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (isSupportedOperation(op, errorMessage)) {errorPrefix = "TopK layer with name '" + getName() + "'";diff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cppindex 8e2e794eacc..b99e1bc62c4 100644--- a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp@@ -214,13 +214,12 @@ public:ov::OutputVector new_inputs;for (size_t i = 0; i < op->get_input_size(); ++i) {if (auto t = tensor_accessor(i)) {- new_inputs.push_back(- std::make_shared<ov::opset1::Constant>(t));- } else if (dynamic_cast<ov::opset1::Constant*>(op->get_input_node_ptr(i))) {- new_inputs.push_back(op->get_input_node_ptr(i)->clone_with_new_inputs(ov::OutputVector{}));+ new_inputs.push_back(std::make_shared<ov::opset1::Constant>(t));+ } else if (auto c = ov::as_type<const op::v0::Constant>(op->get_input_node_ptr(i))) {+ new_inputs.push_back(c->clone_with_new_inputs(ov::OutputVector{}));} else {- new_inputs.push_back(std::make_shared<ov::opset1::Parameter>(op->get_input_element_type(i),- input_shapes[i].to_partial_shape()));+ new_inputs.push_back(std::make_shared<op::v0::Parameter>(op->get_input_element_type(i),+ input_shapes[i].to_partial_shape()));}}local_op = op->clone_with_new_inputs(new_inputs);@@ -461,7 +460,6 @@ const IStaticShapeInferFactory::TRegistry IStaticShapeInferFactory::registry{_OV_OP_SHAPE_INFER_VA_REG(opset7::Gather, ShapeInferTA, op::util::GatherBase, util::bit::mask(2)),// opset6_OV_OP_SHAPE_INFER_MASK_REG(opset6::CTCGreedyDecoderSeqLen, ShapeInferTA, util::bit::mask()),- _OV_OP_SHAPE_INFER_MASK_REG(opset6::CTCGreedyDecoderSeqLen, ShapeInferTA, util::bit::mask()),_OV_OP_SHAPE_INFER_MASK_REG(opset6::ExperimentalDetectronDetectionOutput, ShapeInferTA, util::bit::mask()),_OV_OP_SHAPE_INFER_MASK_REG(opset6::ExperimentalDetectronGenerateProposalsSingleImage, ShapeInferTA, util::bit::mask()),_OV_OP_SHAPE_INFER_MASK_REG(opset6::ExperimentalDetectronPriorGridGenerator, ShapeInferTA, util::bit::mask()),@@ -565,9 +563,6 @@ const IStaticShapeInferFactory::TRegistry IStaticShapeInferFactory::registry{_OV_OP_SHAPE_INFER_MASK_REG(opset1::Unsqueeze, ShapeInferTA, util::bit::mask(1)),_OV_OP_SHAPE_INFER_MASK_REG(opset1::VariadicSplit, ShapeInferTA, util::bit::mask(1, 2)),_OV_OP_SHAPE_INFER_NON_TEMPLATE_REG(opset1::BatchNormInference, ShapeInferBase),- _OV_OP_SHAPE_INFER_NON_TEMPLATE_REG(opset1::BatchNormInference, ShapeInferBase),- _OV_OP_SHAPE_INFER_NON_TEMPLATE_REG(opset1::Convert, ShapeInferCopy),- _OV_OP_SHAPE_INFER_NON_TEMPLATE_REG(opset1::Convert, ShapeInferCopy),_OV_OP_SHAPE_INFER_NON_TEMPLATE_REG(opset1::Convert, ShapeInferCopy),_OV_OP_SHAPE_INFER_NON_TEMPLATE_REG(opset1::HardSigmoid, ShapeInferBase),_OV_OP_SHAPE_INFER_NON_TEMPLATE_REG(opset1::LogicalNot, ShapeInferCopy),diff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference_cpu.cpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference_cpu.cppindex 2c6893ad1a3..3b759c21803 100644--- a/src/plugins/intel_cpu/src/shape_inference/shape_inference_cpu.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference_cpu.cpp@@ -4,10 +4,15 @@#include "shape_inference_ngraph.hpp"-using namespace ov::intel_cpu;+namespace ov {+namespace intel_cpu {+NgraphShapeInferFactory::NgraphShapeInferFactory(std::shared_ptr<ov::Node> op) : m_op(std::move(op)) {}ShapeInferPtr NgraphShapeInferFactory::makeShapeInfer() const {- return std::make_shared<NgraphShapeInfer>(make_shape_inference(m_op), m_port_mask);+ return std::make_shared<NgraphShapeInfer>(make_shape_inference(m_op));}const ov::CoordinateDiff ShapeInferEmptyPads::m_emptyVec = {};++} // namespace intel_cpu+} // namespace ovdiff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference_cpu.hpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference_cpu.hppindex 99af2bac163..661db2a739b 100644--- a/src/plugins/intel_cpu/src/shape_inference/shape_inference_cpu.hpp+++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference_cpu.hpp@@ -5,8 +5,9 @@#pragma once#include <cpu_memory.h>-#include <openvino/core/node.hpp>-#include <openvino/core/coordinate_diff.hpp>++#include "openvino/core/coordinate_diff.hpp"+#include "openvino/core/node.hpp"#include "shape_inference_status.hpp"namespace ov {@@ -98,14 +99,13 @@ public:* @brief Construct a new Ngraph Shape Infer Factory object** @param op ngraph operation- * @param port_mask port mask should be defined by the user. Will be stored in the shape infer object and returned- * by the get_port_mask() call*/- NgraphShapeInferFactory(std::shared_ptr<ov::Node> op, IShapeInfer::port_mask_t port_mask) : m_op(op), m_port_mask(port_mask) {}+ NgraphShapeInferFactory(std::shared_ptr<ov::Node> op);+ShapeInferPtr makeShapeInfer() const override;+private:std::shared_ptr<ov::Node> m_op;- IShapeInfer::port_mask_t m_port_mask;};} // namespace intel_cpu} // namespace ovdiff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference_ngraph.cpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference_ngraph.cppindex 3a4dcbdccce..897e28aad42 100644--- a/src/plugins/intel_cpu/src/shape_inference/shape_inference_ngraph.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference_ngraph.cpp@@ -9,6 +9,14 @@using namespace ov::intel_cpu;+NgraphShapeInfer::NgraphShapeInfer(std::shared_ptr<IStaticShapeInfer> shape_infer)+ : m_shape_infer(std::move(shape_infer)),+ m_port_mask(m_shape_infer->get_port_mask()) {}++NgraphShapeInfer::NgraphShapeInfer(std::shared_ptr<IStaticShapeInfer> shape_infer, IShapeInfer::port_mask_t port_mask)+ : m_shape_infer(std::move(shape_infer)),+ m_port_mask(port_mask) {}+IShapeInfer::ResultNgraphShapeInfer::infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,diff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference_ngraph.hpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference_ngraph.hppindex 01ba907b991..450d4e94055 100644--- a/src/plugins/intel_cpu/src/shape_inference/shape_inference_ngraph.hpp+++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference_ngraph.hpp@@ -11,14 +11,24 @@ namespace ov {namespace intel_cpu {/**- * This class wraps core specific shape inference class to implement CPU plugin specific interface.- *+ * @brief This class wraps core specific shape inference class to implement CPU plugin specific interface.*/class NgraphShapeInfer : public IShapeInfer {public:- NgraphShapeInfer(std::shared_ptr<IStaticShapeInfer> shape_infer, IShapeInfer::port_mask_t port_mask)- : m_shape_infer(shape_infer),- m_port_mask(port_mask) {}+ /**+ * @brief Wraps IStaticShapeInfer into IShapeInfer interface. Will use port mask defined in IStaticShapeInfer.+ *+ * @param shape_infer Instance of IStaticShapeInfer.+ */+ NgraphShapeInfer(std::shared_ptr<IStaticShapeInfer> shape_infer);++ /**+ * @brief Wraps IStaticShapeInfer into IShapeInfer interface. Will use port mask defined by user+ *+ * @param shape_infer Instance of IStaticShapeInfer.+ * @param port_mask Port mask define.+ */+ NgraphShapeInfer(std::shared_ptr<IStaticShapeInfer> shape_infer, IShapeInfer::port_mask_t port_mask);Result infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,@@ -34,6 +44,7 @@ public:port_mask_t get_port_mask() const override {return m_port_mask;}+private:std::shared_ptr<IStaticShapeInfer> m_shape_infer;IShapeInfer::port_mask_t m_port_mask;