From f723360e315b4ac83d46ce98ceda9b03df82e923 Mon Sep 17 00:00:00 2001 From: Maksim Kutakov Date: Tue, 6 Aug 2024 19:13:59 +0200 Subject: [PATCH] Remove isAllocated check from the memory class --- src/plugins/intel_cpu/src/cpu_memory.cpp | 36 ------------------- src/plugins/intel_cpu/src/cpu_memory.h | 19 +++++----- src/plugins/intel_cpu/src/node.cpp | 4 +-- src/plugins/intel_cpu/src/nodes/bucketize.cpp | 12 +++---- src/plugins/intel_cpu/src/nodes/concat.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/conv.cpp | 16 ++++----- src/plugins/intel_cpu/src/nodes/deconv.cpp | 20 +++++------ src/plugins/intel_cpu/src/nodes/def_conv.cpp | 20 +++++------ .../intel_cpu/src/nodes/depth_to_space.cpp | 8 ++--- .../src/nodes/extract_image_patches.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/eye.cpp | 4 +-- src/plugins/intel_cpu/src/nodes/gather.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/gather_nd.cpp | 12 +++---- .../intel_cpu/src/nodes/gather_tree.cpp | 16 ++++----- .../intel_cpu/src/nodes/grid_sample.cpp | 12 +++---- src/plugins/intel_cpu/src/nodes/grn.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/input.cpp | 8 ++--- .../intel_cpu/src/nodes/interpolate.cpp | 28 +++++++-------- src/plugins/intel_cpu/src/nodes/lrn.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/matmul.cpp | 12 +++---- src/plugins/intel_cpu/src/nodes/memory.cpp | 4 --- src/plugins/intel_cpu/src/nodes/mvn.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/normalize.cpp | 4 +-- src/plugins/intel_cpu/src/nodes/pad.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/pooling.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/reduce.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/reorder.cpp | 16 ++++----- .../intel_cpu/src/nodes/reverse_sequence.cpp | 12 +++---- src/plugins/intel_cpu/src/nodes/rnn.cpp | 2 +- src/plugins/intel_cpu/src/nodes/roi_align.cpp | 8 ++--- .../intel_cpu/src/nodes/roi_pooling.cpp | 12 +++---- src/plugins/intel_cpu/src/nodes/roll.cpp | 16 ++++----- .../intel_cpu/src/nodes/shuffle_channels.cpp | 8 ++--- .../intel_cpu/src/nodes/space_to_depth.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/split.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/topk.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/transpose.cpp | 8 ++--- src/plugins/intel_cpu/src/nodes/unique.cpp | 8 ++--- .../src/utils/debug_capabilities.cpp | 2 +- 39 files changed, 191 insertions(+), 232 deletions(-) diff --git a/src/plugins/intel_cpu/src/cpu_memory.cpp b/src/plugins/intel_cpu/src/cpu_memory.cpp index 8229c0b1605b42..2ae8da547c32f5 100644 --- a/src/plugins/intel_cpu/src/cpu_memory.cpp +++ b/src/plugins/intel_cpu/src/cpu_memory.cpp @@ -184,22 +184,6 @@ dnnl::memory Memory::DnnlMemPrimHandle::getPrim() const { return m_prim; } -bool Memory::isAllocated() const noexcept { - if (m_blockHandle->getRawPtr()) { - return true; - } - if (!m_pMemDesc) { - return false; - } - if (!(m_pMemDesc->isDefined())) { - return true; - } - if (m_pMemDesc->getCurrentMemSize() == 0) { - return true; - } - return false; -} - void* Memory::getData() const { void* data = getDataNoThrow(); if (data == nullptr && @@ -306,22 +290,6 @@ void StringMemory::nullify() { } } -bool StringMemory::isAllocated() const noexcept { - if (getData()) { - return true; - } - if (!m_mem_desc) { - return false; - } - if (!(m_mem_desc->isDefined())) { - return true; - } - if (m_mem_desc->getCurrentMemSize() == 0) { - return true; - } - return false; -} - size_t StringMemory::getSize() const { // In bytes auto size = getDesc().getCurrentMemSize(); if (size == MemoryDesc::UNDEFINED_SIZE) { @@ -461,10 +429,6 @@ StaticMemory::StaticMemory(const dnnl::engine& eng, MemoryDescPtr desc, const vo StaticMemory::StaticMemory(const dnnl::engine& eng, const MemoryDesc& desc, const void* data, bool pads_zeroing) : StaticMemory::StaticMemory(eng, desc.clone(), data, pads_zeroing) {} -bool StaticMemory::isAllocated() const noexcept { - return 0 == m_size || getData() != nullptr; -} - const MemoryDesc& StaticMemory::getDesc() const { return *m_pMemDesc; } diff --git a/src/plugins/intel_cpu/src/cpu_memory.h b/src/plugins/intel_cpu/src/cpu_memory.h index 65d61bc97a2693..4dfb3b700728fd 100644 --- a/src/plugins/intel_cpu/src/cpu_memory.h +++ b/src/plugins/intel_cpu/src/cpu_memory.h @@ -162,8 +162,6 @@ class IMemory { public: virtual ~IMemory() = default; - virtual bool isAllocated() const noexcept = 0; - virtual const MemoryDesc& getDesc() const = 0; virtual MemoryDescPtr getDescPtr() const = 0; @@ -191,6 +189,15 @@ class IMemory { virtual MemoryBlockPtr getMemoryBlock() const = 0; + virtual void nullify() = 0; + + bool isDefined() const noexcept { + if (auto desc = getDescPtr()) { + return desc->isDefined(); + } + return false; + } + //oneDNN specifics for backward compatibility virtual dnnl::memory getPrimitive() const = 0; @@ -202,8 +209,6 @@ class IMemory { return DnnlExtensionUtils::ElementTypeToDataType(getDesc().getPrecision()); } - virtual void nullify() = 0; - template ::value && !std::is_reference::value, int>::type = 0, typename std::enable_if::value, int>::type = 0> @@ -240,8 +245,6 @@ class StaticMemory final : public IMemory { StaticMemory(Memory&&) = delete; StaticMemory& operator= (StaticMemory&&) = delete; - bool isAllocated() const noexcept override; - const MemoryDesc& getDesc() const override; MemoryDescPtr getDescPtr() const override; @@ -287,8 +290,6 @@ class Memory : public IMemory { dnnl::memory getPrimitive() const override; - bool isAllocated() const noexcept override; - const MemoryDesc& getDesc() const override { return *m_pMemDesc; } @@ -393,8 +394,6 @@ class StringMemory : public IMemory { StringMemory(const dnnl::engine& engine, const MemoryDesc& desc, const StringMemoryBlockPtr& block) : StringMemory(engine, desc.clone(), block) {} - bool isAllocated() const noexcept override; - const MemoryDesc& getDesc() const override { return *m_mem_desc; } diff --git a/src/plugins/intel_cpu/src/node.cpp b/src/plugins/intel_cpu/src/node.cpp index 62c091c9985300..52f30e410a2942 100644 --- a/src/plugins/intel_cpu/src/node.cpp +++ b/src/plugins/intel_cpu/src/node.cpp @@ -1496,7 +1496,7 @@ bool Node::isInputTensorAtPortEmpty(size_t port) const { auto edge = getParentEdgeAt(port); if (one_of(edge->getStatus(), Edge::Status::Allocated, Edge::Status::Validated)) { auto&& mem = edge->getMemory(); - if (mem.isAllocated()) { + if (mem.isDefined()) { return mem.getShape().hasZeroDims(); } } @@ -1511,7 +1511,7 @@ bool Node::isOutputTensorAtPortEmpty(size_t port) const { return outputShapes[port].hasZeroDims(); } auto&& mem = getChildEdgeAt(port)->getMemory(); - if (mem.isAllocated()) { + if (mem.isDefined()) { return mem.getShape().hasZeroDims(); } return false; diff --git a/src/plugins/intel_cpu/src/nodes/bucketize.cpp b/src/plugins/intel_cpu/src/nodes/bucketize.cpp index 4d91bdbb8fac1d..a71255c0d531e4 100644 --- a/src/plugins/intel_cpu/src/nodes/bucketize.cpp +++ b/src/plugins/intel_cpu/src/nodes/bucketize.cpp @@ -189,12 +189,12 @@ void Bucketize::prepareParams() { auto inputTensorMemPtr = getSrcMemoryAtPort(INPUT_TENSOR_PORT); auto inputBinsMemPtr = getSrcMemoryAtPort(INPUT_BINS_PORT); auto dstMemPtr = getDstMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW("Destination memory didn't allocate."); - if (!inputTensorMemPtr || !inputTensorMemPtr->isAllocated()) - OPENVINO_THROW("Input tensor didn't allocate."); - if (!inputBinsMemPtr || !inputBinsMemPtr->isAllocated()) - OPENVINO_THROW("Input bins didn't allocate."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW("Destination memory is undefined."); + if (!inputTensorMemPtr || !inputTensorMemPtr->isDefined()) + OPENVINO_THROW("Input tensor is undefined."); + if (!inputBinsMemPtr || !inputBinsMemPtr->isDefined()) + OPENVINO_THROW("Input bins is undefined."); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW("Preferable primitive descriptor is not set."); diff --git a/src/plugins/intel_cpu/src/nodes/concat.cpp b/src/plugins/intel_cpu/src/nodes/concat.cpp index 216e2b135d6cff..6ca87ab31e6b37 100644 --- a/src/plugins/intel_cpu/src/nodes/concat.cpp +++ b/src/plugins/intel_cpu/src/nodes/concat.cpp @@ -328,8 +328,8 @@ void Concat::prepareParams() { return; const auto& dstMemPtr = getDstMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW("Destination memory didn't allocate."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW("Destination memory is undefined."); auto dstMemDesc = dstMemPtr->getDescWithType(); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW("Preferable primitive descriptor is not set."); @@ -375,9 +375,9 @@ void Concat::prepareParams() { nelemTotal = 0; for (size_t i = 0; i < getParentEdges().size(); i++) { const auto& srcMemPtr = getSrcMemoryAtPort(i); - if (!srcMemPtr || !srcMemPtr->isAllocated()) { + if (!srcMemPtr || !srcMemPtr->isDefined()) { auto parent = getParentEdgeAt(i)->getParent(); - OPENVINO_THROW("Source memory from ", parent->getName(), " didn't allocate for node ", getName(), "."); + OPENVINO_THROW("Source memory from ", parent->getName(), " is undefined for node ", getName(), "."); } if (canExecRef) { diff --git a/src/plugins/intel_cpu/src/nodes/conv.cpp b/src/plugins/intel_cpu/src/nodes/conv.cpp index 60c59ea13708bb..cbdb35db271622 100644 --- a/src/plugins/intel_cpu/src/nodes/conv.cpp +++ b/src/plugins/intel_cpu/src/nodes/conv.cpp @@ -1233,17 +1233,17 @@ void Convolution::prepareParams() { auto srcMemPtr = getSrcMemoryAtPort(0); auto wghMemPtr = getSrcMemoryAtPort(1); auto dstMemPtr = getOutputMemory(); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW("Destination memory was not allocated."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW("Input memory was not allocated."); - if (!wghMemPtr || !wghMemPtr->isAllocated()) - OPENVINO_THROW("Weight memory was not allocated."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW("Destination memory was undefined."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW("Input memory was undefined."); + if (!wghMemPtr || !wghMemPtr->isDefined()) + OPENVINO_THROW("Weight memory was undefined."); MemoryPtr biasMemPtr = nullptr; if (withBiases) { biasMemPtr = getSrcMemoryAtPort(2); - if (!biasMemPtr || !biasMemPtr->isAllocated()) - OPENVINO_THROW("Input memory didn't allocate."); + if (!biasMemPtr || !biasMemPtr->isDefined()) + OPENVINO_THROW("Input memory is undefined."); } const NodeDesc *selected_pd = getSelectedPrimitiveDescriptor(); diff --git a/src/plugins/intel_cpu/src/nodes/deconv.cpp b/src/plugins/intel_cpu/src/nodes/deconv.cpp index 499f172eca3645..57046a0a06d55b 100644 --- a/src/plugins/intel_cpu/src/nodes/deconv.cpp +++ b/src/plugins/intel_cpu/src/nodes/deconv.cpp @@ -812,12 +812,12 @@ void Deconvolution::prepareParams() { auto srcMemPtr = getSrcMemoryAtPort(0); auto wghMemPtr = getSrcMemoryAtPort(1); auto dstMemPtr = getDstMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW("Destination memory has not been allocated."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW("Input memory has not been allocated."); - if (!wghMemPtr || !wghMemPtr->isAllocated()) - OPENVINO_THROW("Weight memory has not been allocated."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW("Destination memory is undefined."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW("Input memory is undefined."); + if (!wghMemPtr || !wghMemPtr->isDefined()) + OPENVINO_THROW("Weight memory is undefined."); auto selected_pd = getSelectedPrimitiveDescriptor(); if (selected_pd == nullptr) OPENVINO_THROW("Preferable primitive descriptor is not set for node ", getName(), "."); @@ -869,8 +869,8 @@ void Deconvolution::prepareParams() { if (withBiases) { biasMemPtr = getSrcMemoryAtPort(biasPort); - if (!biasMemPtr || !biasMemPtr->isAllocated()) - OPENVINO_THROW("Bias memory memory didn't allocate."); + if (!biasMemPtr || !biasMemPtr->isDefined()) + OPENVINO_THROW("Bias memory memory is undefined."); biasDesc = biasMemPtr->getDescWithType(); } bool is1x1PaddingAsymmetric = false; @@ -1094,8 +1094,8 @@ std::vector Deconvolution::readOutputSpatialDims() const { OPENVINO_THROW("Can't get output spatial dims. Inputs number = ", getParentEdges().size()); } const auto &shapeMemPtr = getSrcMemoryAtPort(2); - if (!shapeMemPtr || !shapeMemPtr->isAllocated()) { - OPENVINO_THROW("'output_shape' input memory is not allocated."); + if (!shapeMemPtr || !shapeMemPtr->isDefined()) { + OPENVINO_THROW("'output_shape' input memory is undefined."); } const auto spDimsNum = getInputShapeAtPort(0).getRank() - 2; if (shapeMemPtr->getStaticDims()[0] != spDimsNum) { diff --git a/src/plugins/intel_cpu/src/nodes/def_conv.cpp b/src/plugins/intel_cpu/src/nodes/def_conv.cpp index 97fe2a2b2da08b..eb56902c653e99 100644 --- a/src/plugins/intel_cpu/src/nodes/def_conv.cpp +++ b/src/plugins/intel_cpu/src/nodes/def_conv.cpp @@ -1184,19 +1184,19 @@ void DeformableConvolution::prepareParams() { auto offMemPtr = getSrcMemoryAtPort(OFF_ID); auto weiMemPtr = getSrcMemoryAtPort(WEI_ID); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate destination memory"); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate input memory"); - if (!offMemPtr || !offMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate offsets shape memory"); - if (!weiMemPtr || !weiMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate weights memory"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined destination memory"); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory"); + if (!offMemPtr || !offMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined offsets shape memory"); + if (!weiMemPtr || !weiMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined weights memory"); if (getOriginalInputsNumber() > 3) { auto modMemPtr = getSrcMemoryAtPort(MOD_ID); - if (!modMemPtr || !modMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate modulations memory"); + if (!modMemPtr || !modMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined modulations memory"); } auto selectedPrimitiveDescriptor = getSelectedPrimitiveDescriptor(); diff --git a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp index bc374a236c78fd..5a0e321dfec7f5 100644 --- a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp +++ b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp @@ -162,10 +162,10 @@ void DepthToSpace::initSupportedPrimitiveDescriptors() { void DepthToSpace::createPrimitive() { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - THROW_ERROR("has not allocated destination memory"); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - THROW_ERROR("has not allocated input memory"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + THROW_ERROR("has undefined destination memory"); + if (!srcMemPtr || !srcMemPtr->isDefined()) + THROW_ERROR("has undefined input memory"); if (getSelectedPrimitiveDescriptor() == nullptr) THROW_ERROR("has unidentified preferable primitive descriptor"); diff --git a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp index 185ff6bfd216d5..7c3dda49931451 100644 --- a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp +++ b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp @@ -372,10 +372,10 @@ ExtractImagePatches::ExtractImagePatches(const std::shared_ptr& op, co void ExtractImagePatches::prepareParams() { const auto& srcMemPtr0 = getSrcMemoryAtPort(0); const auto& dstMemPtr = getDstMemoryAtPort(0); - if (!srcMemPtr0 || !srcMemPtr0->isAllocated()) - OPENVINO_THROW("Input memory has not been allocated."); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW("Destination memory has not been allocated."); + if (!srcMemPtr0 || !srcMemPtr0->isDefined()) + OPENVINO_THROW("Input memory is undefined."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW("Destination memory is undefined."); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW("Preferable primitive descriptor is not set."); diff --git a/src/plugins/intel_cpu/src/nodes/eye.cpp b/src/plugins/intel_cpu/src/nodes/eye.cpp index f32f67279b75d0..f1e78b04510914 100644 --- a/src/plugins/intel_cpu/src/nodes/eye.cpp +++ b/src/plugins/intel_cpu/src/nodes/eye.cpp @@ -104,8 +104,8 @@ void Eye::executeSpecified() { const size_t colNum = getColNum(); const int64_t shift = getDiagIndex(); auto outPtr = getDstMemoryAtPort(0); - if (!outPtr || !outPtr ->isAllocated()) - THROW_ERROR(errorPrefix, "Destination memory didn't allocate."); + if (!outPtr || !outPtr ->isDefined()) + THROW_ERROR(errorPrefix, "Destination memory is undefined."); T *dst = outPtr->getDataAs(); const size_t batchVolume = getBatchVolume(getBatchShape()); diff --git a/src/plugins/intel_cpu/src/nodes/gather.cpp b/src/plugins/intel_cpu/src/nodes/gather.cpp index 799ec3d480028b..94debfba1901ab 100644 --- a/src/plugins/intel_cpu/src/nodes/gather.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather.cpp @@ -338,11 +338,11 @@ bool Gather::needPrepareParams() const { void Gather::prepareParams() { auto dataMemPtr = getSrcMemoryAtPort(GATHER_DATA); - if (!dataMemPtr || !dataMemPtr->isAllocated()) - THROW_ERROR(" has not allocated input data memory."); + if (!dataMemPtr || !dataMemPtr->isDefined()) + THROW_ERROR(" has undefined input data memory."); auto idxMemPtr = getSrcMemoryAtPort(GATHER_INDICES); - if (!idxMemPtr || !idxMemPtr->isAllocated()) - THROW_ERROR(" has not allocated input indices memory."); + if (!idxMemPtr || !idxMemPtr->isDefined()) + THROW_ERROR(" has undefined input indices memory."); if (getSelectedPrimitiveDescriptor() == nullptr) THROW_ERROR(" has unidentified preferable primitive descriptor."); diff --git a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp index 86723215a35ad3..2dc91dd12559f2 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp @@ -84,12 +84,12 @@ void GatherND::prepareParams() { auto srcMemPtr = getSrcMemoryAtPort(GATHERND_DATA); auto idxMemPtr = getSrcMemoryAtPort(GATHERND_INDEXES); auto dstMemPtr = getDstMemoryAtPort(0); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - THROW_ERROR(" has not allocated input memory of 'data'."); - if (!idxMemPtr || !idxMemPtr->isAllocated()) - THROW_ERROR(" has not allocated input memory of 'indices'."); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - THROW_ERROR(" has not allocated output memory."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + THROW_ERROR(" has undefined input memory of 'data'."); + if (!idxMemPtr || !idxMemPtr->isDefined()) + THROW_ERROR(" has undefined input memory of 'indices'."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + THROW_ERROR(" has undefined output memory."); if (getSelectedPrimitiveDescriptor() == nullptr) THROW_ERROR(" has unidentified preferable primitive descriptor."); diff --git a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp index 8a14220b165f69..f318290defbf82 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp @@ -98,14 +98,14 @@ void GatherTree::prepareParams() { const auto& maxSeqLenMemPtr = getSrcMemoryAtPort(GATHER_TREE_MAX_SEQ_LEN); const auto& dstMemPtr = getDstMemoryAtPort(0); - if (!stepIdxMemPtr || !stepIdxMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated input memory of 'step_ids'."); - if (!parentIdxMemPtr || !parentIdxMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated input memory of 'parent_ids'."); - if (!maxSeqLenMemPtr || !maxSeqLenMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated input memory of 'max_seq_len'."); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated output memory."); + if (!stepIdxMemPtr || !stepIdxMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory of 'step_ids'."); + if (!parentIdxMemPtr || !parentIdxMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory of 'parent_ids'."); + if (!maxSeqLenMemPtr || !maxSeqLenMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory of 'max_seq_len'."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined output memory."); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW(errorPrefix, " has unidentified preferable primitive descriptor."); diff --git a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp index eb143a1ad55199..618d6b39105689 100644 --- a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp +++ b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp @@ -182,14 +182,14 @@ void GridSample::createPrimitive() { void GridSample::prepareParams() { auto dataMemPtr = getSrcMemoryAtPort(IN_DATA); - if (!dataMemPtr || !dataMemPtr->isAllocated()) - THROW_CPU_NODE_ERR("has not allocated input data memory."); + if (!dataMemPtr || !dataMemPtr->isDefined()) + THROW_CPU_NODE_ERR("has undefined input data memory."); auto gridMemPtr = getSrcMemoryAtPort(IN_GRID); - if (!gridMemPtr || !gridMemPtr->isAllocated()) - THROW_CPU_NODE_ERR("has not allocated input grid memory."); + if (!gridMemPtr || !gridMemPtr->isDefined()) + THROW_CPU_NODE_ERR("has undefined input grid memory."); auto dstMemPtr = getDstMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - THROW_CPU_NODE_ERR("has not allocated output memory."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + THROW_CPU_NODE_ERR("has undefined output memory."); if (getSelectedPrimitiveDescriptor() == nullptr) THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor."); diff --git a/src/plugins/intel_cpu/src/nodes/grn.cpp b/src/plugins/intel_cpu/src/nodes/grn.cpp index 83e554acf8b255..f20e7d6b90a012 100644 --- a/src/plugins/intel_cpu/src/nodes/grn.cpp +++ b/src/plugins/intel_cpu/src/nodes/grn.cpp @@ -61,10 +61,10 @@ void GRN::prepareParams() { const auto& dataMemPtr = getSrcMemoryAtPort(0); const auto& dstMemPtr = getDstMemoryAtPort(0); - if (!dataMemPtr || !dataMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated input memory"); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated output memory"); + if (!dataMemPtr || !dataMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined output memory"); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW(errorPrefix, " has unidentified preferable primitive descriptor"); diff --git a/src/plugins/intel_cpu/src/nodes/input.cpp b/src/plugins/intel_cpu/src/nodes/input.cpp index 72a22132aba175..c3521b8481f832 100644 --- a/src/plugins/intel_cpu/src/nodes/input.cpp +++ b/src/plugins/intel_cpu/src/nodes/input.cpp @@ -473,14 +473,14 @@ void Input::initSupportedPrimitiveDescriptors() { void Input::createPrimitive() { for (size_t i = 0; i < getChildEdges().size(); i++) { auto dstMemPtr = getDstMemoryAtPort(i); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - THROW_CPU_NODE_ERR("has unallocated memory object at port ", i, + if (!dstMemPtr || !dstMemPtr->isDefined()) + THROW_CPU_NODE_ERR("has undefined memory object at port ", i, " to node ", getChildEdgeAt(i)->getChild()->getName(), "."); } for (size_t i = 0; i < getParentEdges().size(); i++) { auto srcMemPtr = getSrcMemoryAtPort(i); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - THROW_CPU_NODE_ERR("has unallocated memory object at port ", i, + if (!srcMemPtr || !srcMemPtr->isDefined()) + THROW_CPU_NODE_ERR("has undefined memory object at port ", i, " from node ", getParentEdgeAt(i)->getParent()->getName(), "."); } diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/interpolate.cpp index b883674606e362..50108288d6644a 100644 --- a/src/plugins/intel_cpu/src/nodes/interpolate.cpp +++ b/src/plugins/intel_cpu/src/nodes/interpolate.cpp @@ -2249,27 +2249,27 @@ void Interpolate::prepareParams() { } auto dstMemPtr = getDstMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate destination memory"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined destination memory"); auto srcMemPtr = getSrcMemoryAtPort(DATA_ID); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate input memory"); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory"); if (shapeCalcMode == InterpolateShapeCalcMode::sizes) { auto tsMemPtr = getSrcMemoryAtPort(TARGET_SHAPE_ID); - if (!tsMemPtr || !tsMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate target shape memory"); + if (!tsMemPtr || !tsMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined target shape memory"); } else { auto scaleMemPtr = getSrcMemoryAtPort(get_scale_id()); - if (!scaleMemPtr || !scaleMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate scales memory"); + if (!scaleMemPtr || !scaleMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined scales memory"); } if (isAxesSpecified) { auto axesMemPtr = getSrcMemoryAtPort(get_axis_id()); - if (!axesMemPtr || !axesMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate axes memory"); + if (!axesMemPtr || !axesMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined axes memory"); } const NodeDesc *selected_pd = getSelectedPrimitiveDescriptor(); @@ -2365,10 +2365,10 @@ void Interpolate::prepareParams() { void Interpolate::createPrimitive() { auto srcMemPtr = getSrcMemoryAtPort(DATA_ID); auto dstMemPtr = getDstMemoryAtPort(0); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate input memory"); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate destination memory"); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined destination memory"); if (dstMemPtr->getDesc().hasLayoutType(LayoutType::ncsp)) { interpAttrs.layout = InterpolateLayoutType::planar; diff --git a/src/plugins/intel_cpu/src/nodes/lrn.cpp b/src/plugins/intel_cpu/src/nodes/lrn.cpp index 3f8a83d36e36fe..a26b58798b0dbd 100644 --- a/src/plugins/intel_cpu/src/nodes/lrn.cpp +++ b/src/plugins/intel_cpu/src/nodes/lrn.cpp @@ -163,10 +163,10 @@ std::shared_ptr Lrn::getSrcMemDesc(const dnnl::primitive_desc &prim_ void Lrn::prepareParams() { auto srcMemPtr = getSrcMemoryAtPort(0); auto dstMemPtr = getDstMemoryAtPort(0); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " input memory did not allocate"); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, "destination memory did not allocate"); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " input memory is undefined"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, "destination memory is undefined"); const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor(); if (selected_pd == nullptr) diff --git a/src/plugins/intel_cpu/src/nodes/matmul.cpp b/src/plugins/intel_cpu/src/nodes/matmul.cpp index 2841e6f100afb7..50cb3353612996 100644 --- a/src/plugins/intel_cpu/src/nodes/matmul.cpp +++ b/src/plugins/intel_cpu/src/nodes/matmul.cpp @@ -538,10 +538,10 @@ void MatMul::prepareParams() { auto dstMemPtr = getDstMemoryAtPort(0); auto src0MemPtr = getSrcMemoryAtPort(0); auto src1MemPtr = getSrcMemoryAtPort(1); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate destination memory"); - if (!src0MemPtr || !src0MemPtr->isAllocated() || !src1MemPtr || !src1MemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate input memory"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined destination memory"); + if (!src0MemPtr || !src0MemPtr->isDefined() || !src1MemPtr || !src1MemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory"); const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor(); if (selected_pd == nullptr) @@ -576,8 +576,8 @@ void MatMul::prepareParams() { DnnlMemoryDescPtr dnnlBiasMemDesc = nullptr; if (withBiases) { auto biasMemory = getSrcMemoryAtPort(2); - if (!biasMemory || !biasMemory->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate bias memory"); + if (!biasMemory || !biasMemory->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined bias memory"); dnnlBiasMemDesc = biasMemory->getDescWithType(); } diff --git a/src/plugins/intel_cpu/src/nodes/memory.cpp b/src/plugins/intel_cpu/src/nodes/memory.cpp index 9e70720e50146d..037221dc31a3ae 100644 --- a/src/plugins/intel_cpu/src/nodes/memory.cpp +++ b/src/plugins/intel_cpu/src/nodes/memory.cpp @@ -23,10 +23,6 @@ class MemoryStub : public IMemory { public: MemoryStub(const dnnl::engine& eng, const MemoryDescPtr& pMemDesc) : m_eng(eng), m_pMemDesc(pMemDesc) {} - bool isAllocated() const noexcept override { - return true; - } - const MemoryDesc& getDesc() const override { return *m_pMemDesc; } diff --git a/src/plugins/intel_cpu/src/nodes/mvn.cpp b/src/plugins/intel_cpu/src/nodes/mvn.cpp index e8d99c7947fcfc..cc6054a6e7717a 100644 --- a/src/plugins/intel_cpu/src/nodes/mvn.cpp +++ b/src/plugins/intel_cpu/src/nodes/mvn.cpp @@ -2017,10 +2017,10 @@ void MVN::MVNRefExecutor::exec(const uint8_t *src_data, uint8_t *dst_data, const void MVN::prepareParams() { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW("Destination memory didn't allocate."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW("Input memory didn't allocate."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW("Destination memory is undefined."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW("Input memory is undefined."); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW("Preferable primitive descriptor is not set."); diff --git a/src/plugins/intel_cpu/src/nodes/normalize.cpp b/src/plugins/intel_cpu/src/nodes/normalize.cpp index 0f61e7c717d4bc..65cfeb827b2986 100644 --- a/src/plugins/intel_cpu/src/nodes/normalize.cpp +++ b/src/plugins/intel_cpu/src/nodes/normalize.cpp @@ -884,9 +884,9 @@ void NormalizeL2::setPostOps(dnnl::primitive_attr& kernel_attrs, const VectorDim void NormalizeL2::createPrimitive() { auto dstMemPtr = getDstMemoryAtPort(DATA); auto srcMemPtr = getSrcMemoryAtPort(DATA); - if (!dstMemPtr || !dstMemPtr->isAllocated()) + if (!dstMemPtr || !dstMemPtr->isDefined()) THROW_ERROR("can't get destination memory"); - if (!srcMemPtr || !srcMemPtr->isAllocated()) + if (!srcMemPtr || !srcMemPtr->isDefined()) THROW_ERROR("can't get input memory"); if (getSelectedPrimitiveDescriptor() == nullptr) THROW_ERROR("has nullable preferable primitive descriptor"); diff --git a/src/plugins/intel_cpu/src/nodes/pad.cpp b/src/plugins/intel_cpu/src/nodes/pad.cpp index dbc31f0f112738..bd38f521be5167 100644 --- a/src/plugins/intel_cpu/src/nodes/pad.cpp +++ b/src/plugins/intel_cpu/src/nodes/pad.cpp @@ -217,10 +217,10 @@ void Pad::PadExecutor::paramsInitialization(const PadAttrs& attrs, params.attrs = attrs; auto& srcMemPtr = srcMemory[DATA_ID]; auto& dstMemPtr = dstMemory[DATA_ID]; - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, "has not allocated source memory."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, "has not allocated destination memory."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, "has undefined source memory."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, "has undefined destination memory."); const auto srcBlockMemDesc = srcMemPtr->getDescWithType(); const auto dstBlockMemDesc = dstMemPtr->getDescWithType(); const auto& srcDims = srcBlockMemDesc->getBlockDims(); diff --git a/src/plugins/intel_cpu/src/nodes/pooling.cpp b/src/plugins/intel_cpu/src/nodes/pooling.cpp index 299ba4d15f4b6a..71e5c38f0e0a79 100644 --- a/src/plugins/intel_cpu/src/nodes/pooling.cpp +++ b/src/plugins/intel_cpu/src/nodes/pooling.cpp @@ -394,10 +394,10 @@ void Pooling::prepareParams() { if (useACL) { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW("Destination memory didn't allocate."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW("Input memory didn't allocate."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW("Destination memory is undefined."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW("Input memory is undefined."); std::vector srcMemoryDescs; for (size_t i = 0; i < getOriginalInputsNumber(); i++) { diff --git a/src/plugins/intel_cpu/src/nodes/reduce.cpp b/src/plugins/intel_cpu/src/nodes/reduce.cpp index ca474073dd34f6..a77790d7a14954 100644 --- a/src/plugins/intel_cpu/src/nodes/reduce.cpp +++ b/src/plugins/intel_cpu/src/nodes/reduce.cpp @@ -2172,10 +2172,10 @@ void Reduce::createPrimitive() { } auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(REDUCE_DATA); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated destination memory."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocate input memory."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined destination memory."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory."); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW(errorPrefix, " has nullable preferable primitive descriptor"); diff --git a/src/plugins/intel_cpu/src/nodes/reorder.cpp b/src/plugins/intel_cpu/src/nodes/reorder.cpp index c868792574cc81..8a18b648a991dc 100644 --- a/src/plugins/intel_cpu/src/nodes/reorder.cpp +++ b/src/plugins/intel_cpu/src/nodes/reorder.cpp @@ -184,10 +184,10 @@ void Reorder::prepareParams() { auto srcMemPtr = getSrcMemoryAtPort(0); auto dstMemPtr = getDstMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - THROW_CPU_NODE_ERR("has unallocated destination memory object."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - THROW_CPU_NODE_ERR("has unallocated input memory object."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + THROW_CPU_NODE_ERR("has undefined destination memory object."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + THROW_CPU_NODE_ERR("has undefined input memory object."); if (getSelectedPrimitiveDescriptor() == nullptr) THROW_CPU_NODE_ERR("does not have preferable primitive descriptor."); @@ -243,10 +243,10 @@ void Reorder::prepareParams() { } } if (!canUseNcsp2Nspc && !canUseNspc2Ncsp) { - if (!dstMemPtr || !dstMemPtr->isAllocated()) - THROW_CPU_NODE_ERR("has unallocated destination memory object."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - THROW_CPU_NODE_ERR("has unallocated input memory object."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + THROW_CPU_NODE_ERR("has undefined destination memory object."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + THROW_CPU_NODE_ERR("has undefined input memory object."); if (getSelectedPrimitiveDescriptor() == nullptr) THROW_CPU_NODE_ERR("does not have preferable primitive descriptor."); diff --git a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp index 8c637a3896fd91..b51eab4bef393e 100644 --- a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp +++ b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp @@ -84,12 +84,12 @@ void ReverseSequence::prepareParams() { const auto& seqLengthsMemPtr = getSrcMemoryAtPort(REVERSESEQUENCE_LENGTHS); const auto& dstMemPtr = getDstMemoryAtPort(0); - if (!dataMemPtr || !dataMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated input memory of 'data'"); - if (!seqLengthsMemPtr || !seqLengthsMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated input memory of 'seq_lengths'"); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated output memory"); + if (!dataMemPtr || !dataMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory of 'data'"); + if (!seqLengthsMemPtr || !seqLengthsMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory of 'seq_lengths'"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined output memory"); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW(errorPrefix, " has unidentified preferable primitive descriptor"); diff --git a/src/plugins/intel_cpu/src/nodes/rnn.cpp b/src/plugins/intel_cpu/src/nodes/rnn.cpp index 7b0e46ce8e5ce7..a29df47968038a 100644 --- a/src/plugins/intel_cpu/src/nodes/rnn.cpp +++ b/src/plugins/intel_cpu/src/nodes/rnn.cpp @@ -1119,7 +1119,7 @@ Node::AttrPtr RNN::initPrimitiveAttr() { void RNN::prepareParams() { for (size_t i = 0; i < wIdx; i++) { auto memPtr = getSrcMemoryAtPort(i); - if (!memPtr || !memPtr->isAllocated()) + if (!memPtr || !memPtr->isDefined()) THROW_ERROR("has uninitialized memory at port ", i); } if ((is_cell && DC != getParentEdgeAt(0)->getMemory().getDesc().getShape().getStaticDims()[1]) || diff --git a/src/plugins/intel_cpu/src/nodes/roi_align.cpp b/src/plugins/intel_cpu/src/nodes/roi_align.cpp index 61bedf62811fa4..de28d5aff4e399 100644 --- a/src/plugins/intel_cpu/src/nodes/roi_align.cpp +++ b/src/plugins/intel_cpu/src/nodes/roi_align.cpp @@ -816,10 +816,10 @@ void ROIAlign::initSupportedPrimitiveDescriptors() { void ROIAlign::createPrimitive() { auto srcMemPtr = getSrcMemoryAtPort(0); auto dstMemPtr = getDstMemoryAtPort(0); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate input memory"); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " did not allocate destination memory"); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined destination memory"); if (!roi_align_kernel) { ROIAlignLayoutType selectedLayout = ROIAlignLayoutType::nspc; diff --git a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp index f1a4291f0803a3..6a0e8c6c4569d0 100644 --- a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp +++ b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp @@ -501,12 +501,12 @@ void ROIPooling::prepareParams() { const auto& srcMemPtr0 = getSrcMemoryAtPort(0); const auto& srcMemPtr1 = getSrcMemoryAtPort(0); const auto& dstMemPtr = getDstMemoryAtPort(0); - if (!srcMemPtr0 || !srcMemPtr0->isAllocated()) - OPENVINO_THROW("Input memory has not been allocated."); - if (!srcMemPtr1 || !srcMemPtr1->isAllocated()) - OPENVINO_THROW("Input memory has not been allocated."); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW("Destination has not been allocated."); + if (!srcMemPtr0 || !srcMemPtr0->isDefined()) + OPENVINO_THROW("Input memory is undefined."); + if (!srcMemPtr1 || !srcMemPtr1->isDefined()) + OPENVINO_THROW("Input memory is undefined."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW("Destination is undefined."); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW("Preferable primitive descriptor is not set."); diff --git a/src/plugins/intel_cpu/src/nodes/roll.cpp b/src/plugins/intel_cpu/src/nodes/roll.cpp index 6f6ad7edc20d65..6f75361c13c37f 100644 --- a/src/plugins/intel_cpu/src/nodes/roll.cpp +++ b/src/plugins/intel_cpu/src/nodes/roll.cpp @@ -102,14 +102,14 @@ void Roll::prepareParams() { const auto& axesMemPtr = getSrcMemoryAtPort(AXES_INDEX); const auto& dstMemPtr = getDstMemoryAtPort(0); - if (!dataMemPtr || !dataMemPtr->isAllocated()) - OPENVINO_THROW(layerErrorPrefix, " has not allocated input memory of 'data'"); - if (!shiftMemPtr || !shiftMemPtr->isAllocated()) - OPENVINO_THROW(layerErrorPrefix, " has not allocated input memory of 'shift'"); - if (!axesMemPtr || !axesMemPtr->isAllocated()) - OPENVINO_THROW(layerErrorPrefix, " has not allocated input memory of 'axes'"); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(layerErrorPrefix, " has not allocated output memory"); + if (!dataMemPtr || !dataMemPtr->isDefined()) + OPENVINO_THROW(layerErrorPrefix, " has undefined input memory of 'data'"); + if (!shiftMemPtr || !shiftMemPtr->isDefined()) + OPENVINO_THROW(layerErrorPrefix, " has undefined input memory of 'shift'"); + if (!axesMemPtr || !axesMemPtr->isDefined()) + OPENVINO_THROW(layerErrorPrefix, " has undefined input memory of 'axes'"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(layerErrorPrefix, " has undefined output memory"); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW(layerErrorPrefix, " has unidentified preferable primitive descriptor"); diff --git a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp index 72ecca666c30dd..ecbf8ceb0dc145 100644 --- a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp +++ b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp @@ -128,10 +128,10 @@ void ShuffleChannels::initSupportedPrimitiveDescriptors() { void ShuffleChannels::createPrimitive() { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - THROW_SHCH_ERROR("has not allocated destination memory"); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - THROW_SHCH_ERROR("has not allocated input memory"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + THROW_SHCH_ERROR("has undefined destination memory"); + if (!srcMemPtr || !srcMemPtr->isDefined()) + THROW_SHCH_ERROR("has undefined input memory"); if (getSelectedPrimitiveDescriptor() == nullptr) THROW_SHCH_ERROR("has unidentified preferable primitive descriptor"); diff --git a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp index 40d344ec64cb07..adfdbf2f7d0f23 100644 --- a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp +++ b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp @@ -166,10 +166,10 @@ void SpaceToDepth::initSupportedPrimitiveDescriptors() { void SpaceToDepth::createPrimitive() { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(0); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - THROW_ERROR("has not allocated destination memory"); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - THROW_ERROR("has not allocated input memory"); + if (!dstMemPtr || !dstMemPtr->isDefined()) + THROW_ERROR("has undefined destination memory"); + if (!srcMemPtr || !srcMemPtr->isDefined()) + THROW_ERROR("has undefined input memory"); if (getSelectedPrimitiveDescriptor() == nullptr) THROW_ERROR("has unidentified preferable primitive descriptor"); diff --git a/src/plugins/intel_cpu/src/nodes/split.cpp b/src/plugins/intel_cpu/src/nodes/split.cpp index ad869bd40e03cb..c2ea305d9cdc4a 100644 --- a/src/plugins/intel_cpu/src/nodes/split.cpp +++ b/src/plugins/intel_cpu/src/nodes/split.cpp @@ -234,8 +234,8 @@ bool Split::needPrepareParams() const { void Split::prepareParams() { const auto &srcMemPtr = getSrcMemoryAtPort(0); - if (!srcMemPtr || !srcMemPtr->isAllocated()) { - THROW_ERROR("has not allocated input memory"); + if (!srcMemPtr || !srcMemPtr->isDefined()) { + THROW_ERROR("has undefined input memory"); } if (!constSplitLengths) { @@ -249,8 +249,8 @@ void Split::prepareParams() { std::vector outDescs; for (size_t port = 0; port < outputShapes.size(); ++port) { const auto &outMemPtr = this->getDstMemoryAtPort(port); - if (!outMemPtr || !outMemPtr->isAllocated()) { - THROW_ERROR("has not allocated destination memory"); + if (!outMemPtr || !outMemPtr->isDefined()) { + THROW_ERROR("has undefined destination memory"); } if (outMemPtr->getShape().hasZeroDims()) { diff --git a/src/plugins/intel_cpu/src/nodes/topk.cpp b/src/plugins/intel_cpu/src/nodes/topk.cpp index be8ac05d85b3e6..f01fded788f495 100644 --- a/src/plugins/intel_cpu/src/nodes/topk.cpp +++ b/src/plugins/intel_cpu/src/nodes/topk.cpp @@ -1980,10 +1980,10 @@ void TopK::preset_params() { void TopK::prepareParams() { auto dstMemPtr = getDstMemoryAtPort(TOPK_DATA); auto srcMemPtr = getSrcMemoryAtPort(TOPK_DATA); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocated destination memory."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW(errorPrefix, " has not allocate input memory."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined destination memory."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW(errorPrefix, " has undefined input memory."); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW(errorPrefix, " has nullable preferable primitive descriptor"); diff --git a/src/plugins/intel_cpu/src/nodes/transpose.cpp b/src/plugins/intel_cpu/src/nodes/transpose.cpp index 9a958be2ead5e4..f8eebe8990528d 100644 --- a/src/plugins/intel_cpu/src/nodes/transpose.cpp +++ b/src/plugins/intel_cpu/src/nodes/transpose.cpp @@ -200,10 +200,10 @@ void Transpose::createPrimitive() { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(INPUT_DATA_IDX); - if (!dstMemPtr || !dstMemPtr->isAllocated()) - OPENVINO_THROW("Destination memory was not allocated."); - if (!srcMemPtr || !srcMemPtr->isAllocated()) - OPENVINO_THROW("Input memory was not allocated."); + if (!dstMemPtr || !dstMemPtr->isDefined()) + OPENVINO_THROW("Destination memory was undefined."); + if (!srcMemPtr || !srcMemPtr->isDefined()) + OPENVINO_THROW("Input memory was undefined."); if (getSelectedPrimitiveDescriptor() == nullptr) OPENVINO_THROW("Preferable primitive descriptor was not set."); diff --git a/src/plugins/intel_cpu/src/nodes/unique.cpp b/src/plugins/intel_cpu/src/nodes/unique.cpp index 130213dfcb8703..79c98d4b1d44ad 100644 --- a/src/plugins/intel_cpu/src/nodes/unique.cpp +++ b/src/plugins/intel_cpu/src/nodes/unique.cpp @@ -91,14 +91,14 @@ void Unique::createPrimitive() { void Unique::prepareParams() { auto dataMemPtr = getSrcMemoryAtPort(IN_DATA); - if (!dataMemPtr || !dataMemPtr->isAllocated()) { - THROW_ERROR(" has not allocated input data memory."); + if (!dataMemPtr || !dataMemPtr->isDefined()) { + THROW_ERROR(" has undefined input data memory."); } for (int i = 0; i < 4; i++) { if (definedOutputs[i]) { auto dstMemPtr = getDstMemoryAtPort(i); - if (!dstMemPtr || !dstMemPtr->isAllocated()) { - THROW_ERROR(" has not allocated output memory at port ", i); + if (!dstMemPtr || !dstMemPtr->isDefined()) { + THROW_ERROR(" has undefined output memory at port ", i); } } } diff --git a/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp b/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp index 74b13244b54bff..0e96f7c95bc4fc 100644 --- a/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp +++ b/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp @@ -654,7 +654,7 @@ std::string to_string(const T* values, size_t N, size_t maxsize) { std::ostream& operator<<(std::ostream& os, const IMemory& mem) { const auto& desc = mem.getDesc(); os << desc; - if (mem.isAllocated()) { + if (mem.isDefined()) { os << " ["; if (desc.getPrecision() == ov::element::i32) { os << to_string(mem.getDataAs(), mem.getSize() / sizeof(int32_t), 256);