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] Utilize OPENVINO_ASSERT when possible (#31323)
Egor Duplenskii96b8df515f24
diff --git a/src/plugins/intel_cpu/src/compiled_model.cpp b/src/plugins/intel_cpu/src/compiled_model.cppindex 52b07486ced..abf89f87d56 100644--- a/src/plugins/intel_cpu/src/compiled_model.cpp+++ b/src/plugins/intel_cpu/src/compiled_model.cpp@@ -83,9 +83,7 @@ CompiledModel::CompiledModel(const std::shared_ptr<ov::Model>& model,m_sub_memory_manager(std::move(sub_memory_manager)) {m_mutex = std::make_shared<std::mutex>();const auto& core = m_plugin->get_core();- if (!core) {- OPENVINO_THROW("Unable to get API version. Core is unavailable");- }+ OPENVINO_ASSERT(core, "Unable to get API version. Core is unavailable");IStreamsExecutor::Config executor_config;if (m_cfg.exclusiveAsyncRequests) {@@ -249,17 +247,13 @@ std::shared_ptr<ov::IAsyncInferRequest> CompiledModel::create_infer_request() co}std::shared_ptr<const ov::Model> CompiledModel::get_runtime_model() const {- if (m_graphs.empty()) {- OPENVINO_THROW("No graph was found");- }+ OPENVINO_ASSERT(!m_graphs.empty(), "No graph was found");return get_graph()._graph.dump();}ov::Any CompiledModel::get_property(const std::string& name) const {- if (m_graphs.empty()) {- OPENVINO_THROW("No graph was found");- }+ OPENVINO_ASSERT(!m_graphs.empty(), "No graph was found");if (name == ov::loaded_from_cache) {return m_loaded_from_cache;diff --git a/src/plugins/intel_cpu/src/config.cpp b/src/plugins/intel_cpu/src/config.cppindex 759c1157912..88233d418e5 100644--- a/src/plugins/intel_cpu/src/config.cpp+++ b/src/plugins/intel_cpu/src/config.cpp@@ -104,16 +104,14 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {try {ov::Any value = val.as<std::string>();int val_i = value.as<int>();- if (val_i < 0) {- OPENVINO_THROW("invalid value.");- }+ OPENVINO_ASSERT(val_i >= 0, "invalid value.");hintNumRequests = static_cast<uint32_t>(val_i);} catch (const ov::Exception&) {OPENVINO_THROW("Wrong value ",val.as<std::string>(),"for property key ",ov::hint::num_requests.name(),- ". Expected only > 0.");+ ". Expected only >= 0.");}} else if (key == ov::hint::enable_cpu_pinning.name()) {try {@@ -189,13 +187,11 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {ov::intel_cpu::sparse_weights_decompression_rate.name(),". Expected only float numbers");}- if (val_f < 0.F || val_f > 1.F) {- OPENVINO_THROW("Wrong value for property key ",- ov::intel_cpu::sparse_weights_decompression_rate.name(),- ". Sparse rate must be in range [0.0f,1.0f]");- } else {- fcSparseWeiDecompressionRate = val_f;- }+ OPENVINO_ASSERT(val_f >= 0.F && val_f <= 1.F,+ "Wrong value for property key ",+ ov::intel_cpu::sparse_weights_decompression_rate.name(),+ ". Sparse rate must be in range [0.0f,1.0f]");+ fcSparseWeiDecompressionRate = val_f;} else if (key == ov::hint::dynamic_quantization_group_size.name()) {try {fcDynamicQuantizationGroupSizeSetExplicitly = true;@@ -203,7 +199,7 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {} catch (const ov::Exception&) {OPENVINO_THROW("Wrong value for property key ",ov::hint::dynamic_quantization_group_size.name(),- ". Expected only unsinged integer numbers");+ ". Expected only unsigned integer numbers");}} else if (key == ov::enable_profiling.name()) {try {@@ -237,9 +233,7 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {}} else if (key == ov::device::id.name()) {device_id = val.as<std::string>();- if (!device_id.empty()) {- OPENVINO_THROW("CPU plugin supports only '' as device id");- }+ OPENVINO_ASSERT(device_id.empty(), "CPU plugin supports only '' as device id");} else if (key == ov::hint::inference_precision.name()) {try {const auto prec = val.as<ov::element::Type>();@@ -393,7 +387,7 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {val.as<std::string>()," for property key ",key,- ". Expected only unsinged integer numbers");+ ". Expected only unsigned integer numbers");}} else if (key == ov::intel_cpu::key_cache_quant_mode.name()) {try {diff --git a/src/plugins/intel_cpu/src/cpu_memory.cpp b/src/plugins/intel_cpu/src/cpu_memory.cppindex d7d667f26c2..954e96745c4 100644--- a/src/plugins/intel_cpu/src/cpu_memory.cpp+++ b/src/plugins/intel_cpu/src/cpu_memory.cpp@@ -119,9 +119,8 @@ Memory::Memory(dnnl::engine eng, MemoryDescPtr desc, const void* data, bool padsm_pMemDesc(std::move(desc)),m_blockHandle(std::make_shared<DnnlMemoryBlock>(make_unique<MemoryBlockWithReuse>()), this),dnnlMemHandle(this) {- if (m_pMemDesc->getPrecision() == element::string) {- OPENVINO_THROW("[CPU] Memory object cannot be created for string data.");- }+ OPENVINO_ASSERT(m_pMemDesc->getPrecision() != element::string,+ "[CPU] Memory object cannot be created for string data.");create(m_pMemDesc, data, pads_zeroing);}@@ -133,9 +132,8 @@ Memory::Memory(dnnl::engine eng, MemoryDescPtr desc, MemoryBlockPtr block)m_pMemDesc(std::move(desc)),m_blockHandle(std::move(block), this),dnnlMemHandle(this) {- if (m_pMemDesc->getPrecision() == element::string) {- OPENVINO_THROW("[CPU] Memory object can't be created for string data.");- }+ OPENVINO_ASSERT(m_pMemDesc->getPrecision() != element::string,+ "[CPU] Memory object can't be created for string data.");bool memAllocated = m_blockHandle->getRawPtr() != nullptr;create(m_pMemDesc, nullptr, !memAllocated);@@ -146,9 +144,7 @@ Memory::Memory(dnnl::engine eng, const MemoryDesc& desc, MemoryBlockPtr block)size_t Memory::getSize() const {auto size = getDesc().getCurrentMemSize();- if (size == MemoryDesc::UNDEFINED_SIZE) {- OPENVINO_THROW("Can't get memory size for undefined shape");- }+ OPENVINO_ASSERT(size != MemoryDesc::UNDEFINED_SIZE, "Can't get memory size for undefined shape");return size;}@@ -173,9 +169,7 @@ void Memory::create(MemoryDescPtr desc, const void* data, bool pads_zeroing) {}void Memory::load(const IMemory& src, bool ftz, bool bf16saturation) const {- if (src.getDesc().getPrecision() == element::string) {- OPENVINO_THROW("[CPU] Memory object cannot load string data.");- }+ OPENVINO_ASSERT(src.getDesc().getPrecision() != element::string, "[CPU] Memory object cannot load string data.");transferData(src, *this, ftz, bf16saturation);}@@ -190,12 +184,9 @@ void Memory::nullify() {}void Memory::redefineDesc(MemoryDescPtr desc) {- if (desc->getPrecision() == element::string) {- OPENVINO_THROW("[CPU] Memory object cannot accept a descriptor with a string type.");- }- if (!desc->hasDefinedMaxSize()) {- OPENVINO_THROW("Can not reset descriptor, memory upper bound is unknown.");- }+ OPENVINO_ASSERT(desc->getPrecision() != element::string,+ "[CPU] Memory object cannot accept a descriptor with a string type.");+ OPENVINO_ASSERT(desc->hasDefinedMaxSize(), "Can not reset descriptor, memory upper bound is unknown.");this->create(desc, nullptr, false);}@@ -223,10 +214,8 @@ bool Memory::DnnlMemPrimHandle::isInit() const {dnnl::memory Memory::DnnlMemPrimHandle::getPrim() const {std::lock_guard<std::mutex> guard(m_primCachingLock);if (!m_prim) {- if (!m_memObjPtr->getDesc().isDefined()) {- OPENVINO_THROW("Can not create oneDNN memory from undefined memory descriptor");- }-+ OPENVINO_ASSERT(m_memObjPtr->getDesc().isDefined(),+ "Can not create oneDNN memory from undefined memory descriptor");// ========================// Equivalent of constructor memory(const primitive_desc &desc, void *hdl)// but with ability to skip pads zeroing.@@ -244,9 +233,9 @@ dnnl::memory Memory::DnnlMemPrimHandle::getPrim() const {void* Memory::getData() const {void* data = getDataNoThrow();- if (data == nullptr && m_pMemDesc->getShape().isStatic() && m_pMemDesc->getShape().getElementsCount() != 0) {- OPENVINO_THROW("Memory has not been allocated");- }+ OPENVINO_ASSERT(+ data != nullptr || !m_pMemDesc->getShape().isStatic() || m_pMemDesc->getShape().getElementsCount() == 0,+ "Memory has not been allocated");return data;}@@ -265,9 +254,7 @@ bool MemoryBlockWithReuse::resize(size_t size) {bool sizeChanged = false;if (size > m_memUpperBound) {void* ptr = dnnl::impl::malloc(size, cacheLineSize);- if (!ptr) {- OPENVINO_THROW("Failed to allocate ", size, " bytes of memory");- }+ OPENVINO_ASSERT(ptr, "Failed to allocate ", size, " bytes of memory");m_memUpperBound = size;m_useExternalStorage = false;m_data = decltype(m_data)(ptr, destroy);@@ -307,9 +294,7 @@ void MemoryBlockWithReuse::destroy(void* ptr) {StringMemory::StringMemory(dnnl::engine engine, MemoryDescPtr desc, const void* data): m_engine(std::move(engine)),m_mem_desc(std::move(desc)) {- if (m_mem_desc->getPrecision() != element::string) {- OPENVINO_THROW("[CPU] StringMemory supports String type only.");- }+ OPENVINO_ASSERT(m_mem_desc->getPrecision() == element::string, "[CPU] StringMemory supports String type only.");m_memoryBlock = std::make_shared<StringMemoryBlock>();@@ -328,9 +313,8 @@ StringMemory::StringMemory(dnnl::engine engine, MemoryDescPtr desc, const void*}void StringMemory::load(const IMemory& src, [[maybe_unused]] bool ftz, [[maybe_unused]] bool bf16saturation) const {- if (src.getDesc().getPrecision() != element::string) {- OPENVINO_THROW("[CPU] String memory cannot load a non-string object.");- }+ OPENVINO_ASSERT(src.getDesc().getPrecision() == element::string,+ "[CPU] String memory cannot load a non-string object.");transferData(src, *this, false, false);}@@ -340,12 +324,9 @@ void* StringMemory::getData() const {}void StringMemory::redefineDesc(MemoryDescPtr desc) {- if (desc->getPrecision() != element::string) {- OPENVINO_THROW("[CPU] StringMemory supports String type only.");- }- if (!desc->hasDefinedMaxSize()) {- OPENVINO_THROW("[CPU] StringMemory cannot reset descriptor. Memory upper bound is unknown.");- }+ OPENVINO_ASSERT(desc->getPrecision() == element::string, "[CPU] StringMemory supports String type only.");+ OPENVINO_ASSERT(desc->hasDefinedMaxSize(),+ "[CPU] StringMemory cannot reset descriptor. Memory upper bound is unknown.");m_mem_desc = desc;const auto string_size = m_mem_desc->getShape().getElementsCount();@@ -361,9 +342,7 @@ void StringMemory::nullify() {size_t StringMemory::getSize() const { // In bytesauto size = getDesc().getCurrentMemSize();- if (size == MemoryDesc::UNDEFINED_SIZE) {- OPENVINO_THROW("Can't get memory size for undefined shape.");- }+ OPENVINO_ASSERT(size != MemoryDesc::UNDEFINED_SIZE, "Can't get memory size for undefined shape.");return size;}@@ -388,14 +367,10 @@ StringMemory::OvString* StringMemory::StringMemoryBlock::getStringPtr() const nobool StringMemory::StringMemoryBlock::resize(size_t size) {bool sizeChanged = false;if (size > m_str_upper_bound) {- if (size > PTRDIFF_MAX) {- OPENVINO_THROW("Requested allocation size { ", size, " } exceeds PTRDIFF_MAX.");- }+ OPENVINO_ASSERT(size <= PTRDIFF_MAX, "Requested allocation size { ", size, " } exceeds PTRDIFF_MAX.");auto ptr_size = static_cast<ptrdiff_t>(size); // WA for warning alloc-size-larger-thanauto* ptr = new OvString[ptr_size];- if (!ptr) {- OPENVINO_THROW("Failed to allocate ", size, " bytes of memory");- }+ OPENVINO_ASSERT(ptr, "Failed to allocate ", size, " bytes of memory");m_str_upper_bound = size;m_use_external_storage = false;m_data = decltype(m_data)(ptr, destroy);@@ -466,12 +441,9 @@ void DnnlMemoryBlock::notifyUpdate() {StaticMemory::StaticMemory(dnnl::engine eng, MemoryDescPtr desc, const void* data, [[maybe_unused]] bool pads_zeroing): m_eng(std::move(eng)),m_pMemDesc(std::move(desc)) {- if (m_pMemDesc->getPrecision() == element::string) {- OPENVINO_THROW("[CPU] StaticMemory object cannot be created for string data.");- }- if (!m_pMemDesc->isDefined()) {- OPENVINO_THROW("Can not create StaticMemory object. The memory desc is undefined");- }+ OPENVINO_ASSERT(m_pMemDesc->getPrecision() != element::string,+ "[CPU] StaticMemory object cannot be created for string data.");+ OPENVINO_ASSERT(m_pMemDesc->isDefined(), "Can not create StaticMemory object. The memory desc is undefined");m_size = m_pMemDesc->getCurrentMemSize();@@ -530,9 +502,7 @@ void StaticMemory::redefineDesc([[maybe_unused]] MemoryDescPtr desc) {}void StaticMemory::load(const IMemory& src, bool ftz, bool bf16saturation) const {- if (src.getDesc().getPrecision() == element::string) {- OPENVINO_THROW("[CPU] StaticMemory cannot load string data.");- }+ OPENVINO_ASSERT(src.getDesc().getPrecision() != element::string, "[CPU] StaticMemory cannot load string data.");transferData(src, *this, ftz, bf16saturation);}@@ -570,9 +540,7 @@ void StaticMemory::StaticMemoryBlock::setExtBuff([[maybe_unused]] void* ptr, [[m}bool StaticMemory::StaticMemoryBlock::resize(size_t size) {- if (size != m_size) {- OPENVINO_THROW("Unexpected: StaticMemoryBlock may not resize the memory");- }+ OPENVINO_ASSERT(size == m_size, "Unexpected: StaticMemoryBlock may not resize the memory");return false;}@@ -741,9 +709,7 @@ MemoryPtr split_vertical(const dnnl::engine& eng,};if (shape.isDynamic()) {const auto& pshape = shape.toPartialShape();- if (pshape[dim].is_dynamic()) {- OPENVINO_THROW("Can't split data with dynamic shapes");- }+ OPENVINO_ASSERT(!pshape[dim].is_dynamic(), "Can't split data with dynamic shapes");auto new_pshape = pshape;auto splited_dim_vec = split_parts(new_pshape[dim].get_length(), w_size);new_pshape[dim] = splited_dim_vec[w_rank];diff --git a/src/plugins/intel_cpu/src/cpu_shape.h b/src/plugins/intel_cpu/src/cpu_shape.hindex d9305c369c6..b31b74c85a1 100644--- a/src/plugins/intel_cpu/src/cpu_shape.h+++ b/src/plugins/intel_cpu/src/cpu_shape.h@@ -50,9 +50,8 @@ public:}Shape(const VectorDims& minDims, const VectorDims& maxDims) {- if (minDims.size() != maxDims.size()) {- OPENVINO_THROW("Can't create shape due to min/max vectors dims size mismatch");- }+ OPENVINO_ASSERT(minDims.size() == maxDims.size(),+ "Can't create shape due to min/max vectors dims size mismatch");this->minDims = minDims;this->maxDims = maxDims;@@ -126,10 +125,7 @@ public:* @return return shape*/[[nodiscard]] const VectorDims& getStaticDims() const {- if (type != ShapeType::Static) {- OPENVINO_THROW("Cannot get dims for non static shape");- }-+ OPENVINO_ASSERT(type == ShapeType::Static, "Cannot get dims for non static shape");return minDims;}@@ -167,10 +163,7 @@ public:}[[nodiscard]] size_t getElementsCount() const {- if (type != ShapeType::Static) {- OPENVINO_THROW("Cannot get elements count for non static shape");- }-+ OPENVINO_ASSERT(type == ShapeType::Static, "Cannot get elements count for non static shape");size_t size = 1;for (uint64_t minDim : minDims) {diff --git a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp b/src/plugins/intel_cpu/src/cpu_streams_calculation.cppindex 3db6f9637e6..89e78381fd9 100644--- a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp+++ b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp@@ -744,9 +744,8 @@ std::vector<std::vector<int>> generate_stream_info(const int streams,Config& config,std::vector<std::vector<int>>& proc_type_table,int preferred_nthreads_per_stream) {- if (proc_type_table.empty() || proc_type_table[0][ALL_PROC] == 0) {- OPENVINO_THROW("proc_type_table is empty. No CPU resources available!");- }+ OPENVINO_ASSERT(!proc_type_table.empty() && proc_type_table[0][ALL_PROC] != 0,+ "proc_type_table is empty. No CPU resources available!");int model_prefer_threads = preferred_nthreads_per_stream;proc_type_table = apply_scheduling_core_type(config.schedulingCoreType, proc_type_table);@@ -762,9 +761,8 @@ std::vector<std::vector<int>> generate_stream_info(const int streams,const auto cur_numa_node_id = input_numa_node_id < 0 ? get_current_numa_node_id() : input_numa_node_id;sort_table_by_numa_node_id(cur_numa_node_id, proc_type_table);}- if (proc_type_table.empty() || proc_type_table[0][ALL_PROC] == 0) {- OPENVINO_THROW("proc_type_table is empty. No valid CPU resources available!");- }+ OPENVINO_ASSERT(!proc_type_table.empty() && proc_type_table[0][ALL_PROC] != 0,+ "proc_type_table is empty. No valid CPU resources available!");auto streams_info_table = get_streams_info_table(config.streams,config.streamsChanged,config.threads,@@ -774,9 +772,7 @@ std::vector<std::vector<int>> generate_stream_info(const int streams,ov::util::to_string(config.hintPerfMode),config.modelDistributionPolicy,proc_type_table);- if (streams_info_table.empty()) {- OPENVINO_THROW("streams_info_table is empty!");- }+ OPENVINO_ASSERT(!streams_info_table.empty(), "streams_info_table is empty!");if (config.modelDistributionPolicy.find(ov::hint::ModelDistributionPolicy::TENSOR_PARALLEL) !=config.modelDistributionPolicy.end()) {config.streamsRankTable =diff --git a/src/plugins/intel_cpu/src/cpu_tensor.cpp b/src/plugins/intel_cpu/src/cpu_tensor.cppindex a4ed73c86f1..39968500855 100644--- a/src/plugins/intel_cpu/src/cpu_tensor.cpp+++ b/src/plugins/intel_cpu/src/cpu_tensor.cpp@@ -29,7 +29,7 @@ constexpr bool is_pointer_representable(const ov::element::Type& tensor_type, co} // namespaceTensor::Tensor(MemoryPtr memptr) : m_memptr{std::move(memptr)} {- OPENVINO_ASSERT(m_memptr != nullptr);+ OPENVINO_ASSERT(m_memptr);// only support plain data format ncsp.auto memdesc = m_memptr->getDescPtr();diff --git a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp b/src/plugins/intel_cpu/src/dnnl_extension_utils.cppindex f275a7cf32e..426ffd857ab 100644--- a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp+++ b/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp@@ -233,19 +233,14 @@ DnnlMemoryDescPtr DnnlExtensionUtils::query_md(const const_dnnl_primitive_desc_tauto query = dnnl::convert_to_c(what);const auto* cdesc = dnnl_primitive_desc_query_md(pd, query, idx);- if (!cdesc) {- OPENVINO_THROW("query_md failed for query=", query, " idx=", idx, ".");- }-+ OPENVINO_ASSERT(cdesc, "query_md failed for query=", query, " idx=", idx, ".");return DnnlExtensionUtils::makeDescriptor(cdesc);}std::string DnnlExtensionUtils::query_impl_info_str(const const_dnnl_primitive_desc_t& pd) {const char* res = nullptr;dnnl_status_t status = dnnl_primitive_desc_query(pd, dnnl_query_impl_info_str, 0, reinterpret_cast<void*>(&res));- if (status != dnnl_success) {- OPENVINO_THROW("query_impl_info_str failed.");- }+ OPENVINO_ASSERT(status == dnnl_success, "query_impl_info_str failed.");return res;}diff --git a/src/plugins/intel_cpu/src/dnnl_postops_composer.cpp b/src/plugins/intel_cpu/src/dnnl_postops_composer.cppindex 337afaa26e7..2d0e33cdc64 100644--- a/src/plugins/intel_cpu/src/dnnl_postops_composer.cpp+++ b/src/plugins/intel_cpu/src/dnnl_postops_composer.cpp@@ -725,9 +725,8 @@ static MemoryPtr prepackDecompressionParams(const MemoryCPtr& paramsPtr,shape.push_back(1);}- if (shape.size() != 2 && shape.size() != 3) {- OPENVINO_THROW("DnnlPostOpsComposer cannot prepack decompression params with invalid shape");- }+ OPENVINO_ASSERT(shape.size() == 2 || shape.size() == 3,+ "DnnlPostOpsComposer cannot prepack decompression params with invalid shape");// weights without batch: (OC, G)// weights with batch: (B, OC, G)diff --git a/src/plugins/intel_cpu/src/edge.cpp b/src/plugins/intel_cpu/src/edge.cppindex 967ce522904..cd02f18abc2 100644--- a/src/plugins/intel_cpu/src/edge.cpp+++ b/src/plugins/intel_cpu/src/edge.cpp@@ -41,17 +41,13 @@ Edge::Edge(const NodePtr& parent, const NodePtr& child, int pr_port, int ch_portNodePtr Edge::getParent() const {auto parentPtr = parent.lock();- if (!parentPtr) {- OPENVINO_THROW("Edge contains empty parent node");- }+ OPENVINO_ASSERT(parentPtr, "Edge contains empty parent node");return parentPtr;}NodePtr Edge::getChild() const {auto childPtr = child.lock();- if (!childPtr) {- OPENVINO_THROW("Edge contains empty child node");- }+ OPENVINO_ASSERT(childPtr, "Edge contains empty child node");return childPtr;}@@ -132,9 +128,8 @@ bool Edge::enforceReorder() {auto* parentSPD = parentNode->getSelectedPrimitiveDescriptor();auto childNode = getChild();auto* childSPD = childNode->getSelectedPrimitiveDescriptor();- if (!parentSPD || !childSPD) {- OPENVINO_THROW("Cannot make a decision about reorder. Primitive descriptors weren't selected.");- }+ OPENVINO_ASSERT(parentSPD && childSPD,+ "Cannot make a decision about reorder. Primitive descriptors weren't selected.");bool in_place = inPlace();@@ -287,7 +282,7 @@ Edge::ReorderStatus Edge::needReorder() {}void Edge::reuse(MemoryPtr ptr) {- OPENVINO_ASSERT(ptr != nullptr, "Attempt to reuse uninitialized memory in ", *this);+ OPENVINO_ASSERT(ptr, "Attempt to reuse uninitialized memory in ", *this);memoryPtr = std::move(ptr);changeStatus(Status::Allocated);@@ -303,15 +298,11 @@ int Edge::getOutputNum() const {}void Edge::allocateCommon(const std::function<MemoryPtr(const MemoryDesc&)>& allocate) {- if (memoryPtr) {- OPENVINO_THROW("Unexpected behaviour: status == NeedAllocation but memory is already allocated.");- }+ OPENVINO_ASSERT(!memoryPtr, "Unexpected behaviour: status == NeedAllocation but memory is already allocated.");const auto& inputDesc = getInputDesc();const auto& outputDesc = getOutputDesc();- if (!inputDesc.isCompatible(outputDesc)) {- OPENVINO_THROW("Cannot allocate memory for incompatible descriptors.");- }+ OPENVINO_ASSERT(inputDesc.isCompatible(outputDesc), "Cannot allocate memory for incompatible descriptors.");memoryPtr = allocate(inputDesc);DEBUG_LOG(*this, " memoryPtr=", memoryPtr);@@ -328,10 +319,7 @@ void Edge::allocate(const void* mem_ptr) {}void Edge::allocate(MemoryBlockPtr memBlock) {- if (!memBlock) {- OPENVINO_THROW("Unexpected: Memory block ptr is NULL");- }-+ OPENVINO_ASSERT(memBlock, "Unexpected: Memory block ptr is NULL");auto allocateFunc = [this, block = std::move(memBlock)](const MemoryDesc& inputDesc) mutable -> MemoryPtr {auto parentPtr = getParent();return std::make_shared<Memory>(parentPtr->getEngine(), inputDesc, std::move(block));@@ -378,15 +366,9 @@ void Edge::externalAllocate(const WeightsSharing::Ptr& weightsCache) {}void Edge::changeStatus(Edge::Status state) {- if (state == Status::NotAllocated) {- OPENVINO_THROW("Incorrect behaviour! Use method sharedMemFrom()");- }- if (state == Status::Validated) {- OPENVINO_THROW("Incorrect behaviour! Use method validate()");- }- if (Status::Validated == this->status) {- OPENVINO_THROW("Unexpected attempt of memory change on edge: ", *this);- }+ OPENVINO_ASSERT(state != Status::NotAllocated, "Incorrect behaviour! Use method sharedMemFrom()");+ OPENVINO_ASSERT(state != Status::Validated, "Incorrect behaviour! Use method validate()");+ OPENVINO_ASSERT(Status::Validated != this->status, "Unexpected attempt of memory change on edge: ", *this);if (this->status != Status::Uninitialized && state == Status::NeedAllocation) {return;}@@ -398,79 +380,64 @@ void Edge::changeStatus(Edge::Status state) {PortDescBaseCPtr Edge::getInputPortDesc() const {auto parentPtr = getParent();- if (parentPtr->getSelectedPrimitiveDescriptor() == nullptr) {- OPENVINO_THROW("Primitive descriptor for node ", parentPtr->getName(), " is not selected.");- }+ OPENVINO_ASSERT(parentPtr->getSelectedPrimitiveDescriptor(),+ "Primitive descriptor for node ",+ parentPtr->getName(),+ " is not selected.");int inputIdx = getInputNum();- if (inputIdx < 0) {- OPENVINO_THROW("Edge cannot be found for node", parentPtr->getName(), ".");- }-+ OPENVINO_ASSERT(inputIdx >= 0, "Edge cannot be found for node", parentPtr->getName(), ".");const auto& outConfs = parentPtr->getSelectedPrimitiveDescriptor()->getConfig().outConfs;- if (outConfs.empty()) {- OPENVINO_THROW("Node ", parentPtr->getName(), " has empty output config list.");- }+ OPENVINO_ASSERT(!outConfs.empty(), "Node ", parentPtr->getName(), " has empty output config list.");if (static_cast<size_t>(inputIdx) >= outConfs.size()) {inputIdx = 0;}auto inputPortDesc = outConfs[inputIdx].getPortDesc();- if (!inputPortDesc) {- OPENVINO_THROW("Node", parentPtr->getName(), " has unitialized input port desc on port ", inputIdx);- }-+ OPENVINO_ASSERT(inputPortDesc, "Node", parentPtr->getName(), " has unitialized input port desc on port ", inputIdx);return inputPortDesc;}PortDescBaseCPtr Edge::getOutputPortDesc() const {auto childPtr = getChild();- if (childPtr->getSelectedPrimitiveDescriptor() == nullptr) {- OPENVINO_THROW("Primitive descriptor for node ", childPtr->getName(), " is not selected.");- }+ OPENVINO_ASSERT(childPtr->getSelectedPrimitiveDescriptor(),+ "Primitive descriptor for node ",+ childPtr->getName(),+ " is not selected.");int outputIdx = getOutputNum();- if (outputIdx < 0) {- OPENVINO_THROW("Edge cannot be found for node", childPtr->getName(), ".");- }+ OPENVINO_ASSERT(outputIdx >= 0, "Edge cannot be found for node", childPtr->getName(), ".");const auto& inConfs = childPtr->getSelectedPrimitiveDescriptor()->getConfig().inConfs;- if (inConfs.empty()) {- OPENVINO_THROW("Node ", childPtr->getName(), " has empty input config list.");- }+ OPENVINO_ASSERT(!inConfs.empty(), "Node ", childPtr->getName(), " has empty input config list.");if (static_cast<size_t>(outputIdx) >= inConfs.size()) {outputIdx = 0;}auto outPortDesc = inConfs[outputIdx].getPortDesc();- if (!outPortDesc) {- OPENVINO_THROW("Node", childPtr->getName(), " has unitialized output port desc on port ", outputIdx);- }-+ OPENVINO_ASSERT(outPortDesc, "Node", childPtr->getName(), " has unitialized output port desc on port ", outputIdx);return outPortDesc;}const MemoryDesc& Edge::getInputDesc() const {auto memDescPtr = getInputPortDesc()->getMemDesc();- if (!memDescPtr) {- OPENVINO_THROW("Cannot get input memory descriptor for edge: ",- getParent()->getName(),- "->",- getChild()->getName());- }+ OPENVINO_ASSERT(memDescPtr,+ "Cannot get input memory descriptor for edge: ",+ getParent()->getName(),+ "->",+ getChild()->getName());return *memDescPtr;}const MemoryDesc& Edge::getOutputDesc() const {auto memDescPtr = getOutputPortDesc()->getMemDesc();- if (!memDescPtr) {- OPENVINO_THROW("Cannot get output memory descriptor for edge: ",- getParent()->getName(),- "->",- getChild()->getName());- }+ OPENVINO_ASSERT(memDescPtr,+ "Cannot get output memory descriptor for edge: ",+ getParent()->getName(),+ "->",+ getChild()->getName());return *memDescPtr;}@@ -484,16 +451,14 @@ const MemoryDesc& Edge::getOriginalDesc() const {return getInputDesc();}- if (!getInputDesc().isCompatible(getOutputDesc())) {- OPENVINO_THROW("Cannot get descriptor for edge: ", *this);- }+ OPENVINO_ASSERT(getInputDesc().isCompatible(getOutputDesc()), "Cannot get descriptor for edge: ", *this);return getInputDesc();}const IMemory& Edge::getMemory() {auto memPtr = getMemoryPtr();- OPENVINO_ASSERT(memPtr != nullptr, " Dereferencing NULL memory in edge: ", *this);+ OPENVINO_ASSERT(memPtr, " Dereferencing NULL memory in edge: ", *this);return *memPtr;}@@ -515,17 +480,16 @@ void Edge::validate() {std::ignore = getParent();std::ignore = getChild();- if (status != Status::Allocated || !memoryPtr) {- OPENVINO_THROW("Error memory is not allocated for edge: ", *this);- }+ OPENVINO_ASSERT(status == Status::Allocated && memoryPtr, "Error memory is not allocated for edge: ", *this);status = Status::Validated;}EdgePtr Edge::getSharedEdge() const {auto memoryFromEdgePtr = memoryFromEdge.lock();- if (!memoryFromEdgePtr) {- OPENVINO_THROW("Cannot get memory ptr for edge( ", *this, " ). The pointer on the edge with memory is empty!");- }+ OPENVINO_ASSERT(memoryFromEdgePtr,+ "Cannot get memory ptr for edge( ",+ *this,+ " ). The pointer on the edge with memory is empty!");return memoryFromEdgePtr;}diff --git a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cppindex 13a960be055..c3d01e6945c 100644--- a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp+++ b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp@@ -2859,10 +2859,7 @@ void jit_sigmoid_emitter::emit_impl(const std::vector<size_t>& in_vec_idxs,template <dnnl::impl::cpu::aarch64::cpu_isa_t isa>void jit_sigmoid_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs,const std::vector<size_t>& out_vec_idxs) const {- if (exec_prc_ != ov::element::f32) {- OPENVINO_THROW("unsupported precision: " + exec_prc_.to_string());- }-+ OV_CPU_JIT_EMITTER_ASSERT(exec_prc_ == ov::element::f32, "unsupported precision: " + exec_prc_.to_string());using TReg = typename dnnl::impl::cpu::aarch64::cpu_isa_traits<isa>::TReg;const TReg vmm_src(in_vec_idxs[0]);const TReg vmm_dst(out_vec_idxs[0]);@@ -3137,10 +3134,7 @@ void jit_soft_sign_emitter::emit_impl(const std::vector<size_t>& in_vec_idxs,template <dnnl::impl::cpu::aarch64::cpu_isa_t isa>void jit_soft_sign_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs,const std::vector<size_t>& out_vec_idxs) const {- if (exec_prc_ != ov::element::f32) {- OPENVINO_THROW("unsupported precision: " + exec_prc_.to_string());- }-+ OV_CPU_JIT_EMITTER_ASSERT(exec_prc_ == ov::element::f32, "unsupported precision: " + exec_prc_.to_string());using TReg = typename dnnl::impl::cpu::aarch64::cpu_isa_traits<isa>::TReg;const TReg src(in_vec_idxs[0]);const TReg dst(out_vec_idxs[0]);diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cppindex 55e23e3fa6a..66b770c6602 100644--- a/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp+++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp@@ -460,9 +460,7 @@ bool intel_cpu::CPUTargetMachine::is_supported() const {}snippets::CompiledSnippetPtr intel_cpu::CPUTargetMachine::get_snippet() {- if (h->create_kernel() != dnnl::impl::status::success) {- OPENVINO_THROW("Failed to create jit_kernel in get_snippet()");- }+ OPENVINO_ASSERT(h->create_kernel() == dnnl::impl::status::success, "Failed to create jit_kernel in get_snippet()");const auto& result =std::make_shared<CompiledSnippetCPU>(std::unique_ptr<dnnl::impl::cpu::x64::jit_generator_t>(h.release()));// Note that we reset all the generated code, since it was copied into CompiledSnippetCPUdiff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cppindex 843fc53a590..a6b64d374b1 100644--- a/src/plugins/intel_cpu/src/graph.cpp+++ b/src/plugins/intel_cpu/src/graph.cpp@@ -1101,9 +1101,8 @@ static MemoryRegions FormMemoryRegions(const EdgeClusters& clusters,auto allocType =desc.getPrecision() == element::string ? MemoryRegion::AllocType::STRING : MemoryRegion::AllocType::POD;- if (reg.alloc_type != allocType && MemoryRegion::AllocType::UNKNOWN != reg.alloc_type) {- OPENVINO_THROW("Different allocation types in the same memory region");- }+ OPENVINO_ASSERT(one_of(reg.alloc_type, allocType, MemoryRegion::AllocType::UNKNOWN),+ "Different allocation types in the same memory region");reg.alloc_type = allocType;isConst |= isConstOutput(edge);@@ -1213,9 +1212,7 @@ bool Graph::ProcessDynNodes() const {}void Graph::PushInputData(const std::size_t& index, const ov::SoPtr<ITensor>& input) {- if (!IsReady()) {- OPENVINO_THROW("Wrong state. Topology not ready.");- }+ OPENVINO_ASSERT(IsReady(), "Wrong state. Topology not ready.");auto input_itr = inputNodesMap.find(index);if (input_itr != inputNodesMap.end()) {auto node = input_itr->second;@@ -1247,9 +1244,7 @@ void Graph::PushInputData(const std::size_t& index, const ov::SoPtr<ITensor>& in// suppose always being shared infer_request intel_cpu::Tensor to Graph if isDynamic.void Graph::PullOutputData(std::unordered_map<std::size_t, ov::SoPtr<ITensor>>& output) {- if (!IsReady()) {- OPENVINO_THROW("Wrong state. Topology not ready.");- }+ OPENVINO_ASSERT(IsReady(), "Wrong state. Topology not ready.");for (auto& outputMap : outputNodesMap) {auto output_index = outputMap.first;@@ -1305,13 +1300,12 @@ void Graph::PullOutputData(std::unordered_map<std::size_t, ov::SoPtr<ITensor>>&auto srcPrec = intr_blob.getPrecision();auto dstPrec = ext_blob->get_element_type();- if (srcPrec == dstPrec && ext_blob->get_byte_size() != intr_blob.getSize()) {- OPENVINO_THROW("Output tensor byte size is not equal model output byte size (",- ext_blob->get_byte_size(),- "!=",- intr_blob.getSize(),- ").");- }+ OPENVINO_ASSERT(srcPrec != dstPrec || ext_blob->get_byte_size() == intr_blob.getSize(),+ "Output tensor byte size is not equal model output byte size (",+ ext_blob->get_byte_size(),+ "!=",+ intr_blob.getSize(),+ ").");void* ext_blob_ptr = ext_blob->data();void* intr_blob_ptr = intr_blob.getData();@@ -1963,15 +1957,14 @@ NodePtr Graph::InsertReorder(const EdgePtr& edge,bool Graph::InsertNode(const EdgePtr& edge, const NodePtr& node, bool initNode) {auto oIndex = edge->getOutputNum();auto iIndex = edge->getInputNum();- if (iIndex < 0 || oIndex < 0) {- OPENVINO_THROW("Cannot insert node '",- node->getName(),- "' between nodes: ",- edge->getParent()->getName(),- " and ",- edge->getChild()->getName(),- ".");- }+ OPENVINO_ASSERT(iIndex >= 0 && oIndex >= 0,+ "Cannot insert node '",+ node->getName(),+ "' between nodes: ",+ edge->getParent()->getName(),+ " and ",+ edge->getChild()->getName(),+ ".");edge->getParent()->removeChildEdge(edge);edge->getChild()->removeParentEdge(edge);diff --git a/src/plugins/intel_cpu/src/graph_optimizer.cpp b/src/plugins/intel_cpu/src/graph_optimizer.cppindex 2090770a525..9a3f7a9189e 100644--- a/src/plugins/intel_cpu/src/graph_optimizer.cpp+++ b/src/plugins/intel_cpu/src/graph_optimizer.cpp@@ -298,19 +298,12 @@ void GraphOptimizer::FuseConvMatmulFCDeconvAndDQScales(Graph& graph) {auto initializeDeQuantizedScales = [](const NodePtr& node, const NodePtr& scales) {auto* scalesConstant = dynamic_cast<node::Input*>(scales.get());- if (scalesConstant == nullptr) {- OPENVINO_THROW("Cannot cast to Input node");- }+ OPENVINO_ASSERT(scalesConstant, "Cannot cast to Input node");auto scalesBlob = scalesConstant->getMemoryPtr();- if (scalesBlob == nullptr) {- OPENVINO_THROW("Cannot cast to TBlob internal scales blob");- }-+ OPENVINO_ASSERT(scalesBlob, "Cannot cast to TBlob internal scales blob");const auto* scalesData = static_cast<const float*>(scalesBlob->getData());- if (scalesData == nullptr) {- OPENVINO_THROW("scalesBlob has not allocated buffer");- }+ OPENVINO_ASSERT(scalesData, "scalesBlob has not allocated buffer");auto scalesDims = getNormalizedDimsBySize(scales->getOutputShapeAtPort(0).getDims(),node->getOutputShapeAtPort(0).getDims().size());auto scaleSize = std::accumulate(scalesDims.begin(), scalesDims.end(), 1, std::multiplies<>());@@ -530,9 +523,7 @@ void GraphOptimizer::FuseDeconvolutionAndSimpleOperation(Graph& graph) {return false;}const auto deconv = std::dynamic_pointer_cast<Deconvolution>(node);- if (deconv == nullptr) {- OPENVINO_THROW("Cannot cast to deconvolution node ", node->getName());- }+ OPENVINO_ASSERT(deconv, "Cannot cast to deconvolution node ", node->getName());if (deconv->getAlgorithm() != Algorithm::DeconvolutionCommon) {return true;@@ -940,9 +931,7 @@ void GraphOptimizer::FuseConvolutionAndZeroPoints(Graph& graph) {auto initializeInputZeroPoints = [](const NodePtr& node, const NodePtr& parent0, const NodePtr& parent1) {auto* convNode = dynamic_cast<Convolution*>(node.get());- if (convNode == nullptr) {- OPENVINO_THROW("Cannot get convolution node ", node->getName());- }+ OPENVINO_ASSERT(convNode, "Cannot get convolution node ", node->getName());auto IC = node->getInputShapeAtPort(0).getDims()[1];auto OC = node->getOutputShapeAtPort(0).getDims()[1];@@ -1005,20 +994,12 @@ void GraphOptimizer::FuseConvolutionAndZeroPoints(Graph& graph) {}auto* zeroPointsConstant = dynamic_cast<node::Input*>(subtractArg1.get());- if (zeroPointsConstant == nullptr) {- OPENVINO_THROW("Cannot cast to Input node");- }+ OPENVINO_ASSERT(zeroPointsConstant, "Cannot cast to Input node");auto zeroPointsBlob = zeroPointsConstant->getMemoryPtr();- if (zeroPointsBlob == nullptr) {- OPENVINO_THROW("Cannot cast to TBlob internal zero points blob");- }-+ OPENVINO_ASSERT(zeroPointsBlob, "Cannot cast to TBlob internal zero points blob");const auto* zeroPointsData = static_cast<const uint8_t*>(zeroPointsBlob->getData());- if (zeroPointsData == nullptr) {- OPENVINO_THROW("zeroPointsBlob has not allocated buffer");- }-+ OPENVINO_ASSERT(zeroPointsData, "zeroPointsBlob has not allocated buffer");auto zeroPointDataSize = parent0->getInputShapeAtPort(1).getDims()[1];if (Shape::UNDEFINED_DIM == zeroPointDataSize) {return false;@@ -1029,9 +1010,7 @@ void GraphOptimizer::FuseConvolutionAndZeroPoints(Graph& graph) {auto initializeOutputCompensation = [](const NodePtr& node) {auto* convNode = dynamic_cast<Convolution*>(node.get());- if (convNode == nullptr) {- OPENVINO_THROW("Cannot get convolution node ", node->getName());- }+ OPENVINO_ASSERT(convNode, "Cannot get convolution node ", node->getName());if (convNode->legacyInputZeroPoints.empty()) {return;@@ -1046,15 +1025,9 @@ void GraphOptimizer::FuseConvolutionAndZeroPoints(Graph& graph) {}auto weightsBlob = weightsConstant->getMemoryPtr();- if (weightsBlob == nullptr) {- OPENVINO_THROW("Cannot cast to TBlob internal weights blob");- }-+ OPENVINO_ASSERT(weightsBlob, "Cannot cast to TBlob internal weights blob");const auto* weightsPtr = static_cast<const int8_t*>(weightsBlob->getData());- if (weightsPtr == nullptr) {- OPENVINO_THROW("weightsBlob has not allocated buffer");- }-+ OPENVINO_ASSERT(weightsPtr, "weightsBlob has not allocated buffer");auto G = convNode->getGroupNum();const size_t groupOffset = convNode->getAlgorithm() == Algorithm::ConvolutionGrouped ? 1 : 0;const auto& weightsConstantDims = weightsConstant->outputShapes[0].getStaticDims();@@ -1224,10 +1197,7 @@ void GraphOptimizer::FuseConvolutionAndDWConvolution(Graph& graph) {}const auto conv = std::dynamic_pointer_cast<Convolution>(node);- if (conv == nullptr) {- OPENVINO_THROW("Cannot cast to convolution node ", node->getName());- }-+ OPENVINO_ASSERT(conv, "Cannot cast to convolution node ", node->getName());if (!conv->legacyWeightsZeroPoints.empty()) {return false;}@@ -1265,15 +1235,10 @@ void GraphOptimizer::FuseConvolutionAndDWConvolution(Graph& graph) {}const auto convChild = std::dynamic_pointer_cast<Convolution>(childNode);- if (convChild == nullptr) {- OPENVINO_THROW("Cannot cast to convolution node ", childNode->getName());- }+ OPENVINO_ASSERT(convChild, "Cannot cast to convolution node ", childNode->getName());const auto convParent = std::dynamic_pointer_cast<Convolution>(parentNode);- if (convParent == nullptr) {- OPENVINO_THROW("Cannot cast to convolution node ", parentNode->getName());- }-+ OPENVINO_ASSERT(convParent, "Cannot cast to convolution node ", parentNode->getName());if (!everyone_is(ov::element::f32,convParent->getOriginalOutputPrecisionAtPort(0),convChild->getOriginalInputPrecisionAtPort(0),@@ -1339,10 +1304,7 @@ void GraphOptimizer::FuseConvolutionAndDWConvolution(Graph& graph) {int dw_conv_output_size = outDims[0] * outDims[1] * outDims[2] * outDims[3] * elemSize;auto parentConvolutionNode = std::dynamic_pointer_cast<Convolution>(parentNode);- if (parentConvolutionNode == nullptr) {- OPENVINO_THROW("Cannot get convolution node ", parentNode->getName());- }-+ OPENVINO_ASSERT(parentConvolutionNode, "Cannot get convolution node ", parentNode->getName());if (!impl::cpu::x64::mayiuse(impl::cpu::x64::avx2)) {return false;}@@ -1950,9 +1912,7 @@ void GraphOptimizer::FuseInterpolateAndSimpleOperation(Graph& graph) {return false;}auto* interpolateNode = dynamic_cast<Interpolate*>(parentNode.get());- if (!interpolateNode) {- OPENVINO_THROW("Cannot cast ", parentNode->getName(), " to Interpolate");- }+ OPENVINO_ASSERT(interpolateNode, "Cannot cast ", parentNode->getName(), " to Interpolate");return interpolateNode->canFuse(childNode);};@@ -2062,9 +2022,7 @@ void GraphOptimizer::FuseReduceAndSimpleOperation(Graph& graph) {auto parentEdges = childNode->parentEdges;for (auto& parentEdge : parentEdges) {auto p_edge = parentEdge.lock();- if (p_edge == nullptr) {- OPENVINO_THROW("Cannot get parent edge ", childNode->getName());- }+ OPENVINO_ASSERT(p_edge, "Cannot get parent edge ", childNode->getName());if (p_edge->getParent()->getType() == Type::Reduce) {continue;}@@ -2224,9 +2182,7 @@ void GraphOptimizer::ShareReorders(Graph& graph) {return nullptr;}auto* reorder = dynamic_cast<Reorder*>(node.get());- if (reorder == nullptr) {- OPENVINO_THROW("Cannot get reorder layer ", node->getName());- }+ OPENVINO_ASSERT(reorder, "Cannot get reorder layer ", node->getName());// inplace children cannot be safely shared with each otherauto reorderConsumers = reorder->getChildEdgesAtPort(0);@@ -2300,14 +2256,9 @@ void GraphOptimizer::DropDoubleReorders(Graph& graph) {node->getChildEdges().size() == 1 && node->getChildEdgeAt(0)->getChild()->getType() == Type::Reorder) {auto nextNode = node->getChildEdgeAt(0)->getChild();auto* n = dynamic_cast<Reorder*>(node.get());- if (n == nullptr) {- OPENVINO_THROW("Cannot get reorder layer ", node->getName());- }+ OPENVINO_ASSERT(n, "Cannot get reorder layer ", node->getName());auto* nn = dynamic_cast<Reorder*>(nextNode.get());- if (nn == nullptr) {- OPENVINO_THROW("Cannot get reorder layer ", nextNode->getName());- }-+ OPENVINO_ASSERT(nn, "Cannot get reorder layer ", nextNode->getName());NodePtr p = n->getParentEdgeAt(0)->getParent();NodePtr c = nn->getChildEdgeAt(0)->getChild();@@ -2325,10 +2276,7 @@ void GraphOptimizer::DropDoubleReorders(Graph& graph) {edge = cur;}}- if (!edge) {- OPENVINO_THROW("Inappropriate graph processing");- }-+ OPENVINO_ASSERT(edge, "Inappropriate graph processing");std::string layerName = edge->getParent()->getName() + "_ScaleReorder_" + edge->getChild()->getName();graph.InsertReorder(edge, layerName, n->getInput(), nn->getOutput(), false);graph.RemoveEdge(edge);@@ -2350,15 +2298,9 @@ void GraphOptimizer::FuseClampAndFakeQuantize(Graph& graph) {auto fuseClampAndFakeQuantizeNodes = [](const NodePtr& parent, const NodePtr& child) {auto* eltwiseNode = dynamic_cast<Eltwise*>(parent.get());- if (eltwiseNode == nullptr) {- OPENVINO_THROW("Cannot cast ", parent->getName(), " to Eltwise node");- }-+ OPENVINO_ASSERT(eltwiseNode, "Cannot cast ", parent->getName(), " to Eltwise node");auto* fakeQuantizeNode = dynamic_cast<FakeQuantize*>(child.get());- if (fakeQuantizeNode == nullptr) {- OPENVINO_THROW("Cannot cast ", child->getName(), " to FakeQuantize node");- }-+ OPENVINO_ASSERT(fakeQuantizeNode, "Cannot cast ", child->getName(), " to FakeQuantize node");const std::vector<float>& cropLowData = fakeQuantizeNode->getCropLow();const std::vector<float>& cropHighData = fakeQuantizeNode->getCropHigh();@@ -2441,17 +2383,12 @@ void GraphOptimizer::FusePerformedAsScaleShiftAndFakeQuantize(Graph& graph) {auto fuseScaleShiftAndFakeQuantizeNodes = [getNonConstPort](const NodePtr& parent, const NodePtr& child) {auto fakeQuantizeNode = std::dynamic_pointer_cast<FakeQuantize>(child);- if (fakeQuantizeNode == nullptr) {- OPENVINO_THROW("Cannot cast ", child->getName(), " to FakeQuantize node");- }+ OPENVINO_ASSERT(fakeQuantizeNode, "Cannot cast ", child->getName(), " to FakeQuantize node");std::vector<float> scalesBuffer;std::vector<float> shiftsBuffer;auto parentEltwise = std::dynamic_pointer_cast<Eltwise>(parent);- if (!parentEltwise) {- OPENVINO_THROW("Cannot cast ", parent->getName(), " to Eltwise node");- }-+ OPENVINO_ASSERT(parentEltwise, "Cannot cast ", parent->getName(), " to Eltwise node");const NodePtr eltwiseInput = parentEltwise->getParentEdgeAt(getNonConstPort(parent))->getParent();std::tie(scalesBuffer, shiftsBuffer) = parentEltwise->getScalesAndShifts(eltwiseInput.get());diff --git a/src/plugins/intel_cpu/src/infer_request.cpp b/src/plugins/intel_cpu/src/infer_request.cppindex 9742b22b1b4..a7b19da3f7a 100644--- a/src/plugins/intel_cpu/src/infer_request.cpp+++ b/src/plugins/intel_cpu/src/infer_request.cpp@@ -84,7 +84,7 @@ void SyncInferRequest::create_infer_request() {void SyncInferRequest::redefine_memory_for_input_nodes(Graph& graph) {for (const auto& input_port : m_input_ports_map) {auto inputNode = graph.getInputNodeByIndex(input_port.first);- OPENVINO_ASSERT(inputNode, "CPU execution graph doesn't contain output node with index: ", input_port.first);+ OPENVINO_ASSERT(inputNode, "CPU execution graph doesn't contain input node with index: ", input_port.first);if (inputNode->isDynamicNode()) {const auto& tensor = get_tensor_ptr(input_port.second);inputNode->redefineOutputMemory({tensor->get_shape()});@@ -153,9 +153,7 @@ void SyncInferRequest::infer() {std::vector<ov::ProfilingInfo> SyncInferRequest::get_profiling_info() const {auto&& graph = m_compiled_model.graph();- if (!graph.IsReady()) {- OPENVINO_THROW("Graph is not ready!");- }+ OPENVINO_ASSERT(graph.IsReady(), "Graph is not ready!");std::vector<ov::ProfilingInfo> perfMap;graph.GetPerfData(perfMap);return perfMap;@@ -163,7 +161,7 @@ std::vector<ov::ProfilingInfo> SyncInferRequest::get_profiling_info() const {static inline void change_edge_ptr(const EdgePtr& edge, ov::SoPtr<ov::ITensor>& tensor) {auto mem = edge->getMemoryPtr();- OPENVINO_ASSERT(mem != nullptr, "Edge with name '", *edge, "' doesn't have allocated memory object.");+ OPENVINO_ASSERT(mem, "Edge with name '", *edge, "' doesn't have allocated memory object.");if (tensor->get_element_type() == element::string) {auto memBlock = dynamic_cast<StringMemory*>(mem.get())->getStringMemoryBlockPtr();@@ -201,10 +199,7 @@ void SyncInferRequest::change_default_ptr(Graph& graph) {bool canBeInPlace = true;for (const auto& childEdge : childEdges) {auto ce = childEdge.lock();- if (!ce) {- OPENVINO_THROW("Node ", inputNodePtr->getName(), " contains empty child edge");- }-+ OPENVINO_ASSERT(ce, "Node ", inputNodePtr->getName(), " contains empty child edge");const auto& child = ce->getChild();if (child->isConstant()) {@@ -268,10 +263,7 @@ void SyncInferRequest::change_default_ptr(Graph& graph) {const auto& parentEdges = parent->getParentEdges();for (const auto& edge : parentEdges) {auto e = edge.lock();- if (!e) {- OPENVINO_THROW("Node ", parent->getName(), " contains empty parent edge");- }-+ OPENVINO_ASSERT(e, "Node ", parent->getName(), " contains empty parent edge");if (parent_port == parent->inPlaceInputPort(e->getOutputNum())) {parent = e->getParent();parent_port = e->getInputNum();@@ -369,9 +361,7 @@ const ov::Output<const ov::Node>& SyncInferRequest::get_internal_port(const ov::void SyncInferRequest::set_tensor(const ov::Output<const ov::Node>& in_port, const ov::SoPtr<ov::ITensor>& in_tensor) {OV_ITT_SCOPED_TASK(itt::domains::intel_cpu, "set_tensor");- if (!in_tensor) {- OPENVINO_THROW("Failed to set empty tensor for port!");- }+ OPENVINO_ASSERT(in_tensor, "Failed to set empty tensor for port!");auto port = get_internal_port(in_port);auto tensor = in_tensor;@@ -396,25 +386,23 @@ void SyncInferRequest::set_tensor(const ov::Output<const ov::Node>& in_port, conconst auto& shape = port.get_partial_shape();const bool isDynamic = shape.is_dynamic();- if (!shape.compatible(ov::PartialShape(tensor->get_shape()))) {- OPENVINO_THROW("Can't set the input tensor with index: ",- input_index,- ", because the model input (shape=",- shape,- ") and the tensor (shape=",- vec2str(tensor->get_shape()),- ") are incompatible");- }-- if (!isDynamic && ov::shape_size(shape.to_shape()) != tensor->get_size()) {- OPENVINO_THROW("Can't set input tensor with index: ",- input_index,- ", because the model input size = ",- ov::shape_size(shape.to_shape()),- " and the tensor size = ",- tensor->get_size(),- " are different.");- }+ OPENVINO_ASSERT(shape.compatible(ov::PartialShape(tensor->get_shape())),+ "Can't set the input tensor with index: ",+ input_index,+ ", because the model input (shape=",+ shape,+ ") and the tensor (shape=",+ vec2str(tensor->get_shape()),+ ") are incompatible");++ OPENVINO_ASSERT(isDynamic || ov::shape_size(shape.to_shape()) == tensor->get_size(),+ "Can't set input tensor with index: ",+ input_index,+ ", because the model input size = ",+ ov::shape_size(shape.to_shape()),+ " and the tensor size = ",+ tensor->get_size(),+ " are different.");auto&& graph = m_compiled_model.graph();@@ -438,35 +426,32 @@ void SyncInferRequest::set_tensor(const ov::Output<const ov::Node>& in_port, con} else {auto output_index = port_found.idx;const auto netOutPrc = port.get_element_type();- if (netOutPrc != tensor->get_element_type()) {- OPENVINO_THROW("ParameterMismatch: Failed to set tensor for output with precision: ",- tensor->get_element_type(),- ", if model output tensor precision is: ",- netOutPrc);- }+ OPENVINO_ASSERT(netOutPrc == tensor->get_element_type(),+ "ParameterMismatch: Failed to set tensor for output with precision: ",+ tensor->get_element_type(),+ ", if model output tensor precision is: ",+ netOutPrc);const auto& shape = port.get_partial_shape();const bool isDynamic = shape.is_dynamic();- if (!shape.compatible(ov::PartialShape(tensor->get_shape())) && tensor->get_size() != 0) {- OPENVINO_THROW("Can't set the output tensor with index: ",- output_index,- ", because the model output tensor (shape=",- shape,- ") and the current tensor (shape=",- vec2str(tensor->get_shape()),- ") are incompatible");- }-- if (!isDynamic && ov::shape_size(shape.to_shape()) != tensor->get_size()) {- OPENVINO_THROW("Can't set the output tensor with index: ",- output_index,- ", because the model output size = ",- ov::shape_size(shape.to_shape()),- " and the currernt tensor size = ",- tensor->get_size(),- " are different.");- }+ OPENVINO_ASSERT(shape.compatible(ov::PartialShape(tensor->get_shape())) || tensor->get_size() == 0,+ "Can't set the output tensor with index: ",+ output_index,+ ", because the model output tensor (shape=",+ shape,+ ") and the current tensor (shape=",+ vec2str(tensor->get_shape()),+ ") are incompatible");++ OPENVINO_ASSERT(isDynamic || ov::shape_size(shape.to_shape()) == tensor->get_size(),+ "Can't set the output tensor with index: ",+ output_index,+ ", because the model output size = ",+ ov::shape_size(shape.to_shape()),+ " and the currernt tensor size = ",+ tensor->get_size(),+ " are different.");auto&& graph = m_compiled_model.graph();@@ -612,9 +597,7 @@ void SyncInferRequest::init_tensor(const std::size_t& port_index, const ov::ISyn}}}- if (!tensor) {- OPENVINO_THROW("Cannot find tensor with index: ", port_index);- }+ OPENVINO_ASSERT(tensor, "Cannot find tensor with index: ", port_index);}void SyncInferRequest::push_input_data(Graph& graph) {diff --git a/src/plugins/intel_cpu/src/memory_desc/cpu_blocked_memory_desc.cpp b/src/plugins/intel_cpu/src/memory_desc/cpu_blocked_memory_desc.cppindex 705a0e37d83..a68ed4a4405 100644--- a/src/plugins/intel_cpu/src/memory_desc/cpu_blocked_memory_desc.cpp+++ b/src/plugins/intel_cpu/src/memory_desc/cpu_blocked_memory_desc.cpp@@ -92,12 +92,11 @@ CpuBlockedMemoryDesc::CpuBlockedMemoryDesc(ov::element::Type prc,this->strides = strides;}- if (!everyone_is(this->order.size(),- this->blockedDims.size(),- this->offsetPaddingToData.size(),- this->strides.size())) {- OPENVINO_THROW("Order, blocked dims, offset padding to data and strides must have equals size");- }+ OPENVINO_ASSERT(everyone_is(this->order.size(),+ this->blockedDims.size(),+ this->offsetPaddingToData.size(),+ this->strides.size()),+ "Order, blocked dims, offset padding to data and strides must have equals size");}bool CpuBlockedMemoryDesc::isDefinedImp() const {@@ -204,9 +203,8 @@ size_t CpuBlockedMemoryDesc::getOffset(const VectorDims& v) const {VectorDims off_v = v;size_t n_blocked_dims = order.size();- if (blockedDims.size() != n_blocked_dims || strides.size() != n_blocked_dims) {- OPENVINO_THROW("Cannot calculate offset. Incorrect primitive descriptor!");- }+ OPENVINO_ASSERT(blockedDims.size() == n_blocked_dims && strides.size() == n_blocked_dims,+ "Cannot calculate offset. Incorrect primitive descriptor!");VectorDims blockedShift(n_blocked_dims);for (size_t i = 1; i <= n_blocked_dims; i++) {blockedShift[n_blocked_dims - i] = off_v[order[n_blocked_dims - i]] % blockedDims[n_blocked_dims - i];diff --git a/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc.h b/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc.hindex a5b038f23a8..7f6b1bdc329 100644--- a/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc.h+++ b/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc.h@@ -89,19 +89,19 @@ public:*/MemoryDescPtr cloneWithNewDims(const VectorDims& dims, bool relaxedCheck = false) const {if (relaxedCheck) {- if (getShape().getRank() != dims.size()) {- OPENVINO_THROW("ParameterMismatch: Can not clone with new dims, ranks mistmatch. Descriptor's rank: ",- getShape().getRank(),- " is incompatible with provided rank of dimensions: ",- dims.size(),- ".");- }- } else if (!getShape().isCompatible(dims)) {- OPENVINO_THROW("ParameterMismatch: Can not clone with new dims. Descriptor's shape: ",- getShape().toString(),- " is incompatible with provided dimensions: ",- dims2str(dims),- ".");+ OPENVINO_ASSERT(getShape().getRank() == dims.size(),+ "ParameterMismatch: Can not clone with new dims, ranks mistmatch. Descriptor's rank: ",+ getShape().getRank(),+ " is incompatible with provided rank of dimensions: ",+ dims.size(),+ ".");+ } else {+ OPENVINO_ASSERT(getShape().isCompatible(dims),+ "ParameterMismatch: Can not clone with new dims. Descriptor's shape: ",+ getShape().toString(),+ " is incompatible with provided dimensions: ",+ dims2str(dims),+ ".");}return cloneWithNewDimsImp(dims);@@ -151,9 +151,7 @@ public:std::enable_if_t<std::is_base_of_v<MemoryDesc, T>, int> = 0>T* as() {T* casted = dynamic_cast<T*>(this);- if (!casted) {- OPENVINO_THROW("Cannot dynamically cast MemoryDesc");- }+ OPENVINO_ASSERT(casted, "Cannot dynamically cast MemoryDesc");return casted;}@@ -162,9 +160,7 @@ public:std::enable_if_t<std::is_base_of_v<MemoryDesc, T>, int> = 0>const T* as() const {const T* casted = dynamic_cast<const T*>(this);- if (!casted) {- OPENVINO_THROW("Cannot dynamically cast MemoryDesc");- }+ OPENVINO_ASSERT(casted, "Cannot dynamically cast MemoryDesc");return casted;}diff --git a/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.cpp b/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.cppindex 215b469d30c..03ff0e41cbe 100644--- a/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.cpp+++ b/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.cpp@@ -141,9 +141,8 @@ Shape MemoryDescUtils::makeDummyShape(const Shape& shape, Dim dummyVal) {}Shape MemoryDescUtils::makeDummyShape(const Shape& shape, const VectorDims& dummyVals) {- if (shape.getRank() != dummyVals.size()) {- OPENVINO_THROW("makeDummyShape(): dummyVals vector size and shape ranks mismatch");- }+ OPENVINO_ASSERT(shape.getRank() == dummyVals.size(),+ "makeDummyShape(): dummyVals vector size and shape ranks mismatch");const auto& minDims = shape.getMinDims();const auto& maxDims = shape.getMaxDims();const auto& dims = shape.getDims();diff --git a/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp b/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cppindex 142602da46a..bd3a410ebd4 100644--- a/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp+++ b/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp@@ -115,19 +115,16 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(ov::element::Type prc,return;}- if (order.size() != blockedDims.size()) {- OPENVINO_THROW("Can not construct DnnlBlockedMemoryDesc, order and blocked dims must have equals size");- }+ OPENVINO_ASSERT(order.size() == blockedDims.size(),+ "Can not construct DnnlBlockedMemoryDesc, order and blocked dims must have equals size");- if (!offsetPaddingToData.empty() && offsetPaddingToData.size() != order.size()) {- OPENVINO_THROW("Can not construct DnnlBlockedMemoryDesc, offsetPaddingToData must have equal size with order "- "and blocked dims");- }+ OPENVINO_ASSERT(offsetPaddingToData.empty() || offsetPaddingToData.size() == order.size(),+ "Can not construct DnnlBlockedMemoryDesc, offsetPaddingToData must have equal size with order "+ "and blocked dims");- if (!strides.empty() && strides.size() != order.size()) {- OPENVINO_THROW(- "Can not construct DnnlBlockedMemoryDesc, strides must have equal size with order and blocked dims");- }+ OPENVINO_ASSERT(+ strides.empty() || strides.size() == order.size(),+ "Can not construct DnnlBlockedMemoryDesc, strides must have equal size with order and blocked dims");if (std::any_of(order.begin(), order.end(), [](size_t val) {return val == Shape::UNDEFINED_DIM;@@ -151,9 +148,9 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(ov::element::Type prc,auto lastIter = order.begin() + outer_ndims;for (size_t dim = 0; dim < outer_ndims; dim++) {- if (std::find(order.begin(), lastIter, dim) == lastIter) {- OPENVINO_THROW("Can not construct DnnlBlockedMemoryDesc because of incorrect order: ", vec2str(order));- }+ OPENVINO_ASSERT(std::find(order.begin(), lastIter, dim) != lastIter,+ "Can not construct DnnlBlockedMemoryDesc because of incorrect order: ",+ vec2str(order));}size_t inner_ndims = order.size() - dims.size();@@ -173,9 +170,9 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(ov::element::Type prc,// TODO: That's strong constrains and can be mitigated. IE::TensorDesc allow to transpose blocked dims// and may be we can achieve correct "descending strides" form which allow conversion.- if (!is_descending_strides) {- OPENVINO_THROW("Can not construct DnnlBlockedMemoryDesc from strides: ", vec2str(strides));- }+ OPENVINO_ASSERT(is_descending_strides,+ "Can not construct DnnlBlockedMemoryDesc from strides: ",+ vec2str(strides));}if (!strides.empty() && !emptyDesc && std::none_of(strides.begin(), strides.end(), [](size_t x) {@@ -186,11 +183,10 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(ov::element::Type prc,inner_block_are_dense &= (strides[i] == strides[i + 1] * blockedDims[i + 1]);}- if (!inner_block_are_dense) {- OPENVINO_THROW("Can not construct DnnlBlockedMemoryDesc from strides: ",- vec2str(strides),- " inner blocks are not dense.");- }+ OPENVINO_ASSERT(inner_block_are_dense,+ "Can not construct DnnlBlockedMemoryDesc from strides: ",+ vec2str(strides),+ " inner blocks are not dense.");}// Fill general memory desc fields@@ -207,10 +203,9 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(ov::element::Type prc,return pad == 0;});- if (!inner_pad_offsets_is_zero) {- OPENVINO_THROW("Can not construct DnnlBlockedMemoryDesc, inner pad offsets is not zero: ",- vec2str(offsetPaddingToData));- }+ OPENVINO_ASSERT(inner_pad_offsets_is_zero,+ "Can not construct DnnlBlockedMemoryDesc, inner pad offsets is not zero: ",+ vec2str(offsetPaddingToData));auto dnnlPaddedOffsets = DnnlExtensionUtils::convertToDnnlDims(offsetPaddingToData);std::copy(dnnlPaddedOffsets.begin(), dnnlPaddedOffsets.begin() + outer_ndims, desc.get()->padded_offsets);} else {@@ -255,10 +250,8 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(const Shape& shape,dnnl::memory::format_tag format): MemoryDesc(shape, DnnlBlocked) {using namespace dnnl;- if (format == memory::format_tag::any || format == memory::format_tag::undef) {- OPENVINO_THROW("Unexpected: Can't create dnnl::desc with any or undef format");- }-+ OPENVINO_ASSERT(format != memory::format_tag::any && format != memory::format_tag::undef,+ "Unexpected: Can't create dnnl::desc with any or undef format");const auto& dims = shape.getDims();if (format == memory::format_tag::x && shape.getRank() == 0) {desc = dnnl::memory::desc(dnnl::memory::dims(1, 1), dataType, format);@@ -344,9 +337,8 @@ static VectorDims extractOrder(const dnnl::memory::desc& desc) {const auto dims = desc.get_dims();dnnl::impl::memory_desc_wrapper descWrapped(desc.get());- if (descWrapped.has_runtime_dims_or_strides()) {- OPENVINO_THROW("Unexpected: Cannot calculate order from undefined dims or strides");- }+ OPENVINO_ASSERT(!descWrapped.has_runtime_dims_or_strides(),+ "Unexpected: Cannot calculate order from undefined dims or strides");const auto& blk_desc = descWrapped.blocking_desc();@@ -385,14 +377,12 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(const_dnnl_memory_desc_t cdesc): MemoryDesc(DnnlExtensionUtils::convertToVectorDims(cdesc->dims, cdesc->ndims), DnnlBlocked) {desc = dnnl::memory::desc(DnnlExtensionUtils::clone_desc(cdesc));- if (desc.get_format_kind() == dnnl::memory::format_kind::any) {- OPENVINO_THROW("Unexpected: Memory format any is prohibited!");- }+ OPENVINO_ASSERT(desc.get_format_kind() != dnnl::memory::format_kind::any,+ "Unexpected: Memory format any is prohibited!");dnnl::impl::memory_desc_wrapper descWrapped(desc.get());- if (!descWrapped.is_blocking_desc()) {- OPENVINO_THROW("Unexpected: Can't create DnnlBlockedMemoryDesc from not blocking desc");- }+ OPENVINO_ASSERT(descWrapped.is_blocking_desc(),+ "Unexpected: Can't create DnnlBlockedMemoryDesc from not blocking desc");order = extractOrder(desc);@@ -485,9 +475,9 @@ static dnnl::memory::desc cloneDescWithNewDims(const dnnl::memory::desc& desc,auto innerIdxs = clonedDesc.get_inner_idxs();auto retCode = dnnl::impl::fill_blocked(*clonedDesc.get(), perm, innerBlks, innerIdxs);- if (retCode != dnnl::impl::status::success) {- OPENVINO_THROW("Can not clone DnnlBlockedMemoryDesc with dims: ", dims2str(dims));- }+ OPENVINO_ASSERT(retCode == dnnl::impl::status::success,+ "Can not clone DnnlBlockedMemoryDesc with dims: ",+ dims2str(dims));// dnnl::impl::fill_blocked always set offset0 to 0// so we need to restore actual valueclonedDesc.get()->offset0 = offsetPadding;@@ -496,11 +486,12 @@ static dnnl::memory::desc cloneDescWithNewDims(const dnnl::memory::desc& desc,}MemoryDescPtr DnnlBlockedMemoryDesc::cloneWithNewDimsImp(const VectorDims& dims) const {- if (std::any_of(dims.begin(), dims.end(), [](size_t x) {- return Shape::UNDEFINED_DIM == x;- })) {- OPENVINO_THROW("Can't clone desc if new dims are undefined");- }+ OPENVINO_ASSERT(std::none_of(dims.begin(),+ dims.end(),+ [](size_t x) {+ return Shape::UNDEFINED_DIM == x;+ }),+ "Can't clone desc if new dims are undefined");// TODO [DS]: add stride recalculation for strided blobsfor (int i = strides.size() - 2; i >= 0; i--) {@@ -523,10 +514,9 @@ bool DnnlBlockedMemoryDesc::isSame(dnnl::memory::format_tag fmt) const {return false;}- if (desc.get_format_kind() != dnnl::memory::format_kind::blocked ||- refDesc.get_format_kind() != dnnl::memory::format_kind::blocked) {- OPENVINO_THROW("DnnlMemoryDesc::isSame is not implemented for non blocked memory format");- }+ OPENVINO_ASSERT(desc.get_format_kind() == dnnl::memory::format_kind::blocked &&+ refDesc.get_format_kind() == dnnl::memory::format_kind::blocked,+ "DnnlMemoryDesc::isSame is not implemented for non blocked memory format");auto actualBlkDesc = desc.get()->format_desc.blocking;auto refBlkDesc = refDesc.get()->format_desc.blocking;@@ -719,9 +709,7 @@ MemoryDescPtr DnnlBlockedMemoryDesc::cloneWithNewPrecision(const ov::element::Tyvoid DnnlBlockedMemoryDesc::recomputeDefaultStrides() {const auto& rank = getShape().getRank();- if (order.size() != blockedDims.size()) {- OPENVINO_THROW("Can't recompute stride: order size != blocked dims size");- }+ OPENVINO_ASSERT(order.size() == blockedDims.size(), "Can't recompute stride: order size != blocked dims size");auto& oneDnnStrides = desc.get()->format_desc.blocking.strides;if (getShape().hasZeroDims()) {@@ -745,22 +733,19 @@ void DnnlBlockedMemoryDesc::recomputeDefaultStrides() {DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(const dnnl::memory::desc& mdesc, const Shape& shape): MemoryDesc(shape, DnnlBlocked) {- if (mdesc.get_format_kind() == dnnl::memory::format_kind::any) {- OPENVINO_THROW("Unexpected: Memory format any is prohibited!");- }+ OPENVINO_ASSERT(mdesc.get_format_kind() != dnnl::memory::format_kind::any,+ "Unexpected: Memory format any is prohibited!");dnnl::impl::memory_desc_wrapper descWrapped(mdesc.get());- if (!descWrapped.is_blocking_desc()) {- OPENVINO_THROW("Unexpected: Can't create DnnlBlockedMemoryDesc from not blocking desc");- }-- if (!shape.isCompatible(DnnlExtensionUtils::convertToVectorDims(mdesc.get_dims()))) {- OPENVINO_THROW("ParameterMismatch: Can not create DnnlBlockedMemoryDesc. memory::desc dims: ",- vec2str(mdesc.get_dims()),- " are incompatible with provided shape: ",- shape.toString(),- ".");- }+ OPENVINO_ASSERT(descWrapped.is_blocking_desc(),+ "Unexpected: Can't create DnnlBlockedMemoryDesc from not blocking desc");++ OPENVINO_ASSERT(shape.isCompatible(DnnlExtensionUtils::convertToVectorDims(mdesc.get_dims())),+ "ParameterMismatch: Can not create DnnlBlockedMemoryDesc. memory::desc dims: ",+ vec2str(mdesc.get_dims()),+ " are incompatible with provided shape: ",+ shape.toString(),+ ".");order = extractOrder(mdesc);diff --git a/src/plugins/intel_cpu/src/memory_desc/dnnl_memory_desc.cpp b/src/plugins/intel_cpu/src/memory_desc/dnnl_memory_desc.cppindex 183f4ec4c5e..380fa7e1f20 100644--- a/src/plugins/intel_cpu/src/memory_desc/dnnl_memory_desc.cpp+++ b/src/plugins/intel_cpu/src/memory_desc/dnnl_memory_desc.cpp@@ -26,9 +26,7 @@ DnnlMemoryDesc::DnnlMemoryDesc(const dnnl::memory::desc& desc) : DnnlMemoryDesc(DnnlMemoryDesc::DnnlMemoryDesc(const_dnnl_memory_desc_t cdesc): MemoryDesc(Shape(DnnlExtensionUtils::convertToVectorDims(cdesc->dims, cdesc->ndims)), Dnnl),desc(DnnlExtensionUtils::clone_desc(cdesc)) {- if (getFormatKind() == dnnl::memory::format_kind::any) {- OPENVINO_THROW("Unexpected: Memory format any is prohibited!");- }+ OPENVINO_ASSERT(getFormatKind() != dnnl::memory::format_kind::any, "Unexpected: Memory format any is prohibited!");}ov::element::Type DnnlMemoryDesc::getPrecision() const {@@ -86,9 +84,7 @@ std::string DnnlMemoryDesc::serializeFormat() const {}size_t DnnlMemoryDesc::getMaxMemSize() const {- if (shape.isDynamic()) {- OPENVINO_THROW("Can't compute max mem size for DnnlMemoryDesc with dynamic shape");- }+ OPENVINO_ASSERT(!shape.isDynamic(), "Can't compute max mem size for DnnlMemoryDesc with dynamic shape");return getCurrentMemSize();}diff --git a/src/plugins/intel_cpu/src/node.cpp b/src/plugins/intel_cpu/src/node.cppindex 941449be0f1..c60d112e4b0 100644--- a/src/plugins/intel_cpu/src/node.cpp+++ b/src/plugins/intel_cpu/src/node.cpp@@ -79,12 +79,11 @@ Node::Node(const std::shared_ptr<ov::Node>& op, GraphContext::CPtr ctx, const Shprofiling(op->get_friendly_name()) {for (size_t i = 0; i < op->get_input_size(); i++) {const auto& shape = op->get_input_partial_shape(i);- if (shape.rank().is_dynamic()) {- OPENVINO_THROW("Unexpected: CPU plug-in doesn't support ",- getTypeStr(),- " operation with dynamic rank. Operation name: ",- getName());- }+ OPENVINO_ASSERT(!shape.rank().is_dynamic(),+ "Unexpected: CPU plug-in doesn't support ",+ getTypeStr(),+ " operation with dynamic rank. Operation name: ",+ getName());bool isScalar = shape.rank().get_length() == 0;inputShapes.emplace_back(isScalar ? ov::PartialShape{1} : shape);@@ -94,17 +93,19 @@ Node::Node(const std::shared_ptr<ov::Node>& op, GraphContext::CPtr ctx, const ShparentEdges.reserve(inputShapes.size());if (typeStr != "Result" && typeStr != "Assign") {- if (op->get_output_size() == 0) {- OPENVINO_THROW("Node with type '", typeStr, "' and name '", name, "' does not have any outputs.");- }+ OPENVINO_ASSERT(op->get_output_size() != 0,+ "Node with type '",+ typeStr,+ "' and name '",+ name,+ "' does not have any outputs.");for (size_t i = 0; i < op->get_output_size(); i++) {const auto& shape = op->get_output_partial_shape(i);- if (shape.rank().is_dynamic()) {- OPENVINO_THROW("Unexpected: CPU plug-in doesn't support ",- getTypeStr(),- " operation with dynamic rank. Operation name: ",- getName());- }+ OPENVINO_ASSERT(!shape.rank().is_dynamic(),+ "Unexpected: CPU plug-in doesn't support ",+ getTypeStr(),+ " operation with dynamic rank. Operation name: ",+ getName());bool isScalar = shape.rank().get_length() == 0;outputShapes.emplace_back(isScalar ? ov::PartialShape{1} : shape);@@ -144,9 +145,11 @@ Node::Node(const std::shared_ptr<ov::Node>& op, GraphContext::CPtr ctx, const Shcontinue;}customImplPriorities.push_back(parse_impl_name(str));- if (customImplPriorities.back() == impl_desc_type::unknown && str != "cpu:unknown") {- OPENVINO_THROW("Unsupported CPU implementation ", str, " for node ", getName());- }+ OPENVINO_ASSERT(customImplPriorities.back() != impl_desc_type::unknown || str == "cpu:unknown",+ "Unsupported CPU implementation ",+ str,+ " for node ",+ getName());}const auto& defaultImplPriorities = getDefaultImplPriority();customImplPriorities.insert(customImplPriorities.end(),@@ -270,18 +273,16 @@ void Node::selectPreferPrimitiveDescriptor(const std::vector<impl_desc_type>& print equalsLocalFormatCount = 0;const size_t descInConfSize = supportedPrimitiveDesc.getConfig().inConfs.size();- if (descInConfSize > getParentEdges().size()) {- OPENVINO_THROW(getName(),- " Desc ",- i,- " with type: ",- supportedType,- " has more input ports than node: ",- descInConfSize,- " vs ",- getParentEdges().size());- continue;- }+ OPENVINO_ASSERT(descInConfSize <= getParentEdges().size(),+ getName(),+ " Desc ",+ i,+ " with type: ",+ supportedType,+ " has more input ports than node: ",+ descInConfSize,+ " vs ",+ getParentEdges().size());for (size_t j = 0; j < descInConfSize; j++) {auto parentEdge = getParentEdgeAt(j);@@ -440,18 +441,16 @@ void Node::selectPreferPrimitiveDescriptorWithShape(const std::vector<impl_desc_const size_t descInConfSize = supportedPrimitiveDesc.getConfig().inConfs.size();- if (descInConfSize > getParentEdges().size()) {- OPENVINO_THROW(getName(),- " Desc ",- i,- " with type: ",- supportedType,- " has more input ports than node: ",- descInConfSize,- " vs ",- getParentEdges().size());- continue;- }+ OPENVINO_ASSERT(descInConfSize <= getParentEdges().size(),+ getName(),+ " Desc ",+ i,+ " with type: ",+ supportedType,+ " has more input ports than node: ",+ descInConfSize,+ " vs ",+ getParentEdges().size());auto estimate = estimateReorderOverhead(supportedPrimitiveDesc, i);@@ -513,9 +512,7 @@ bool Node::canBeInPlace() const {void Node::resolveInPlaceEdges(Edge::LOOK look) {const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor();- if (!selected_pd) {- OPENVINO_THROW("Cannot find selected primitive descriptor for node: ", getName());- }+ OPENVINO_ASSERT(selected_pd, "Cannot find selected primitive descriptor for node: ", getName());if (look & Edge::LOOK_DOWN) {for (size_t i = 0; i < getParentEdges().size() && i < selected_pd->getConfig().inConfs.size(); i++) {auto inplaceOutIndx = selected_pd->getConfig().inConfs[i].inPlace();@@ -691,42 +688,31 @@ std::string Node::getPrimitiveDescriptorType() const {}EdgePtr Node::getParentEdgeAt(size_t idx) const {- if (idx >= parentEdges.size()) {- OPENVINO_THROW("Node ", getName(), " contains less parent edges than ", idx);- }+ OPENVINO_ASSERT(idx < parentEdges.size(), "Node ", getName(), " contains less parent edges than ", idx);auto parentEdgePtr = parentEdges[idx].lock();- if (!parentEdgePtr) {- OPENVINO_THROW("Node ", getName(), " contains empty parent edge for index ", idx);- }+ OPENVINO_ASSERT(parentEdgePtr, "Node ", getName(), " contains empty parent edge for index ", idx);return parentEdgePtr;}EdgePtr Node::getChildEdgeAt(size_t idx) const {- if (idx >= childEdges.size()) {- OPENVINO_THROW("Node ", getName(), " contains less child edges than ", idx);- }+ OPENVINO_ASSERT(idx < childEdges.size(), "Node ", getName(), " contains less child edges than ", idx);auto childEdgePtr = childEdges[idx].lock();- if (!childEdgePtr) {- OPENVINO_THROW("Node ", getName(), " contains empty child edge for index ", idx);- }+ OPENVINO_ASSERT(childEdgePtr, "Node ", getName(), " contains empty child edge for index ", idx);return childEdgePtr;}std::vector<EdgePtr> Node::getChildEdgesAtPort(int inputNum) const {- if (inputNum < 0) {- OPENVINO_THROW("Node ", getName(), ". negative input number is not supported ", inputNum);- }-- if (static_cast<size_t>(inputNum) >= outputShapes.size()) {- OPENVINO_THROW("Node ", getName(), " contains less output ports than ", inputNum);- }+ OPENVINO_ASSERT(inputNum >= 0, "Node ", getName(), ". negative input number is not supported ", inputNum);+ OPENVINO_ASSERT(static_cast<size_t>(inputNum) < outputShapes.size(),+ "Node ",+ getName(),+ " contains less output ports than ",+ inputNum);std::vector<EdgePtr> res;for (const auto& edge_w : childEdges) {auto edge = edge_w.lock();- if (!edge) {- OPENVINO_THROW("Node ", getName(), " contains dead weak ptr");- }+ OPENVINO_ASSERT(edge, "Node ", getName(), " contains dead weak ptr");if (edge->getInputNum() == inputNum) {res.emplace_back(std::move(edge));}@@ -802,7 +788,7 @@ void Node::updateShapes() {}}} catch (const std::exception& exp) {- THROW_CPU_NODE_ERR(exp.what());+ CPU_NODE_THROW(exp.what());}}@@ -830,7 +816,7 @@ void Node::updateDynamicParams() {}}} catch (const std::exception& e) {- THROW_CPU_NODE_ERR(e.what());+ CPU_NODE_THROW(e.what());}}@@ -869,9 +855,9 @@ bool Node::outputShapeDataDependency() const {}void Node::redefineOutputMemory(const std::vector<VectorDims>& newOutputShapes) {- if (newOutputShapes.size() != outputShapes.size()) {- OPENVINO_THROW("Number shapes mismatch with real outputs number for node with name: ", getName());- }+ OPENVINO_ASSERT(newOutputShapes.size() == outputShapes.size(),+ "Number shapes mismatch with real outputs number for node with name: ",+ getName());for (size_t i = 0LU; i < outputShapes.size(); i++) {redefineOutputMemory(i, newOutputShapes[i]);}@@ -991,10 +977,9 @@ void Node::filterSupportedPrimitiveDescriptors() {auto isNotSuitableDesc = [&](const NodeDesc& desc) {const auto& config = desc.getConfig();- if (memoryFormatFilter.input.size() > config.inConfs.size() ||- memoryFormatFilter.output.size() > config.outConfs.size()) {- OPENVINO_THROW("Incorrect number of input or output memory formats");- }+ OPENVINO_ASSERT(memoryFormatFilter.input.size() <= config.inConfs.size() &&+ memoryFormatFilter.output.size() <= config.outConfs.size(),+ "Incorrect number of input or output memory formats");for (size_t i = 0; i < memoryFormatFilter.input.size(); i++) {if (!areCompatible(*config.inConfs[i].getMemDesc(), memoryFormatFilter.input[i])) {@@ -1047,15 +1032,21 @@ void Node::initDescriptor(const NodeConfig& config) {}for (size_t i = 0; i < selectedConfig.inConfs.size(); i++) {- if (!selectedConfig.inConfs[i].getPortDesc()->isCompatible(*config.inConfs[i].getPortDesc())) {- OPENVINO_THROW("Incorrect descriptor for node: ", getName(), " on ", i, " intput port");- }+ OPENVINO_ASSERT(selectedConfig.inConfs[i].getPortDesc()->isCompatible(*config.inConfs[i].getPortDesc()),+ "Incorrect descriptor for node: ",+ getName(),+ " on ",+ i,+ " intput port");}for (size_t i = 0; i < selectedConfig.outConfs.size(); i++) {- if (!selectedConfig.outConfs[i].getPortDesc()->isCompatible(*config.outConfs[i].getPortDesc())) {- OPENVINO_THROW("Incorrect descriptor for node: ", getName(), " on ", i, " output port");- }+ OPENVINO_ASSERT(selectedConfig.outConfs[i].getPortDesc()->isCompatible(*config.outConfs[i].getPortDesc()),+ "Incorrect descriptor for node: ",+ getName(),+ " on ",+ i,+ " output port");}selectedPD->setConfig(config);@@ -1113,12 +1104,11 @@ void Node::prepareMemory(const DnnlMemoryDescPtr& intDesc, size_t indx) {internalBlobMemory.resize(minSize);}- if (minSize > internalBlobs.size()) {- OPENVINO_THROW("Can't prepare memory for internal blob, requested index: ",- indx,- " is out of bounds of the internalBlobs vector of size ",- internalBlobs.size());- }+ OPENVINO_ASSERT(minSize <= internalBlobs.size(),+ "Can't prepare memory for internal blob, requested index: ",+ indx,+ " is out of bounds of the internalBlobs vector of size ",+ internalBlobs.size());const auto& internalBlob = internalBlobs[indx];@@ -1145,12 +1135,11 @@ void Node::prepareMemory(const DnnlMemoryDescPtr& intDesc, size_t indx) {}void Node::prepareMemory(const std::vector<DnnlMemoryDescPtr>& intDescs) {- if (internalBlobs.size() != intDescs.size()) {- OPENVINO_THROW("Can't prepare memory for internal blob, internal blob and internal descs number do not match ",- internalBlobs.size(),- " vs ",- intDescs.size());- }+ OPENVINO_ASSERT(internalBlobs.size() == intDescs.size(),+ "Can't prepare memory for internal blob, internal blob and internal descs number do not match ",+ internalBlobs.size(),+ " vs ",+ intDescs.size());internalBlobMemory.clear();for (size_t i = 0; i < internalBlobs.size(); i++) {@@ -1169,14 +1158,12 @@ void Node::prepareMemory(dnnl::primitive_desc_iterator& itpd) {}MemoryPtr Node::prepareWeightMemory(DnnlMemoryDescPtr dstWeightDesc, DnnlMemoryDescPtr srcWeightDesc) {- if (!getParentEdgeAt(1)->getParent()->isConstant()) {- OPENVINO_THROW("Weight input is not const for node ", getName(), ".");- }+ OPENVINO_ASSERT(getParentEdgeAt(1)->getParent()->isConstant(),+ "Weight input is not const for node ",+ getName(),+ ".");auto edgeMem = getSrcMemoryAtPort(1);- if (!edgeMem) {- OPENVINO_THROW("Cannot get const weights edgeMem for node ", getName(), ".");- }-+ OPENVINO_ASSERT(edgeMem, "Cannot get const weights edgeMem for node ", getName(), ".");if (!srcWeightDesc) {auto constDnnlMemOutDesc = edgeMem->getDescWithType<DnnlMemoryDesc>();auto weightSrcDesc = constDnnlMemOutDesc->getDnnlDesc();@@ -1248,9 +1235,7 @@ void Node::toNumaNodeImpl(int numaNodeID) {bool Node::isInPlace() const {if (inplace == InPlaceType::Unknown) {const auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- OPENVINO_THROW("Preferable primitive descriptor is not set.");- }+ OPENVINO_ASSERT(selected_pd != nullptr, "Preferable primitive descriptor is not set.");inplace = InPlaceType::NoInPlace;auto config = selected_pd->getConfig();@@ -1404,10 +1389,9 @@ PortDescBasePtr Node::getConsistentInputDesc(const NodeConfig& config, size_t id}auto* parentSelectedPD = getParentEdgeAt(idx)->getParent()->getSelectedPrimitiveDescriptor();- if (!parentSelectedPD) {- OPENVINO_THROW("Cannot get selected primitive descriptor for node: ",- getParentEdgeAt(idx)->getParent()->getName());- }+ OPENVINO_ASSERT(parentSelectedPD,+ "Cannot get selected primitive descriptor for node: ",+ getParentEdgeAt(idx)->getParent()->getName());int num = getParentEdgeAt(idx)->getInputNum();if (num >= 0) {@@ -1448,10 +1432,9 @@ PortDescBasePtr Node::getConsistentOutputDesc(const NodeConfig& config, size_t i}auto* childSelectedPD = getChildEdgeAt(idx)->getChild()->getSelectedPrimitiveDescriptor();- if (!childSelectedPD) {- OPENVINO_THROW("Cannot get selected primitive descriptor for node: ",- getChildEdgeAt(idx)->getChild()->getName());- }+ OPENVINO_ASSERT(childSelectedPD,+ "Cannot get selected primitive descriptor for node: ",+ getChildEdgeAt(idx)->getChild()->getName());int num = getChildEdgeAt(idx)->getOutputNum();if (num >= 0) {@@ -1479,9 +1462,7 @@ void Node::initOptimalPrimitiveDescriptor() {}auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- OPENVINO_THROW("Preferable primitive descriptor is not set for ", getName());- }+ OPENVINO_ASSERT(selected_pd, "Preferable primitive descriptor is not set for ", getName());auto config = selected_pd->getConfig();for (size_t i = 0; i < config.inConfs.size(); i++) {@@ -1659,17 +1640,13 @@ Node* Node::NodesFactory::create(const std::shared_ptr<ov::Node>& op, const Grap}}- if (!newNode) {- std::string errorDetails;- if (!errorMessage.empty()) {- errorDetails = "\nDetails:\n" + errorMessage;- }- OPENVINO_THROW("Unsupported operation of type: ",- op->get_type_name(),- " name: ",- op->get_friendly_name(),- errorDetails);- }+ OPENVINO_ASSERT(newNode,+ "Unsupported operation of type: ",+ op->get_type_name(),+ " name: ",+ op->get_friendly_name(),+ "\nDetails:\n",+ errorMessage);return newNode;}@@ -1683,9 +1660,7 @@ bool Node::canBePerformedAsScaleShift([[maybe_unused]] const Node* parentNode) cfor (size_t i = 0; i < getParentEdges().size(); i++) {Node* node = getParentEdgeAt(i)->getParent().get();- if (node == nullptr) {- OPENVINO_THROW("Cannot get parent node for ", getName(), " on ", i, " port");- }+ OPENVINO_ASSERT(node, "Cannot get parent node for ", getName(), " on ", i, " port");if (node == parentNode) {fusingPort = i;continue;@@ -1713,9 +1688,7 @@ bool Node::canBePerformedAsScaleShift([[maybe_unused]] const Node* parentNode) cconst auto isConvertablePowerStatic = [&]() {if (getAlgorithm() == Algorithm::EltwisePowerStatic) {const auto* const eltwise = dynamic_cast<const Eltwise*>(this);- if (!eltwise) {- OPENVINO_THROW("Cannot cast ", getName(), " to Eltwise");- }+ OPENVINO_ASSERT(eltwise, "Cannot cast ", getName(), " to Eltwise");return eltwise->getAlpha() == 1.0F;}return false;@@ -1746,9 +1719,7 @@ std::pair<std::vector<float>, std::vector<float>> Node::getScalesAndShifts(constconst auto fillValuesFrom = [&](const NodePtr& constInput, std::vector<float>& buffer) {auto* constInputNode = dynamic_cast<node::Input*>(constInput.get());- if (!constInputNode) {- OPENVINO_THROW("Cannot cast ", constInput->getName(), " to Input");- }+ OPENVINO_ASSERT(constInputNode, "Cannot cast ", constInput->getName(), " to Input");auto constBlob = constInputNode->getMemoryPtr();const auto elementsCount = constBlob->getDescWithType<BlockedMemoryDesc>()->getPaddedElementsCount();buffer.resize(elementsCount);@@ -1770,9 +1741,7 @@ std::pair<std::vector<float>, std::vector<float>> Node::getScalesAndShifts(constfillValuesFrom(getParentEdgeAt(2)->getParent(), shifts);} else if (one_of(getAlgorithm(), Algorithm::EltwisePowerStatic)) {const auto* const power = dynamic_cast<const Eltwise*>(this);- if (!power) {- OPENVINO_THROW("Cannot cast ", getName(), " to Eltwise");- }+ OPENVINO_ASSERT(power, "Cannot cast ", getName(), " to Eltwise");scales.push_back(power->getBeta());shifts.push_back(power->getGamma());} else {@@ -1810,9 +1779,7 @@ std::pair<std::vector<float>, std::vector<float>> Node::getScalesAndShifts(const}bool Node::isInputTensorAtPortEmpty(size_t port) const {- if (inputShapes.size() <= port) {- OPENVINO_THROW("Incorrect input port number for node ", getName());- }+ OPENVINO_ASSERT(inputShapes.size() > port, "Incorrect input port number for node ", getName());if (inputShapes[port].hasZeroDims()) {return true;@@ -1828,9 +1795,7 @@ bool Node::isInputTensorAtPortEmpty(size_t port) const {}bool Node::isOutputTensorAtPortEmpty(size_t port) const {- if (outputShapes.size() <= port) {- OPENVINO_THROW("Incorrect output port number for node ", getName());- }+ OPENVINO_ASSERT(outputShapes.size() > port, "Incorrect output port number for node ", getName());if (outputShapes[port].isStatic()) {return outputShapes[port].hasZeroDims();}@@ -1925,9 +1890,7 @@ std::vector<VectorDims> Node::shapeInferGeneric(const std::vector<Shape>& shapes}auto result = shapeInference->infer(input_shapes, input_values);- if (ShapeInferStatus::success != result.status) {- OPENVINO_THROW("Unexpected: Shape inference unexpectedly skipped");- }+ OPENVINO_ASSERT(ShapeInferStatus::success == result.status, "Unexpected: Shape inference unexpectedly skipped");return std::move(result.dims);} catch (const std::exception& exp) {@@ -1958,9 +1921,7 @@ IShapeInfer::Result Node::shapeInfer() const {void Node::updateLastInputDims() {if (lastInputDims.size() != getParentEdges().size()) {- if (!lastInputDims.empty()) {- OPENVINO_THROW("Input dims and parent edges number mismatch!");- }+ OPENVINO_ASSERT(lastInputDims.empty(), "Input dims and parent edges number mismatch!");lastInputDims.resize(getParentEdges().size());}@@ -2071,9 +2032,7 @@ int Node::inPlaceInputPort(int portIdx) const {}const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor();- if (!selected_pd) {- OPENVINO_THROW("Cannot find selected primitive descriptor for node: ", getName());- }+ OPENVINO_ASSERT(selected_pd, "Cannot find selected primitive descriptor for node: ", getName());const auto& conf = selected_pd->getConfig();@@ -2094,10 +2053,7 @@ int Node::inPlaceOutPort(int portIdx) const {}const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor();- if (!selected_pd) {- OPENVINO_THROW("Cannot find selected primitive descriptor for node: ", getName());- }-+ OPENVINO_ASSERT(selected_pd, "Cannot find selected primitive descriptor for node: ", getName());const auto& conf = selected_pd->getConfig();OPENVINO_ASSERT(portIdx >= 0 && portIdx < static_cast<int>(conf.outConfs.size()),diff --git a/src/plugins/intel_cpu/src/node.h b/src/plugins/intel_cpu/src/node.hindex 197d439968a..b26857bc138 100644--- a/src/plugins/intel_cpu/src/node.h+++ b/src/plugins/intel_cpu/src/node.h@@ -44,8 +44,7 @@#include "utils/bit_util.hpp"#include "utils/debug_capabilities.h"-#define THROW_CPU_NODE_ERR(...) \- OPENVINO_THROW("[CPU] ", getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__)+#define CPU_NODE_THROW(...) OPENVINO_THROW("[CPU] ", getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__)#define CPU_NODE_ASSERT(condition, ...) \OPENVINO_ASSERT(condition, getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__)@@ -87,9 +86,7 @@ private:static ov::intel_cpu::BlockedDescCreator::CreatorConstPtr getBlockedDescCreator(ov::intel_cpu::LayoutType blockedDescType) {const auto& creators = ov::intel_cpu::BlockedDescCreator::getCommonCreators();- if (creators.find(blockedDescType) == creators.end()) {- OPENVINO_THROW("Cannot find tensor descriptor creator");- }+ OPENVINO_ASSERT(creators.find(blockedDescType) != creators.end(), "Cannot find tensor descriptor creator");return creators.at(blockedDescType);}};@@ -131,9 +128,7 @@ public:std::enable_if_t<std::is_base_of_v<ExecutorFactoryLegacy, T>, int> = 0>std::shared_ptr<T> getExecutorFactoryAs() {auto casted = std::dynamic_pointer_cast<T>(executorFactory);- if (!casted) {- OPENVINO_THROW("Cannot dynamically cast ExecutorFactory");- }+ OPENVINO_ASSERT(casted, "Cannot dynamically cast ExecutorFactory");return casted;}@@ -387,9 +382,11 @@ public:}}- if (getFusingPort() == -1) {- OPENVINO_THROW("Cannot determine fusing port between nodes: ", parentNode->getName(), " and ", getName());- }+ OPENVINO_ASSERT(getFusingPort() != -1,+ "Cannot determine fusing port between nodes: ",+ parentNode->getName(),+ " and ",+ getName());parentNode->addFusedNode(getParentEdgeAt(getFusingPort())->getChild());parentNode->addOriginalLayer(getOriginalLayers());@@ -613,29 +610,21 @@ public:}ov::element::Type getOriginalInputPrecisionAtPort(size_t port) const {- if (originalInputPrecisions.size() <= port) {- OPENVINO_THROW("Incorrect input port number for node ", getName());- }+ OPENVINO_ASSERT(originalInputPrecisions.size() > port, "Incorrect input port number for node ", getName());return originalInputPrecisions[port];}ov::element::Type getOriginalOutputPrecisionAtPort(size_t port) const {- if (originalOutputPrecisions.size() <= port) {- OPENVINO_THROW("Incorrect output port number for node ", getName());- }+ OPENVINO_ASSERT(originalOutputPrecisions.size() > port, "Incorrect output port number for node ", getName());return originalOutputPrecisions[port];}void setOriginalInputPrecisionAtPort(size_t port, ov::element::Type precision) {- if (originalInputPrecisions.size() <= port) {- OPENVINO_THROW("Incorrect input port number for node ", getName());- }+ OPENVINO_ASSERT(originalInputPrecisions.size() > port, "Incorrect input port number for node ", getName());originalInputPrecisions[port] = precision;}void setOriginalOutputPrecisionAtPort(size_t port, ov::element::Type precision) {- if (originalOutputPrecisions.size() <= port) {- OPENVINO_THROW("Incorrect output port number for node ", getName());- }+ OPENVINO_ASSERT(originalOutputPrecisions.size() > port, "Incorrect output port number for node ", getName());originalOutputPrecisions[port] = precision;}@@ -687,16 +676,12 @@ public:}const Shape& getInputShapeAtPort(size_t port) const {- if (inputShapes.size() <= port) {- OPENVINO_THROW("Incorrect input port number for node ", getName());- }+ OPENVINO_ASSERT(inputShapes.size() > port, "Incorrect input port number for node ", getName());return inputShapes[port];}const Shape& getOutputShapeAtPort(size_t port) const {- if (outputShapes.size() <= port) {- OPENVINO_THROW("Incorrect output port number for node ", getName());- }+ OPENVINO_ASSERT(outputShapes.size() > port, "Incorrect output port number for node ", getName());return outputShapes[port];}diff --git a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cppindex cc7f6bc9586..7036e157562 100644--- a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp+++ b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp@@ -78,25 +78,19 @@ AdaptivePooling::AdaptivePooling(const std::shared_ptr<ov::Node>& op, const Grap}void AdaptivePooling::getSupportedDescriptors() {- if (getParentEdges().size() != 2) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getParentEdges().size());- }- if (getChildEdges().size() < (algorithm == Algorithm::AdaptivePoolingMax ? 2 : 1)) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getChildEdges().size());- }+ CPU_NODE_ASSERT(getParentEdges().size() == 2, "has incorrect number of input edges: ", getParentEdges().size());+ CPU_NODE_ASSERT(getChildEdges().size() >= (algorithm == Algorithm::AdaptivePoolingMax ? 2 : 1),+ "has incorrect number of output edges: ",+ getChildEdges().size());auto srcRank = getInputShapeAtPort(0).getRank();- if (!one_of(spatialDimsCount, 1, 2, 3)) {- THROW_CPU_NODE_ERR("doesn't support 0th input with rank: ", srcRank);- }+ CPU_NODE_ASSERT(one_of(spatialDimsCount, 1, 2, 3), "doesn't support 0th input with rank: ", srcRank);- if (getInputShapeAtPort(1).getRank() != 1) {- THROW_CPU_NODE_ERR("doesn't support 1st input with rank: ", getInputShapeAtPort(1).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(1).getRank() == 1,+ "doesn't support 1st input with rank: ",+ getInputShapeAtPort(1).getRank());- if (getOutputShapeAtPort(0).getRank() != getInputShapeAtPort(0).getRank()) {- THROW_CPU_NODE_ERR("must keep data rank");- }+ CPU_NODE_ASSERT(getOutputShapeAtPort(0).getRank() == getInputShapeAtPort(0).getRank(), "must keep data rank");}bool AdaptivePooling::needShapeInfer() const {@@ -147,9 +141,7 @@ void AdaptivePooling::executeDynamicImpl(const dnnl::stream& strm) {void AdaptivePooling::execute([[maybe_unused]] const dnnl::stream& strm) {auto inputPrec = getParentEdgeAt(0)->getMemory().getDataType();auto outputPrec = getChildEdgeAt(0)->getMemory().getDataType();- if (!(inputPrec == dnnl_f32 && outputPrec == dnnl_f32)) {- THROW_CPU_NODE_ERR("doesn't support demanded precisions");- }+ CPU_NODE_ASSERT(inputPrec == dnnl_f32 && outputPrec == dnnl_f32, "doesn't support demanded precisions");const auto& srcMemory0 = getParentEdgeAt(0)->getMemory();const auto& srcMemory1 = getParentEdgeAt(1)->getMemory();@@ -171,13 +163,12 @@ void AdaptivePooling::execute([[maybe_unused]] const dnnl::stream& strm) {const auto* srcPooledSpatialShapes = getSrcDataAtPortAs<const int>(1);auto* dst = getDstDataAtPortAs<float>(0);- if (static_cast<int>(srcMemory1.getShape().getElementsCount()) != spatialDimsCount) {- THROW_CPU_NODE_ERR("has input spatial dimension (",- srcMemory1.getShape().getElementsCount(),- ") inconsistent with pooling vector size (",- spatialDimsCount,- ")");- }+ CPU_NODE_ASSERT(static_cast<int>(srcMemory1.getShape().getElementsCount()) == spatialDimsCount,+ "has input spatial dimension (",+ srcMemory1.getShape().getElementsCount(),+ ") inconsistent with pooling vector size (",+ spatialDimsCount,+ ")");auto inputDimVector = srcMemory0.getStaticDims();const auto N = static_cast<int>(inputDimVector[0]);@@ -198,9 +189,7 @@ void AdaptivePooling::execute([[maybe_unused]] const dnnl::stream& strm) {blockSize * (isBlkFmt ? srcBlockDesc->getBlockDims()[1] : srcMemory0.getShape().getStaticDims()[1]);const int blockCount = (isTailCFmt ? 1 : chPadding / blockSize);auto* selectedPrimitiveDescriptor = getSelectedPrimitiveDescriptor();- if (!selectedPrimitiveDescriptor) {- THROW_CPU_NODE_ERR("doesn't have primitive descriptors.");- }+ CPU_NODE_ASSERT(selectedPrimitiveDescriptor, "doesn't have primitive descriptors.");auto config = selectedPrimitiveDescriptor->getConfig();auto srcStrides = srcBlockDesc->getStrides();auto dstStrides = getChildEdgeAt(0)->getMemory().getDescWithType<BlockedMemoryDesc>()->getStrides();@@ -256,9 +245,7 @@ void AdaptivePooling::execute([[maybe_unused]] const dnnl::stream& strm) {setBinBorders(&hStart, &hEnd, oh, IH, OH);setBinBorders(&wStart, &wEnd, ow, IW, OW);auto binSize = (dEnd - dStart) * (hEnd - hStart) * (wEnd - wStart);- if (binSize == 0) {- THROW_CPU_NODE_ERR("has empty bin");- }+ CPU_NODE_ASSERT(binSize != 0, "has empty bin");float sum = 0;for (size_t pixD = dStart; pixD < dEnd; pixD++) {for (size_t pixH = hStart; pixH < hEnd; pixH++) {diff --git a/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp b/src/plugins/intel_cpu/src/nodes/batch_to_space.cppindex 1ee53160238..e71acb42eaa 100644--- a/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp+++ b/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp@@ -51,18 +51,13 @@ BatchToSpace::BatchToSpace(const std::shared_ptr<ov::Node>& op, const GraphConteOPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (inputShapes.size() != 4 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input or output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 4 && outputShapes.size() == 1,+ "has incorrect number of input or output edges!");const auto& inDims = getInputShapeAtPort(0).getDims();const auto& outDims = getOutputShapeAtPort(0).getDims();- if (inDims.size() < 4 || inDims.size() > 5) {- THROW_CPU_NODE_ERR("has unsupported 'data' input rank: ", inDims.size());- }- if (inDims.size() != outDims.size()) {- THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions");- }+ CPU_NODE_ASSERT(inDims.size() >= 4 && inDims.size() <= 5, "has unsupported 'data' input rank: ", inDims.size());+ CPU_NODE_ASSERT(inDims.size() == outDims.size(), "has incorrect number of input/output dimensions");}void BatchToSpace::initSupportedPrimitiveDescriptors() {@@ -73,9 +68,9 @@ void BatchToSpace::initSupportedPrimitiveDescriptors() {const auto& inDims = getInputShapeAtPort(0).getDims();const auto precision = getOriginalInputPrecisionAtPort(0);const std::set<size_t> supported_precision_sizes = {1, 2, 4, 8};- if (supported_precision_sizes.find(precision.size()) == supported_precision_sizes.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", precision.get_type_name());- }+ CPU_NODE_ASSERT(supported_precision_sizes.find(precision.size()) != supported_precision_sizes.end(),+ "has unsupported precision: ",+ precision.get_type_name());addSupportedPrimDesc({{LayoutType::nspc, precision},{LayoutType::ncsp, ov::element::i32},@@ -173,9 +168,7 @@ void BatchToSpace::batchToSpaceKernel() {size_t channels = (inShape5D[1] / blockSize);channels = channels == 0 ? 1 : channels;const size_t workAmount = inShape5D[0] * channels;- if (workAmount == 0) {- THROW_CPU_NODE_ERR("has unsupported work amount == 0");- }+ CPU_NODE_ASSERT(workAmount != 0, "has unsupported work amount == 0");parallel_nt(0, [&](const int ithr, const int nthr) {size_t start(0LU);@@ -273,9 +266,9 @@ void BatchToSpace::execute([[maybe_unused]] const dnnl::stream& strm) {batchToSpaceKernel<element_type_traits<ov::element::i32>::value_type>();break;default:- THROW_CPU_NODE_ERR("does not support precision '",- std::string(getParentEdgeAt(0)->getMemory().getDesc().getPrecision().get_type_name()),- "'");+ CPU_NODE_THROW("does not support precision '",+ std::string(getParentEdgeAt(0)->getMemory().getDesc().getPrecision().get_type_name()),+ "'");}}diff --git a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp b/src/plugins/intel_cpu/src/nodes/bin_conv.cppindex 656ec7c091e..c4b93c0ad21 100644--- a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp+++ b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp@@ -1031,25 +1031,21 @@ void BinaryConvolution::getSupportedDescriptors() {}}- if (getParentEdges().size() != expectedInputEdgesNum) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }+ CPU_NODE_ASSERT(getParentEdges().size() == expectedInputEdgesNum, "has incorrect number of input edges");- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges");- if (getInputShapeAtPort(0).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support 0th input with rank: ", getInputShapeAtPort(0).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(0).getRank() == 4,+ "doesn't support 0th input with rank: ",+ getInputShapeAtPort(0).getRank());- if (getInputShapeAtPort(1).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support 1st input with rank: ", getInputShapeAtPort(1).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(1).getRank() == 4,+ "doesn't support 1st input with rank: ",+ getInputShapeAtPort(1).getRank());- if (getOutputShapeAtPort(0).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support output with rank: ", getOutputShapeAtPort(0).getRank());- }+ CPU_NODE_ASSERT(getOutputShapeAtPort(0).getRank() == 4,+ "doesn't support output with rank: ",+ getOutputShapeAtPort(0).getRank());}void BinaryConvolution::initSupportedPrimitiveDescriptors() {@@ -1117,9 +1113,7 @@ void BinaryConvolution::initSupportedPrimitiveDescriptors() {void BinaryConvolution::createPrimitive() {auto* selectedPrimitiveDescriptor = getSelectedPrimitiveDescriptor();- if (!selectedPrimitiveDescriptor) {- THROW_CPU_NODE_ERR("doesn't have primitive descriptors.");- }+ CPU_NODE_ASSERT(selectedPrimitiveDescriptor, "doesn't have primitive descriptors.");auto srcDims = getParentEdgeAt(0)->getMemory().getStaticDims();auto weiDims = getParentEdgeAt(1)->getMemory().getStaticDims();@@ -1199,9 +1193,7 @@ void BinaryConvolution::createPrimitive() {bool args_ok =(jcp.l_pad <= jcp.ur_w) && (r_pad_no_tail <= jcp.ur_w) &&IMPLICATION(jcp.kw > 7, (jcp.t_pad == 0 && jcp.l_pad == 0) || (jcp.stride_w == 1 && jcp.stride_h == 1));- if (!args_ok) {- THROW_CPU_NODE_ERR("has unsupported parameters");- }+ CPU_NODE_ASSERT(args_ok, "has unsupported parameters");#if defined(OPENVINO_ARCH_X86_64)jit_dw_conv_params jcp_dw_conv = {};if (implType == impl_desc_type::jit_avx512) {@@ -1453,9 +1445,7 @@ void BinaryConvolution::execute([[maybe_unused]] const dnnl::stream& strm) {}auto* selectedPrimitiveDescriptor = getSelectedPrimitiveDescriptor();- if (!selectedPrimitiveDescriptor) {- THROW_CPU_NODE_ERR("doesn't have primitive descriptors.");- }+ CPU_NODE_ASSERT(selectedPrimitiveDescriptor, "doesn't have primitive descriptors.");auto implType = selectedPrimitiveDescriptor->getImplementationType();if (implType != impl_desc_type::ref) {diff --git a/src/plugins/intel_cpu/src/nodes/broadcast.cpp b/src/plugins/intel_cpu/src/nodes/broadcast.cppindex 06c78231895..e2bc338885a 100644--- a/src/plugins/intel_cpu/src/nodes/broadcast.cpp+++ b/src/plugins/intel_cpu/src/nodes/broadcast.cpp@@ -69,10 +69,10 @@ Broadcast::Broadcast(const std::shared_ptr<ov::Node>& op, const GraphContext::CP}if (op->get_input_size() != 2 && op->get_input_size() != 3) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getParentEdges().size());+ CPU_NODE_THROW("has incorrect number of input edges: ", getParentEdges().size());}if (op->get_output_size() == 0) {- THROW_CPU_NODE_ERR("has no output edges.");+ CPU_NODE_THROW("has no output edges.");}auto broadcastOp = ov::as_type_ptr<const ov::op::v1::Broadcast>(op);@@ -80,11 +80,11 @@ Broadcast::Broadcast(const std::shared_ptr<ov::Node>& op, const GraphContext::CPbroadcastType = NUMPY;} else if (broadcastOp->get_broadcast_spec().m_type == ov::op::AutoBroadcastType::EXPLICIT) {if (op->get_input_size() <= AXES_MAPPING_IDX) {- THROW_CPU_NODE_ERR("and EXPLICIT mode must have tree input edges: ", getParentEdges().size());+ CPU_NODE_THROW("and EXPLICIT mode must have tree input edges: ", getParentEdges().size());}broadcastType = EXPLICIT;} else {- THROW_CPU_NODE_ERR("has unexpected broadcast type: ", broadcastOp->get_broadcast_spec().m_type);+ CPU_NODE_THROW("has unexpected broadcast type: ", broadcastOp->get_broadcast_spec().m_type);}if (ov::is_type<ov::op::v0::Constant>(op->get_input_node_ptr(TARGET_SHAPE_IDX))) {diff --git a/src/plugins/intel_cpu/src/nodes/bucketize.cpp b/src/plugins/intel_cpu/src/nodes/bucketize.cppindex 813781b7fb7..8e557ecf30c 100644--- a/src/plugins/intel_cpu/src/nodes/bucketize.cpp+++ b/src/plugins/intel_cpu/src/nodes/bucketize.cpp@@ -51,13 +51,10 @@ Bucketize::Bucketize(const std::shared_ptr<ov::Node>& op, const GraphContext::CP}const auto bucketsize = ov::as_type_ptr<const ov::op::v3::Bucketize>(op);- if (bucketsize == nullptr) {- THROW_CPU_NODE_ERR("is not an instance of v3 Bucketize.");- }+ CPU_NODE_ASSERT(bucketsize, "is not an instance of v3 Bucketize.");- if (getOriginalInputsNumber() != 2 || getOriginalOutputsNumber() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(getOriginalInputsNumber() == 2 && getOriginalOutputsNumber() == 1,+ "has incorrect number of input/output edges!");// check one attributewith_right = bucketsize->get_with_right_bound();@@ -194,7 +191,7 @@ void Bucketize::execute([[maybe_unused]] const dnnl::stream& strm) {element_type_traits<ov::element::i64>::value_type>();break;default:- THROW_CPU_NODE_ERR("has unsupported precision: ", precision_mask);+ CPU_NODE_THROW("has unsupported precision: ", precision_mask);}}@@ -202,28 +199,16 @@ void Bucketize::prepareParams() {auto inputTensorMemPtr = getSrcMemoryAtPort(INPUT_TENSOR_PORT);auto inputBinsMemPtr = getSrcMemoryAtPort(INPUT_BINS_PORT);auto dstMemPtr = getDstMemoryAtPort(0);- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has destination memory undefined.");- }- if (!inputTensorMemPtr || !inputTensorMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has input tensor undefined.");- }- if (!inputBinsMemPtr || !inputBinsMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has input bins undefined.");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has preferable primitive descriptors unset.");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has destination memory undefined.");+ CPU_NODE_ASSERT(inputTensorMemPtr && inputTensorMemPtr->isDefined(), "has input tensor undefined.");+ CPU_NODE_ASSERT(inputBinsMemPtr && inputBinsMemPtr->isDefined(), "has input bins undefined.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "has preferable primitive descriptors unset.");// update with_bins/num_values/num_bin_valuesauto input_tensor_dims = inputTensorMemPtr->getStaticDims();- if (input_tensor_dims.empty()) {- THROW_CPU_NODE_ERR("has incorrect dimensions of the input.");- }+ CPU_NODE_ASSERT(!input_tensor_dims.empty(), "has incorrect dimensions of the input.");auto input_bin_dims = inputBinsMemPtr->getStaticDims();- if (input_bin_dims.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect dimensions of the boundaries tensor.");- }+ CPU_NODE_ASSERT(input_bin_dims.size() == 1, "has incorrect dimensions of the boundaries tensor.");if (input_bin_dims[0] != 0) {with_bins = true;}diff --git a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cppindex ac635fe448f..c4b629e397c 100644--- a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp+++ b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp@@ -159,7 +159,7 @@ void CausalMaskPreprocess::initSupportedPrimitiveDescriptors() {prec = ov::element::i32;}} else {- THROW_CPU_NODE_ERR("type not supported : " + m_config.type);+ CPU_NODE_THROW("type not supported : " + m_config.type);}std::vector<PortConfigurator> inPortConfigs;diff --git a/src/plugins/intel_cpu/src/nodes/color_convert.cpp b/src/plugins/intel_cpu/src/nodes/color_convert.cppindex 5d9a8b584bb..b68d4e27233 100644--- a/src/plugins/intel_cpu/src/nodes/color_convert.cpp+++ b/src/plugins/intel_cpu/src/nodes/color_convert.cpp@@ -150,9 +150,7 @@ protected:jit_uni_converter::jit_uni_converter() : jit_kernel(jit_name()), _consts(*this) {}void jit_uni_converter::init() {- if (create_kernel() != status::success) {- OPENVINO_THROW("Can't generate jit color converter kernel");- }+ OPENVINO_ASSERT(create_kernel() == status::success, "Can't generate jit color converter kernel");_fn = reinterpret_cast<function_t>(const_cast<uint8_t*>(jit_ker()));}@@ -342,12 +340,9 @@ protected:};RefConverter::RefConverter(Node* node) : Converter(node) {- if (node->getOriginalInputsNumber() != (singlePlane() ? 1 : 2)) {- OPENVINO_THROW("NV12Converter node has incorrect number of inputs");- }- if (!node->getOriginalOutputsNumber()) {- OPENVINO_THROW("NV12Converter node has incorrect number of outputs");- }+ OPENVINO_ASSERT(node->getOriginalInputsNumber() == (singlePlane() ? 1 : 2),+ "NV12Converter node has incorrect number of inputs");+ OPENVINO_ASSERT(node->getOriginalOutputsNumber(), "NV12Converter node has incorrect number of outputs");}template <typename T>@@ -678,12 +673,9 @@ protected:};RefConverter::RefConverter(Node* node) : Converter(node) {- if (node->getOriginalInputsNumber() != (singlePlane() ? 1 : 3)) {- OPENVINO_THROW("I420Converter node has incorrect number of inputs");- }- if (!node->getOriginalOutputsNumber()) {- OPENVINO_THROW("I420Converter node has incorrect number of outputs");- }+ OPENVINO_ASSERT(node->getOriginalInputsNumber() == (singlePlane() ? 1 : 3),+ "I420Converter node has incorrect number of inputs");+ OPENVINO_ASSERT(node->getOriginalOutputsNumber(), "I420Converter node has incorrect number of outputs");}template <typename T>@@ -1111,9 +1103,7 @@ void ColorConvert::initSupportedI420Impls() {void ColorConvert::createPrimitive() {const NodeDesc* desc = getSelectedPrimitiveDescriptor();- if (!desc) {- THROW_CPU_NODE_ERR("has no optimal primitive descriptor selected");- }+ CPU_NODE_ASSERT(desc, "has no optimal primitive descriptor selected");if (!_impl) {const auto& cfg = desc->getConfig();@@ -1126,9 +1116,7 @@ void ColorConvert::createPrimitive() {}void ColorConvert::execute(const dnnl::stream& strm) {- if (!_impl) {- THROW_CPU_NODE_ERR("has no any implemented converter");- }+ CPU_NODE_ASSERT(_impl, "has no any implemented converter");_impl->execute(strm);}diff --git a/src/plugins/intel_cpu/src/nodes/common/blocked_desc_creator.cpp b/src/plugins/intel_cpu/src/nodes/common/blocked_desc_creator.cppindex 11042fe3fdd..87015b8d4b2 100644--- a/src/plugins/intel_cpu/src/nodes/common/blocked_desc_creator.cpp+++ b/src/plugins/intel_cpu/src/nodes/common/blocked_desc_creator.cpp@@ -64,9 +64,7 @@ public:ChannelBlockedCreator(size_t blockSize) : _blockSize(blockSize) {}[[nodiscard]] CpuBlockedMemoryDesc createDesc(const ov::element::Type& precision,const Shape& srcShape) const override {- if (srcShape.getRank() < 2) {- OPENVINO_THROW("Can't create blocked tensor descriptor!");- }+ OPENVINO_ASSERT(srcShape.getRank() >= 2, "Can't create blocked tensor descriptor!");VectorDims order(srcShape.getRank());std::iota(order.begin(), order.end(), 0);diff --git a/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp b/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cppindex ef702b683cd..b1b7d7e741c 100644--- a/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp+++ b/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp@@ -1029,9 +1029,7 @@ void cpu_convert(const void* srcPtr,if (size == 0) {return;}- if (srcPtr == nullptr || dstPtr == nullptr) {- OPENVINO_THROW("cpu_convert has null data pointer");- }+ OPENVINO_ASSERT(srcPtr != nullptr && dstPtr != nullptr, "cpu_convert has null data pointer");if (srcPrc == dstPrc && srcPrc == interimPrc) {const size_t L2_cache_size = dnnl::utils::get_cache_size(2, true);@@ -1053,37 +1051,31 @@ void cpu_convert(const void* srcPtr,cpu_memcpy(dstPtr, srcPtr, size * dstPrc.size());}} else if (srcPrc == ov::element::u1) {- if (srcPrc.bitwidth() != 1) {- OPENVINO_THROW("cpu_convert can't convert from: ",- srcPrc,- " <bitsSize == ",- srcPrc.bitwidth(),- "> precision to: ",- dstPrc,- ". Not implemented.");- }+ OPENVINO_ASSERT(srcPrc.bitwidth() == 1,+ "cpu_convert can't convert from: ",+ srcPrc,+ " <bitsSize == ",+ srcPrc.bitwidth(),+ "> precision to: ",+ dstPrc,+ ". Not implemented.");ConvertFromBinContext ctx{srcPtr, dstPtr, size, false};OV_SWITCH(intel_cpu, ConvertFromBinPrecision, ctx, std::tie(srcPrc, dstPrc), INTEL_CPU_CVT_FROM_BIN_LIST);- if (!ctx.converted) {- OPENVINO_THROW("cpu_convert can't convert from: ",- srcPrc,- " <bitsSize == ",- srcPrc.bitwidth(),- "> precision to: ",- dstPrc);- }+ OPENVINO_ASSERT(ctx.converted,+ "cpu_convert can't convert from: ",+ srcPrc,+ " <bitsSize == ",+ srcPrc.bitwidth(),+ "> precision to: ",+ dstPrc);} else if (srcPrc.bitwidth() == 4U) {ConvertFrom4BitContext ctx{srcPrc, srcPtr, dstPtr, size, false};OV_SWITCH(intel_cpu, ConvertFrom4BitPrecision, ctx, std::tie(srcPrc, dstPrc), INTEL_CPU_CVT_FROM_4BIT_LIST);- if (!ctx.converted) {- OPENVINO_THROW("cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);- }+ OPENVINO_ASSERT(ctx.converted, "cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);} else if (dstPrc.bitwidth() == 4U) {ConvertTo4BitContext ctx{dstPrc, srcPtr, dstPtr, size, false};OV_SWITCH(intel_cpu, ConvertTo4BitPrecision, ctx, std::tie(srcPrc, dstPrc), INTEL_CPU_CVT_TO_4BIT_LIST);- if (!ctx.converted) {- OPENVINO_THROW("cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);- }+ OPENVINO_ASSERT(ctx.converted, "cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);} else if (srcPrc == ov::element::f8e8m0) {ConvertFromByteFPContext ctx{srcPrc, srcPtr, dstPtr, size, false};OV_SWITCH(intel_cpu,@@ -1091,25 +1083,19 @@ void cpu_convert(const void* srcPtr,ctx,std::tie(srcPrc, dstPrc),INTEL_CPU_CVT_FROM_BYTE_FP_LIST);- if (!ctx.converted) {- OPENVINO_THROW("cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);- }+ OPENVINO_ASSERT(ctx.converted, "cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);#if defined(OPENVINO_ARCH_X86_64)} else if (dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core_fp16) &&(one_of(srcPrc, ov::element::f8e4m3, ov::element::f8e5m2) ||one_of(dstPrc, ov::element::f8e4m3, ov::element::f8e5m2))) {ConvertFP8Context ctx{srcPtr, dstPtr, size, false};OV_SWITCH(intel_cpu, ConvertFP8Precision, ctx, std::tie(srcPrc, dstPrc), INTEL_CPU_CVT_FP8_LIST);- if (!ctx.converted) {- OPENVINO_THROW("cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);- }+ OPENVINO_ASSERT(ctx.converted, "cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);#endif} else {ConvertContext ctx{srcPtr, dstPtr, size, interimPrc, dstPrc, false};OV_SWITCH(intel_cpu, ConvertPrecision, ctx, std::tie(srcPrc, dstPrc), INTEL_CPU_CVT_LIST);- if (!ctx.converted) {- OPENVINO_THROW("cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);- }+ OPENVINO_ASSERT(ctx.converted, "cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);}}diff --git a/src/plugins/intel_cpu/src/nodes/common/tile_broadcast_utils.cpp b/src/plugins/intel_cpu/src/nodes/common/tile_broadcast_utils.cppindex f847c4c33de..d19c20c84ce 100644--- a/src/plugins/intel_cpu/src/nodes/common/tile_broadcast_utils.cpp+++ b/src/plugins/intel_cpu/src/nodes/common/tile_broadcast_utils.cpp@@ -122,16 +122,15 @@ std::vector<NodeDesc> TileBroadcastCommon::getSupportedConfigs(const Node* node,size_t outDataShapeRank = node->getOutputShapeAtPort(0).getRank();NodeConfig config;- if (repeats.size() != outDataShapeRank && !repeats.empty()) {- OPENVINO_THROW(node->getTypeStr(),- " node with name ",- node->getName(),- " has incorrect Repeats vector."- "Repeats rank must be equal to output shape rank. Repeats rank: ",- repeats.size(),- ", output shape rank: ",- outDataShapeRank);- }+ OPENVINO_ASSERT(repeats.size() == outDataShapeRank || repeats.empty(),+ node->getTypeStr(),+ " node with name ",+ node->getName(),+ " has incorrect Repeats vector."+ "Repeats rank must be equal to output shape rank. Repeats rank: ",+ repeats.size(),+ ", output shape rank: ",+ outDataShapeRank);config.inConfs.resize(node->getParentEdges().size());config.inConfs[0].inPlace(-1);diff --git a/src/plugins/intel_cpu/src/nodes/concat.cpp b/src/plugins/intel_cpu/src/nodes/concat.cppindex 9c6badebe9d..735ab3514d9 100644--- a/src/plugins/intel_cpu/src/nodes/concat.cpp+++ b/src/plugins/intel_cpu/src/nodes/concat.cpp@@ -88,9 +88,7 @@ Concat::Concat(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& coif (axis < 0) {axis += inRank;}- if (axis >= static_cast<int64_t>(inRank) || axis < 0) {- THROW_CPU_NODE_ERR("has invalid value of axis parameter: ", axis);- }+ CPU_NODE_ASSERT(axis < static_cast<int64_t>(inRank) && axis >= 0, "has invalid value of axis parameter: ", axis);this->axis = axis;}@@ -108,9 +106,7 @@ void Concat::getSupportedDescriptors() {break;}}- if (incorrectDims || firstParentDims.empty()) {- THROW_CPU_NODE_ERR("has incorrect input dimensions");- }+ CPU_NODE_ASSERT(!incorrectDims && !firstParentDims.empty(), "has incorrect input dimensions");}// we need the first dims before axis to be 1 to avoid the reorder in the edge between the first parent and this@@ -265,9 +261,8 @@ void Concat::selectOptimalPrimitiveDescriptor() {const auto& parent_config = parent_pdesc->getConfig();int outputIndex = parentEdge->getInputNum();- if (outputIndex < 0 || outputIndex >= static_cast<int>(parent_config.outConfs.size())) {- THROW_CPU_NODE_ERR("Cannot find index of output node");- }+ CPU_NODE_ASSERT(outputIndex >= 0 && outputIndex < static_cast<int>(parent_config.outConfs.size()),+ "Cannot find index of output node");const auto& port_desc = parent_config.outConfs[outputIndex].getMemDesc();for (auto& item : supportedLayouts) {if (port_desc->hasLayoutType(item)) {@@ -285,9 +280,8 @@ void Concat::selectOptimalPrimitiveDescriptor() {const auto& config = prim_desc->getConfig();int inputIndex = childEdge->getOutputNum();- if (inputIndex < 0 || inputIndex >= static_cast<int>(config.inConfs.size())) {- THROW_CPU_NODE_ERR("Cannot find index of output node");- }+ CPU_NODE_ASSERT(inputIndex >= 0 && inputIndex < static_cast<int>(config.inConfs.size()),+ "Cannot find index of output node");const auto& port_desc = config.inConfs[inputIndex].getMemDesc();for (auto& item : supportedLayouts) {if (port_desc->hasLayoutType(item)) {@@ -377,13 +371,9 @@ void Concat::prepareParams() {}const auto& dstMemPtr = getDstMemoryAtPort(0);- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Destination memory is undefined.");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "Destination memory is undefined.");auto dstMemDesc = dstMemPtr->getDescWithType<BlockedMemoryDesc>();- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "Preferable primitive descriptor is not set.");const auto& outputStrides = dstMemDesc->getStrides();size_t curConcatOffset = 0;@@ -427,10 +417,10 @@ void Concat::prepareParams() {nelemTotal = 0;for (size_t i = 0; i < getParentEdges().size(); i++) {const auto& srcMemPtr = getSrcMemoryAtPort(i);- if (!srcMemPtr || !srcMemPtr->isDefined()) {- auto parent = getParentEdgeAt(i)->getParent();- THROW_CPU_NODE_ERR("Source memory from ", parent->getName(), " is undefined.");- }+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(),+ "Source memory from ",+ getParentEdgeAt(i)->getParent()->getName(),+ " is undefined.");if (canExecRef) {auto* const srcMemDesc = srcMemPtr->getDescPtr()->as<BlockedMemoryDesc>();@@ -493,9 +483,7 @@ size_t Concat::inverseOrder(const VectorDims& order, size_t axis) {void Concat::initOptimalPrimitiveDescriptor() {auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(selected_pd, "Preferable primitive descriptor is not set.");if (!isInPlace()) {Node::initOptimalPrimitiveDescriptor();@@ -740,9 +728,7 @@ void Concat::resolveInPlaceEdges(Edge::LOOK look) {}auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(selected_pd, "Preferable primitive descriptor is not set.");const auto& config = selected_pd->getConfig();size_t numberOfInputs = config.inConfs.size();size_t inplaceOutIndx = selected_pd->getConfig().inConfs[0].inPlace();@@ -757,7 +743,7 @@ void Concat::resolveInPlaceEdges(Edge::LOOK look) {CPU_NODE_ASSERT(itr != edges.end(), "Could not find allocated child edge");auto baseMemBlock = (*itr)->getMemory().getMemoryBlock();- CPU_NODE_ASSERT(baseMemBlock != nullptr, "NULL base memory block");+ CPU_NODE_ASSERT(baseMemBlock, "NULL base memory block");ptrdiff_t offset = 0;for (size_t i = 0; i < numberOfInputs; ++i) {diff --git a/src/plugins/intel_cpu/src/nodes/convert.cpp b/src/plugins/intel_cpu/src/nodes/convert.cppindex e40d0c7947b..9c939df01e3 100644--- a/src/plugins/intel_cpu/src/nodes/convert.cpp+++ b/src/plugins/intel_cpu/src/nodes/convert.cpp@@ -87,12 +87,8 @@ void Convert::getSupportedDescriptors() {if (inputShapes.empty()) {inputShapes.push_back(input->getShape());}- if (getParentEdges().size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }+ CPU_NODE_ASSERT(getParentEdges().size() == 1, "has incorrect number of input edges");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges");}bool Convert::isSupportedDesc(const MemoryDesc& desc) {@@ -176,7 +172,7 @@ void Convert::initSupportedPrimitiveDescriptors() {supportedPrimitiveDescriptorsBuilder(config);}} else {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges");+ CPU_NODE_THROW("has incorrect number of input/output edges");}}@@ -203,9 +199,8 @@ void Convert::execute([[maybe_unused]] const dnnl::stream& strm) {const auto parentPaddElemCount = parentMem.getDescWithType<BlockedMemoryDesc>()->getPaddedElementsCount();const auto childPaddElemCount = childMem.getDescWithType<BlockedMemoryDesc>()->getPaddedElementsCount();- if (parentPaddElemCount != childPaddElemCount) {- THROW_CPU_NODE_ERR("has different elements number in input and output buffers");- }+ CPU_NODE_ASSERT(parentPaddElemCount == childPaddElemCount,+ "has different elements number in input and output buffers");MemoryCPtr srcMemory = getSrcMemoryAtPort(0);MemoryPtr dstMemory = getDstMemoryAtPort(0);diff --git a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cppindex c3b12603c04..126acf27278 100644--- a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp+++ b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp@@ -49,17 +49,17 @@ CTCGreedyDecoder::CTCGreedyDecoder(const std::shared_ptr<ov::Node>& op, const Gr}if (getOriginalInputsNumber() != 2) {- THROW_CPU_NODE_ERR("has invalid number of input edges: ", getOriginalInputsNumber());+ CPU_NODE_THROW("has invalid number of input edges: ", getOriginalInputsNumber());}if (getOriginalOutputsNumber() != 1) {- THROW_CPU_NODE_ERR("has invalid number of outputs edges: ", getOriginalOutputsNumber());+ CPU_NODE_THROW("has invalid number of outputs edges: ", getOriginalOutputsNumber());}const auto& dataDims = getInputShapeAtPort(DATA_INDEX).getDims();const auto& seqDims = getInputShapeAtPort(SEQUENCE_LENGTH_INDEX).getDims();if (!dimsEqualWeak(dataDims[0], seqDims[0]) || !dimsEqualWeak(dataDims[1], seqDims[1])) {- THROW_CPU_NODE_ERR("has invalid input shapes.");+ CPU_NODE_THROW("has invalid input shapes.");}auto greedyDecOp = ov::as_type_ptr<const ov::op::v0::CTCGreedyDecoder>(op);@@ -73,12 +73,12 @@ void CTCGreedyDecoder::initSupportedPrimitiveDescriptors() {ov::element::Type inDataPrecision = getOriginalInputPrecisionAtPort(DATA_INDEX);if (!one_of(inDataPrecision, ov::element::f32, ov::element::bf16, ov::element::f16)) {- THROW_CPU_NODE_ERR("has unsupported 'data' input precision: ", inDataPrecision);+ CPU_NODE_THROW("has unsupported 'data' input precision: ", inDataPrecision);}ov::element::Type seqLenPrecision = getOriginalInputPrecisionAtPort(SEQUENCE_LENGTH_INDEX);if (!one_of(seqLenPrecision, ov::element::f32, ov::element::bf16, ov::element::f16)) {- THROW_CPU_NODE_ERR("has unsupported 'sequence_length' input precision: ", seqLenPrecision);+ CPU_NODE_THROW("has unsupported 'sequence_length' input precision: ", seqLenPrecision);}addSupportedPrimDesc({{LayoutType::ncsp, ov::element::f32}, {LayoutType::ncsp, ov::element::f32}},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 8c23154dedb..09666b82981 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@@ -48,18 +48,16 @@ CTCGreedyDecoderSeqLen::CTCGreedyDecoderSeqLen(const std::shared_ptr<ov::Node>&OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (getOriginalInputsNumber() < 2 || getOriginalInputsNumber() > 3) {- THROW_CPU_NODE_ERR("has invalid number of input edges: ", getOriginalInputsNumber());- }- if (getOriginalOutputsNumber() != 2) {- THROW_CPU_NODE_ERR("has invalid number of outputs edges: ", getOriginalOutputsNumber());- }+ CPU_NODE_ASSERT(getOriginalInputsNumber() >= 2 && getOriginalInputsNumber() <= 3,+ "has invalid number of input edges: ",+ getOriginalInputsNumber());+ CPU_NODE_ASSERT(getOriginalOutputsNumber() == 2,+ "has invalid number of outputs edges: ",+ getOriginalOutputsNumber());const auto& dataDims = getInputShapeAtPort(DATA_INDEX).getDims();const auto& seqDims = getInputShapeAtPort(SEQUENCE_LENGTH_INDEX).getDims();- if (!dimsEqualWeak(dataDims[0], seqDims[0])) {- THROW_CPU_NODE_ERR("has invalid input shapes.");- }+ CPU_NODE_ASSERT(dimsEqualWeak(dataDims[0], seqDims[0]), "has invalid input shapes.");auto greedyDecOp = ov::as_type_ptr<const ov::op::v6::CTCGreedyDecoderSeqLen>(op);mergeRepeated = greedyDecOp->get_merge_repeated();@@ -71,14 +69,14 @@ void CTCGreedyDecoderSeqLen::initSupportedPrimitiveDescriptors() {}ov::element::Type inDataPrecision = getOriginalInputPrecisionAtPort(DATA_INDEX);- if (!one_of(inDataPrecision, ov::element::f32, ov::element::bf16, ov::element::f16)) {- THROW_CPU_NODE_ERR("has unsupported 'data' input precision: ", inDataPrecision);- }+ CPU_NODE_ASSERT(one_of(inDataPrecision, ov::element::f32, ov::element::bf16, ov::element::f16),+ "has unsupported 'data' input precision: ",+ inDataPrecision);ov::element::Type seqLenPrecision = getOriginalInputPrecisionAtPort(SEQUENCE_LENGTH_INDEX);- if (seqLenPrecision != ov::element::i32 && seqLenPrecision != ov::element::i64) {- THROW_CPU_NODE_ERR("has unsupported 'sequence_length' input precision: ", seqLenPrecision);- }+ CPU_NODE_ASSERT(seqLenPrecision == ov::element::i32 || seqLenPrecision == ov::element::i64,+ "has unsupported 'sequence_length' input precision: ",+ seqLenPrecision);std::vector<PortConfigurator> inDataConf;inDataConf.reserve(inputShapes.size());@@ -113,13 +111,11 @@ void CTCGreedyDecoderSeqLen::execute([[maybe_unused]] const dnnl::stream& strm)size_t workAmount = 0;for (size_t b = 0; b < B; b++) {- if (sequenceLengths[b] > static_cast<int>(T)) {- std::string errorMsg =- "Sequence length " + std::to_string(sequenceLengths[b]) +- " cannot be greater than according decoded classes dimension size " +- std::to_string(getChildEdgeAt(DECODED_CLASSES_INDEX)->getMemory().getStaticDims()[1]);- THROW_CPU_NODE_ERR(errorMsg);- }+ CPU_NODE_ASSERT(sequenceLengths[b] <= static_cast<int>(T),+ "Sequence length ",+ sequenceLengths[b],+ " cannot be greater than according decoded classes dimension size ",+ getChildEdgeAt(DECODED_CLASSES_INDEX)->getMemory().getStaticDims()[1]);workAmount += sequenceLengths[b];}// Parallelization could not be made directly by T due to output index depends on merged classes anddiff --git a/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp b/src/plugins/intel_cpu/src/nodes/ctc_loss.cppindex dbfcdf729dd..93d1e670d60 100644--- a/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp+++ b/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp@@ -51,7 +51,7 @@ CTCLoss::CTCLoss(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr&}if (getOriginalInputsNumber() != 4 && getOriginalInputsNumber() != 5) {- THROW_CPU_NODE_ERR("has invalid inputs number.");+ CPU_NODE_THROW("has invalid inputs number.");}auto ctcLossOp = ov::as_type_ptr<const ov::op::v4::CTCLoss>(op);@@ -181,7 +181,7 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {resErr += err + "\n";}}- THROW_CPU_NODE_ERR(resErr);+ CPU_NODE_THROW(resErr);}const size_t TC = maxTime * classesNum;diff --git a/src/plugins/intel_cpu/src/nodes/cum_sum.cpp b/src/plugins/intel_cpu/src/nodes/cum_sum.cppindex 7d71a7bc60f..1f07ff440af 100644--- a/src/plugins/intel_cpu/src/nodes/cum_sum.cpp+++ b/src/plugins/intel_cpu/src/nodes/cum_sum.cpp@@ -56,33 +56,26 @@ CumSum::CumSum(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& coif ((getOriginalInputsNumber() != numOfInputs && getOriginalInputsNumber() != (numOfInputs - 1)) ||getOriginalOutputsNumber() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");+ CPU_NODE_THROW("has incorrect number of input/output edges!");}const auto& dataShape = getInputShapeAtPort(CUM_SUM_DATA);numOfDims = dataShape.getRank();- if (numOfDims < 1) {- THROW_CPU_NODE_ERR("doesn't support 'data' input tensor with rank: ", numOfDims);- }+ CPU_NODE_ASSERT(numOfDims >= 1, "doesn't support 'data' input tensor with rank: ", numOfDims);const auto cumsum = ov::as_type_ptr<const ov::op::v0::CumSum>(op);- if (cumsum == nullptr) {- THROW_CPU_NODE_ERR("is not an instance of CumSum from opset3.");- }+ CPU_NODE_ASSERT(cumsum, "is not an instance of CumSum from opset3.");exclusive = cumsum->is_exclusive();reverse = cumsum->is_reverse();if (getOriginalInputsNumber() == numOfInputs) {const auto axis_shape = cumsum->get_input_partial_shape(AXIS);- if (axis_shape.is_dynamic() || !ov::is_scalar(axis_shape.to_shape())) {- THROW_CPU_NODE_ERR("doesn't support 'axis' input tensor with non scalar rank");- }+ CPU_NODE_ASSERT(!axis_shape.is_dynamic() && ov::is_scalar(axis_shape.to_shape()),+ "doesn't support 'axis' input tensor with non scalar rank");}- if (dataShape != getOutputShapeAtPort(0)) {- THROW_CPU_NODE_ERR("has different 'data' input and output dimensions");- }+ CPU_NODE_ASSERT(dataShape == getOutputShapeAtPort(0), "has different 'data' input and output dimensions");}void CumSum::initSupportedPrimitiveDescriptors() {@@ -101,14 +94,14 @@ void CumSum::initSupportedPrimitiveDescriptors() {ov::element::bf16,ov::element::f16,ov::element::f32)) {- THROW_CPU_NODE_ERR("has unsupported 'data' input precision: ", dataPrecision.get_type_name());+ CPU_NODE_THROW("has unsupported 'data' input precision: ", dataPrecision.get_type_name());}if (inputShapes.size() == numOfInputs) {const auto& axisTensorPrec = getOriginalInputPrecisionAtPort(AXIS);- if (axisTensorPrec != ov::element::i32 && axisTensorPrec != ov::element::i64) {- THROW_CPU_NODE_ERR("has unsupported 'axis' input precision: ", axisTensorPrec.get_type_name());- }+ CPU_NODE_ASSERT(axisTensorPrec == ov::element::i32 || axisTensorPrec == ov::element::i64,+ "has unsupported 'axis' input precision: ",+ axisTensorPrec.get_type_name());}std::vector<PortConfigurator> inDataConf;@@ -280,12 +273,12 @@ size_t CumSum::getAxis(const IMemory& _axis, const IMemory& _data) const {break;}default: {- THROW_CPU_NODE_ERR("doesn't support 'axis' input with precision: ", axisPrecision.get_type_name());- }+ CPU_NODE_THROW("doesn't support 'axis' input with precision: ", axisPrecision.get_type_name());}- if (axisValueFromBlob < -dataShapeSize || axisValueFromBlob > dataShapeSize - 1) {- THROW_CPU_NODE_ERR("has axis with a value out of range: ", axisValueFromBlob);}+ CPU_NODE_ASSERT(axisValueFromBlob >= -dataShapeSize && axisValueFromBlob <= dataShapeSize - 1,+ "has axis with a value out of range: ",+ axisValueFromBlob);return axisValueFromBlob >= 0 ? axisValueFromBlob : (axisValueFromBlob + dataShapeSize);}diff --git a/src/plugins/intel_cpu/src/nodes/deconv.cpp b/src/plugins/intel_cpu/src/nodes/deconv.cppindex ccea7701946..dbc0756c713 100644--- a/src/plugins/intel_cpu/src/nodes/deconv.cpp+++ b/src/plugins/intel_cpu/src/nodes/deconv.cpp@@ -293,10 +293,10 @@ Deconvolution::Deconvolution(const std::shared_ptr<ov::Node>& op, const GraphCon}if (externOutShape && isDynamicNode()) {const auto spDimsNum = getInputShapeAtPort(0).getRank() - 2;- if (getInputShapeAtPort(2).getStaticDims()[0] != spDimsNum ||- (isConstOutShape && lastOutputSpatialDims.size() != spDimsNum)) {- THROW_CPU_NODE_ERR("'output_shape' input has incorrect number of elements. Expected = ", spDimsNum);- }+ CPU_NODE_ASSERT(getInputShapeAtPort(2).getStaticDims()[0] == spDimsNum &&+ (!isConstOutShape || lastOutputSpatialDims.size() == spDimsNum),+ "'output_shape' input has incorrect number of elements. Expected = ",+ spDimsNum);}size_t spatialRank = getInputShapeAtPort(0).getRank() - 2;@@ -323,9 +323,7 @@ Deconvolution::Deconvolution(const std::shared_ptr<ov::Node>& op, const GraphConvoid Deconvolution::createDnnlCompatibleWeights() {MemoryPtr blob = getSrcMemoryAtPort(1);- if (!blob) {- THROW_CPU_NODE_ERR("Cannot get const weights blob.");- }+ CPU_NODE_ASSERT(blob, "Cannot get const weights blob.");weightIsConst = getParentEdgeAt(1)->getParent()->isConstant();auto blockedDims = getWeightDims();@@ -484,9 +482,7 @@ std::pair<VectorDims, VectorDims> Deconvolution::makeDummyInOutShape() {if (origInMaxDims[i + 2] != Shape::UNDEFINED_DIM) {auto upper_bound =deconvAttrs.stride[i] * static_cast<int32_t>(origInMaxDims[i + 2] - 1) - c1;- if (upper_bound < 0) {- THROW_CPU_NODE_ERR("paddings for dummy shapes can't be computed");- }+ CPU_NODE_ASSERT(upper_bound >= 0, "paddings for dummy shapes can't be computed");}auto lower_bound = deconvAttrs.stride[i] * static_cast<int32_t>(origInMinDims[i + 2] - 1) - c1;@@ -589,12 +585,9 @@ void Deconvolution::getSupportedDescriptors() {outputDataType = DnnlExtensionUtils::ElementTypeToDataType(fusedWith[fusedWith.size() - 1]->getOriginalOutputPrecisionAtPort(0));}- if (getParentEdges().size() != (withBiases ? (biasPort + 1) : biasPort)) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }+ CPU_NODE_ASSERT(getParentEdges().size() == (withBiases ? (biasPort + 1) : biasPort),+ "has incorrect number of input edges");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges");VectorDims inDims;VectorDims outDims;std::tie(inDims, outDims) = makeDummyInOutShape();@@ -740,11 +733,11 @@ void Deconvolution::setPostOps(dnnl::primitive_attr& attr, const VectorDims& dimcontinue;}- THROW_CPU_NODE_ERR("Fusing of ",- NameFromType(node->getType()),- " operation to ",- NameFromType(this->getType()),- " node is not implemented");+ CPU_NODE_THROW("Fusing of ",+ NameFromType(node->getType()),+ " operation to ",+ NameFromType(this->getType()),+ " node is not implemented");}attr.set_post_ops(ops);@@ -776,10 +769,9 @@ VectorDims Deconvolution::shapeInferInternal(const VectorDims& inDims, std::vectif (port_mask) {for (size_t i = 0; i < inputShapes.size(); ++i) {if (port_mask & 1 << i) {- if (outSpDims.size() != getInputShapeAtPort(i).getStaticDims()[0]) {- THROW_CPU_NODE_ERR(- "the node has 'output_shape' input, but provided output spatial dims number is incorrect");- }+ CPU_NODE_ASSERT(+ outSpDims.size() == getInputShapeAtPort(i).getStaticDims()[0],+ "the node has 'output_shape' input, but provided output spatial dims number is incorrect");outSpDimsVecShape = {outSpDims.size()};inputShapesRefs.push_back(std::cref(outSpDimsVecShape));CpuBlockedMemoryDesc desc(ov::element::i32, Shape(outSpDimsVecShape));@@ -791,9 +783,7 @@ VectorDims Deconvolution::shapeInferInternal(const VectorDims& inDims, std::vect}auto result = shapeInference->infer(inputShapesRefs, inputValues);- if (ShapeInferStatus::success != result.status) {- THROW_CPU_NODE_ERR("Unexpected shape inference result status");- }+ CPU_NODE_ASSERT(ShapeInferStatus::success == result.status, "Unexpected shape inference result status");return std::move(result.dims.back());}@@ -812,9 +802,7 @@ void Deconvolution::execute(const dnnl::stream& strm) {return;}- if (!execPtr) {- THROW_CPU_NODE_ERR("executor is not compiled");- }+ CPU_NODE_ASSERT(execPtr, "executor is not compiled");execPtr->exec(primArgs, strm);@@ -971,19 +959,11 @@ void Deconvolution::prepareParams() {auto srcMemPtr = getSrcMemoryAtPort(0);auto wghMemPtr = getSrcMemoryAtPort(1);auto dstMemPtr = getDstMemoryAtPort(0);- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Destination memory is undefined.");- }- if (!srcMemPtr || !srcMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Input memory is undefined.");- }- if (!wghMemPtr || !wghMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Weight memory is undefined.");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "Destination memory is undefined.");+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "Input memory is undefined.");+ CPU_NODE_ASSERT(wghMemPtr && wghMemPtr->isDefined(), "Weight memory is undefined.");auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(selected_pd, "Preferable primitive descriptor is not set.");if (useACL) {if (isDynamicNode()) {@@ -1035,9 +1015,7 @@ void Deconvolution::prepareParams() {if (withBiases) {biasMemPtr = getSrcMemoryAtPort(biasPort);- if (!biasMemPtr || !biasMemPtr->isDefined()) {- OPENVINO_THROW("Bias memory memory is undefined.");- }+ CPU_NODE_ASSERT(biasMemPtr && biasMemPtr->isDefined(), "Bias memory is undefined.");biasDesc = biasMemPtr->getDescWithType<DnnlMemoryDesc>();}bool is1x1PaddingAsymmetric = false;@@ -1153,9 +1131,7 @@ void Deconvolution::prepareParams() {auto result = cache->getOrCreate(key, builder);execPtr = result.first;- if (!execPtr) {- OPENVINO_THROW("Primitive descriptor was not found for node ", getName(), ".");- }+ OPENVINO_ASSERT(execPtr, "Primitive descriptor was not found for node ", getName(), ".");primArgs[DNNL_ARG_SRC] = srcMemPtr->getPrimitive();primArgs[DNNL_ARG_DST] = dstMemPtr->getPrimitive();@@ -1294,17 +1270,14 @@ Deconvolution::DeconvDNNLExecutor::DeconvDNNLExecutor(const dnnl::deconvolution_}std::vector<int32_t> Deconvolution::readOutputSpatialDims() const {- if (getParentEdges().size() < 3) {- OPENVINO_THROW("Can't get output spatial dims. Inputs number = ", getParentEdges().size());- }+ OPENVINO_ASSERT(getParentEdges().size() >= 3,+ "Can't get output spatial dims. Inputs number = ",+ getParentEdges().size());const auto& shapeMemPtr = getSrcMemoryAtPort(2);- if (!shapeMemPtr || !shapeMemPtr->isDefined()) {- OPENVINO_THROW("'output_shape' input memory is undefined.");- }+ OPENVINO_ASSERT(shapeMemPtr && shapeMemPtr->isDefined(), "'output_shape' input memory is undefined.");const auto spDimsNum = getInputShapeAtPort(0).getRank() - 2;- if (shapeMemPtr->getStaticDims()[0] != spDimsNum) {- OPENVINO_THROW("Can't read output spatial dims, beause 'output_shape' input has incorrect number of elements");- }+ OPENVINO_ASSERT(shapeMemPtr->getStaticDims()[0] == spDimsNum,+ "Can't read output spatial dims, beause 'output_shape' input has incorrect number of elements");const auto* outShapePtr = shapeMemPtr->getDataAs<const int32_t>();std::vector<int32_t> outSpDims(outShapePtr, outShapePtr + shapeMemPtr->getStaticDims()[0]);return outSpDims;diff --git a/src/plugins/intel_cpu/src/nodes/def_conv.cpp b/src/plugins/intel_cpu/src/nodes/def_conv.cppindex 79d6429a8c2..bc86e2bf0a6 100644--- a/src/plugins/intel_cpu/src/nodes/def_conv.cpp+++ b/src/plugins/intel_cpu/src/nodes/def_conv.cpp@@ -803,9 +803,7 @@ DeformableConvolution::DeformableConvolution(const std::shared_ptr<ov::Node>& opOPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}auto defConvNodeBase = ov::as_type_ptr<ov::op::util::DeformableConvolutionBase>(op);- if (defConvNodeBase == nullptr) {- THROW_CPU_NODE_ERR("is not an instance of DeformableConvolutionBase.");- }+ CPU_NODE_ASSERT(defConvNodeBase, "is not an instance of DeformableConvolutionBase.");defConvAttr.group = defConvNodeBase->get_group();defConvAttr.deformable_group = defConvNodeBase->get_deformable_group();@@ -825,9 +823,7 @@ DeformableConvolution::DeformableConvolution(const std::shared_ptr<ov::Node>& opif (op->get_type_info() == ov::op::v8::DeformableConvolution::get_type_info_static()) {auto defConvNode = ov::as_type_ptr<ov::op::v8::DeformableConvolution>(op);- if (defConvNode == nullptr) {- THROW_CPU_NODE_ERR("is not an instance of DeformableConvolution from opset8.");- }+ CPU_NODE_ASSERT(defConvNode, "is not an instance of DeformableConvolution from opset8.");defConvAttr.with_bilinear_pad = defConvNode->get_bilinear_interpolation_pad();} else {defConvAttr.with_bilinear_pad = false;@@ -835,24 +831,20 @@ DeformableConvolution::DeformableConvolution(const std::shared_ptr<ov::Node>& op}void DeformableConvolution::getSupportedDescriptors() {- if (getParentEdges().size() != 3 && getParentEdges().size() != 4) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }- if (getInputShapeAtPort(DATA_ID).getRank() != 4) {- THROW_CPU_NODE_ERR("has unsupported mode. Only 4D blobs are supported as input.");- }- if (getInputShapeAtPort(OFF_ID).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support 1st input with rank: ", getInputShapeAtPort(OFF_ID).getRank());- }- if (getInputShapeAtPort(WEI_ID).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support 2nd input with rank: ", getInputShapeAtPort(WEI_ID).getRank());- }- if (getOutputShapeAtPort(DATA_ID).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support output with rank: ", getOutputShapeAtPort(DATA_ID).getRank());- }+ CPU_NODE_ASSERT(getParentEdges().size() == 3 || getParentEdges().size() == 4,+ "has incorrect number of input edges");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges");+ CPU_NODE_ASSERT(getInputShapeAtPort(DATA_ID).getRank() == 4,+ "has unsupported mode. Only 4D blobs are supported as input.");+ CPU_NODE_ASSERT(getInputShapeAtPort(OFF_ID).getRank() == 4,+ "doesn't support 1st input with rank: ",+ getInputShapeAtPort(OFF_ID).getRank());+ CPU_NODE_ASSERT(getInputShapeAtPort(WEI_ID).getRank() == 4,+ "doesn't support 2nd input with rank: ",+ getInputShapeAtPort(WEI_ID).getRank());+ CPU_NODE_ASSERT(getOutputShapeAtPort(DATA_ID).getRank() == 4,+ "doesn't support output with rank: ",+ getOutputShapeAtPort(DATA_ID).getRank());}void DeformableConvolution::initSupportedPrimitiveDescriptors() {@@ -1066,9 +1058,10 @@ void DeformableConvolution::DefConvExecutor::prepareSamplingWeights(const float*DeformableConvolution::DefConvExecutor::DefConvExecutor(const DefConvAttr& defConvAttr,const std::vector<std::shared_ptr<BlockedMemoryDesc>>& descVector) {- if (descVector.size() != 4 && descVector.size() != 5) {- OPENVINO_THROW("Deformable Convolution executor got incorrect desc's count (", descVector.size(), ")");- }+ OPENVINO_ASSERT(one_of(descVector.size(), 4U, 5U),+ "Deformable Convolution executor got incorrect desc's count (",+ descVector.size(),+ ")");bool withModulation = descVector.size() == 5;const auto& srcDesc = descVector[DATA_ID];@@ -1248,30 +1241,18 @@ void DeformableConvolution::prepareParams() {auto offMemPtr = getSrcMemoryAtPort(OFF_ID);auto weiMemPtr = getSrcMemoryAtPort(WEI_ID);- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined destination memory");- }- if (!srcMemPtr || !srcMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory");- }- if (!offMemPtr || !offMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined offsets shape memory");- }- if (!weiMemPtr || !weiMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined weights memory");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined destination memory");+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "has undefined input memory");+ CPU_NODE_ASSERT(offMemPtr && offMemPtr->isDefined(), "has undefined offsets shape memory");+ CPU_NODE_ASSERT(weiMemPtr && weiMemPtr->isDefined(), "has undefined weights memory");if (getOriginalInputsNumber() > 3) {auto modMemPtr = getSrcMemoryAtPort(MOD_ID);- if (!modMemPtr || !modMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined modulations memory");- }+ CPU_NODE_ASSERT(modMemPtr && modMemPtr->isDefined(), "has undefined modulations memory");}auto* selectedPrimitiveDescriptor = getSelectedPrimitiveDescriptor();- if (!selectedPrimitiveDescriptor) {- THROW_CPU_NODE_ERR("doesn't have primitive descriptors.");- }+ CPU_NODE_ASSERT(selectedPrimitiveDescriptor, "doesn't have primitive descriptors.");auto config = selectedPrimitiveDescriptor->getConfig();bool withModulation = getParentEdges().size() > 3;@@ -1314,9 +1295,7 @@ void DeformableConvolution::prepareParams() {});execPtr = result.first;- if (!execPtr) {- THROW_CPU_NODE_ERR("Primitive descriptor was not found.");- }+ CPU_NODE_ASSERT(execPtr, "Primitive descriptor was not found.");}void DeformableConvolution::executeDynamicImpl(const dnnl::stream& strm) {@@ -1379,16 +1358,11 @@ void DeformableConvolution::execute([[maybe_unused]] const dnnl::stream& strm) {auto* dst = dstMemory.getDataAs<float>();auto* selectedPrimitiveDescriptor = getSelectedPrimitiveDescriptor();- if (!selectedPrimitiveDescriptor) {- THROW_CPU_NODE_ERR("doesn't have primitive descriptors.");- }+ CPU_NODE_ASSERT(selectedPrimitiveDescriptor, "doesn't have primitive descriptors.");auto config = selectedPrimitiveDescriptor->getConfig();- if (execPtr) {- execPtr->exec(src, offsets, weights, modulation, dst, sampledCoordsVector.data(), interpWeightsVector.data());- } else {- THROW_CPU_NODE_ERR("executor doesn't exist");- }+ CPU_NODE_ASSERT(execPtr, "executor doesn't exist");+ execPtr->exec(src, offsets, weights, modulation, dst, sampledCoordsVector.data(), interpWeightsVector.data());}void DeformableConvolution::updatePadding() {diff --git a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp b/src/plugins/intel_cpu/src/nodes/depth_to_space.cppindex cd7e8c2e132..3ea5333abcb 100644--- a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp+++ b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp@@ -91,14 +91,10 @@ DepthToSpace::DepthToSpace(const std::shared_ptr<ov::Node>& op, const GraphConteif (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (inputShapes.size() != 1 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 1 && outputShapes.size() == 1, "has incorrect number of input/output edges!");auto depthToSpace = ov::as_type_ptr<const ov::op::v0::DepthToSpace>(op);- if (!depthToSpace) {- THROW_CPU_NODE_ERR("supports only v0");- }+ CPU_NODE_ASSERT(depthToSpace, "supports only v0");const auto modeNgraph = depthToSpace->get_mode();if (modeNgraph == ov::op::v0::DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST) {@@ -106,26 +102,18 @@ DepthToSpace::DepthToSpace(const std::shared_ptr<ov::Node>& op, const GraphConte} else if (modeNgraph == ov::op::v0::DepthToSpace::DepthToSpaceMode::DEPTH_FIRST) {attrs.mode = Mode::DEPTH_FIRST;} else {- THROW_CPU_NODE_ERR("doesn't support mode: ", ov::as_string(modeNgraph));+ CPU_NODE_THROW("doesn't support mode: ", ov::as_string(modeNgraph));}attrs.blockSize = depthToSpace->get_block_size();- if (attrs.blockSize == 0) {- THROW_CPU_NODE_ERR("has incorrect block_size parameter is zero!");- }+ CPU_NODE_ASSERT(attrs.blockSize != 0, "has incorrect block_size parameter is zero!");const size_t srcRank = getInputShapeAtPort(0).getRank();const size_t dstRank = getOutputShapeAtPort(0).getRank();- if (srcRank < 3) {- THROW_CPU_NODE_ERR("has incorrect number of input dimensions");- }- if (srcRank > 5) {- THROW_CPU_NODE_ERR("doesn't support dimensions with rank greater than 5");- }- if (srcRank != dstRank) {- THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions");- }+ CPU_NODE_ASSERT(srcRank >= 3, "has incorrect number of input dimensions");+ CPU_NODE_ASSERT(srcRank <= 5, "doesn't support dimensions with rank greater than 5");+ CPU_NODE_ASSERT(srcRank == dstRank, "has incorrect number of input/output dimensions");const size_t nSpatialDims = srcRank - 2;attrs.blockStep = static_cast<size_t>(std::pow(attrs.blockSize, nSpatialDims));@@ -191,15 +179,9 @@ void DepthToSpace::initSupportedPrimitiveDescriptors() {void DepthToSpace::createPrimitive() {auto dstMemPtr = getDstMemoryAtPort(0);auto srcMemPtr = getSrcMemoryAtPort(0);- if (!dstMemPtr) {- THROW_CPU_NODE_ERR("has null destination memory");- }- if (!srcMemPtr) {- THROW_CPU_NODE_ERR("has null input memory");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor");- }+ CPU_NODE_ASSERT(dstMemPtr, "has null destination memory");+ CPU_NODE_ASSERT(srcMemPtr, "has null input memory");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "has unidentified preferable primitive descriptor");const auto& memoryDesc = srcMemPtr->getDesc();attrs.dataSize = memoryDesc.getPrecision().size();@@ -230,17 +212,15 @@ void DepthToSpace::prepareParams() {auto cache = context->getParamsCache();auto result = cache->getOrCreate(attrs, builder);- if (!result.first) {- THROW_CPU_NODE_ERR("DepthToSpaceExecutor was not found.");- }+ CPU_NODE_ASSERT(result.first, "DepthToSpaceExecutor was not found.");execPtr = result.first;}DepthToSpace::DepthToSpaceExecutor::DepthToSpaceExecutor(const DepthToSpaceAttrs& attrs) {- if (!one_of(attrs.layoutType, LayoutType::nCsp16c, LayoutType::nCsp8c, LayoutType::nspc, LayoutType::ncsp)) {- OPENVINO_THROW("DepthToSpace executor supports only 'nCsp16c', 'nCsp8c', 'nspc' or 'ncsp' layouts.");- }+ OPENVINO_ASSERT(+ one_of(attrs.layoutType, LayoutType::nCsp16c, LayoutType::nCsp8c, LayoutType::nspc, LayoutType::ncsp),+ "DepthToSpace executor supports only 'nCsp16c', 'nCsp8c', 'nspc' or 'ncsp' layouts.");const bool isBlocked = one_of(attrs.layoutType, LayoutType::nCsp16c, LayoutType::nCsp8c);const bool isChannelsFirst = attrs.layoutType == LayoutType::nspc;@@ -334,9 +314,7 @@ DepthToSpace::DepthToSpaceExecutor::DepthToSpaceExecutor(const DepthToSpaceAttrs}void DepthToSpace::DepthToSpaceExecutor::exec(const MemoryPtr& srcMemPtr, const MemoryPtr& dstMemPtr, int MB) {- if (!permuteKernel) {- OPENVINO_THROW("Could not execute. Kernel for Transpose node was not compiled.");- }+ OPENVINO_ASSERT(permuteKernel, "Could not execute. Kernel for Transpose node was not compiled.");const auto* srcData = srcMemPtr->getDataAs<const uint8_t>();auto* dstData = dstMemPtr->getDataAs<uint8_t>();@@ -345,9 +323,7 @@ void DepthToSpace::DepthToSpaceExecutor::exec(const MemoryPtr& srcMemPtr, const}void DepthToSpace::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("doesn't have a compiled executor.");- }+ CPU_NODE_ASSERT(execPtr, "doesn't have a compiled executor.");int MB = getSrcMemoryAtPort(0)->getStaticDims()[0];execPtr->exec(getSrcMemoryAtPort(0), getDstMemoryAtPort(0), MB);diff --git a/src/plugins/intel_cpu/src/nodes/detection_output.cpp b/src/plugins/intel_cpu/src/nodes/detection_output.cppindex a84afa2014f..4e53c513c29 100644--- a/src/plugins/intel_cpu/src/nodes/detection_output.cpp+++ b/src/plugins/intel_cpu/src/nodes/detection_output.cpp@@ -76,13 +76,10 @@ DetectionOutput::DetectionOutput(const std::shared_ptr<ov::Node>& op, const GrapOPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (getOriginalInputsNumber() != 3 && getOriginalInputsNumber() != 5) {- THROW_CPU_NODE_ERR("has incorrect number of input edges.");- }+ CPU_NODE_ASSERT(getOriginalInputsNumber() == 3 || getOriginalInputsNumber() == 5,+ "has incorrect number of input edges.");- if (getOriginalOutputsNumber() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of output edges.");- }+ CPU_NODE_ASSERT(getOriginalOutputsNumber() == 1, "has incorrect number of output edges.");auto doOp = ov::as_type_ptr<const ov::op::v8::DetectionOutput>(op);auto attributes = doOp->get_attrs();@@ -121,21 +118,18 @@ void DetectionOutput::prepareParams() {locNumForClasses = isShareLoc ? 1 : classesNum;const auto& idLocDims = getParentEdgeAt(ID_LOC)->getMemory().getShape().getStaticDims();- if (priorsNum * locNumForClasses * 4 != static_cast<int>(idLocDims[1])) {- THROW_CPU_NODE_ERR("has incorrect number of priors, which must match number of location predictions (",- priorsNum * locNumForClasses * 4,- " vs ",- idLocDims[1],- ")");- }+ CPU_NODE_ASSERT(priorsNum * locNumForClasses * 4 == static_cast<int>(idLocDims[1]),+ "has incorrect number of priors, which must match number of location predictions (",+ priorsNum * locNumForClasses * 4,+ " vs ",+ idLocDims[1],+ ")");- if (priorsNum * classesNum != static_cast<int>(idConfDims.back())) {- THROW_CPU_NODE_ERR("has incorrect number of priors, which must match number of confidence predictions.");- }+ CPU_NODE_ASSERT(priorsNum * classesNum == static_cast<int>(idConfDims.back()),+ "has incorrect number of priors, which must match number of confidence predictions.");- if (decreaseClassId && backgroundClassId != 0) {- THROW_CPU_NODE_ERR("cannot use decrease_label_id and background_label_id parameter simultaneously.");- }+ CPU_NODE_ASSERT(!decreaseClassId || backgroundClassId == 0,+ "cannot use decrease_label_id and background_label_id parameter simultaneously.");imgNum = static_cast<int>(idConfDims[0]);@@ -958,9 +952,7 @@ inline void DetectionOutput::generateOutput(const float* reorderedConfData,const auto& outDims = getChildEdgeAt(0)->getMemory().getStaticDims();const int numResults = outDims[2];const int DETECTION_SIZE = outDims[3];- if (DETECTION_SIZE != 7) {- THROW_CPU_NODE_ERR("has unsupported output layout.");- }+ CPU_NODE_ASSERT(DETECTION_SIZE == 7, "has unsupported output layout.");int dstDataSize = 0;if (keepTopK > 0) {@@ -971,9 +963,8 @@ inline void DetectionOutput::generateOutput(const float* reorderedConfData,dstDataSize = imgNum * classesNum * priorsNum * DETECTION_SIZE * sizeof(float);}- if (static_cast<size_t>(dstDataSize) > getChildEdgeAt(0)->getMemory().getSize()) {- THROW_CPU_NODE_ERR("has insufficient output buffer size.");- }+ CPU_NODE_ASSERT(static_cast<size_t>(dstDataSize) <= getChildEdgeAt(0)->getMemory().getSize(),+ "has insufficient output buffer size.");memset(dstData, 0, dstDataSize);// set final detection result to output blobdiff --git a/src/plugins/intel_cpu/src/nodes/dft.cpp b/src/plugins/intel_cpu/src/nodes/dft.cppindex bb95533b2de..a1a2ba7c767 100644--- a/src/plugins/intel_cpu/src/nodes/dft.cpp+++ b/src/plugins/intel_cpu/src/nodes/dft.cpp@@ -80,18 +80,18 @@ void DFT::initSupportedPrimitiveDescriptors() {const auto& dataPrecision = getOriginalInputPrecisionAtPort(DATA_INDEX);if (!dataPrecision.is_real()) {- THROW_CPU_NODE_ERR("has unsupported 'data' input precision: ", dataPrecision.get_type_name());+ CPU_NODE_THROW("has unsupported 'data' input precision: ", dataPrecision.get_type_name());}const auto& axesPrecision = getOriginalInputPrecisionAtPort(AXES_INDEX);if (axesPrecision != ov::element::i32 && axesPrecision != ov::element::i64) {- THROW_CPU_NODE_ERR("has unsupported 'axes' input precision: ", axesPrecision.get_type_name());+ CPU_NODE_THROW("has unsupported 'axes' input precision: ", axesPrecision.get_type_name());}if (inputShapes.size() > SIGNAL_SIZE_INDEX) {const auto& signalSizeTensorPrec = getOriginalInputPrecisionAtPort(SIGNAL_SIZE_INDEX);if (signalSizeTensorPrec != ov::element::i32 && signalSizeTensorPrec != ov::element::i64) {- THROW_CPU_NODE_ERR("has unsupported 'signal_size' input precision: ", signalSizeTensorPrec.get_type_name());+ CPU_NODE_THROW("has unsupported 'signal_size' input precision: ", signalSizeTensorPrec.get_type_name());}}@@ -451,7 +451,7 @@ void DFT::naiveDFT(float* data, size_t dataLength, bool inverse) const {const float reciprocalNComplex = 1.0F / nComplex;auto twiddlesIter = twiddlesMapDFT.find(nComplex);if (twiddlesIter == twiddlesMapDFT.end()) {- THROW_CPU_NODE_ERR("Twiddles for nComplex=", nComplex, " not found");+ CPU_NODE_THROW("Twiddles for nComplex=", nComplex, " not found");}const auto& twiddles = twiddlesIter->second;@@ -583,7 +583,7 @@ void DFT::createJITKernels(bool hasDFT, bool hasFFT) {} else if (mayiuse(cpu::x64::sse41)) {dftKernel = std::make_unique<jit_uni_dft_kernel_f32<cpu::x64::sse41>>();} else {- THROW_CPU_NODE_ERR("Can't create jit DFT kernel");+ CPU_NODE_THROW("Can't create jit DFT kernel");}if (dftKernel) {@@ -599,7 +599,7 @@ void DFT::createJITKernels(bool hasDFT, bool hasFFT) {} else if (mayiuse(cpu::x64::sse41)) {fftKernel = std::make_unique<jit_uni_fft_kernel_f32<cpu::x64::sse41>>();} else {- THROW_CPU_NODE_ERR("Can't create jit FFT kernel");+ CPU_NODE_THROW("Can't create jit FFT kernel");}if (fftKernel) {diff --git a/src/plugins/intel_cpu/src/nodes/eltwise.cpp b/src/plugins/intel_cpu/src/nodes/eltwise.cppindex 7a8e49f4d00..1072cbef0ef 100644--- a/src/plugins/intel_cpu/src/nodes/eltwise.cpp+++ b/src/plugins/intel_cpu/src/nodes/eltwise.cpp@@ -564,11 +564,8 @@ public:});};- if (inpDims.empty()) {- OPENVINO_THROW("Can not make Eltwise executor from empty input dims array");- } else if (inpDims.front().empty()) {- OPENVINO_THROW("Can not make Eltwise executor from empty input dims members");- }+ OPENVINO_ASSERT(!inpDims.empty(), "Can not make Eltwise executor from empty input dims array");+ OPENVINO_ASSERT(!inpDims.front().empty(), "Can not make Eltwise executor from empty input dims members");jit_eltwise_params jep = {};size_t inputsNumber = inpDims.size();@@ -579,9 +576,7 @@ public:jep.dims.resize(jep.input_size, 1);- if (outBlkDims.empty()) {- OPENVINO_THROW("Can not make Eltwise executor from empty block dims vector");- }+ OPENVINO_ASSERT(!outBlkDims.empty(), "Can not make Eltwise executor from empty block dims vector");size_t outRank = outBlkDims.size();for (size_t i = 0; i < outRank; i++) {@@ -590,16 +585,13 @@ public:for (auto& inpDim : inpDims) {for (size_t j = 0; j < inpDim.size(); j++) {- if (inpDim[j] != jep.dims[j] && inpDim[j] != 1) {- OPENVINO_THROW("Eltwise executor got invalid input/output dims configuration.");- }+ OPENVINO_ASSERT(inpDim[j] == jep.dims[j] || inpDim[j] == 1,+ "Eltwise executor got invalid input/output dims configuration.");}}- if (outBlkDims.size() != outOrder.size()) {- OPENVINO_THROW(- "Can not make Eltwise executor due to out blocked dims and out order vectors size mismatch.");- }+ OPENVINO_ASSERT(outBlkDims.size() == outOrder.size(),+ "Can not make Eltwise executor due to out blocked dims and out order vectors size mismatch.");int lastUnchangedAxis = 0;size_t oc_size = 0;@@ -683,9 +675,8 @@ public:}}- if (inpPrc.size() != inputsNumber) {- OPENVINO_THROW("Can not make Eltwise executor. Wrong input precisions vector size.");- }+ OPENVINO_ASSERT(inpPrc.size() == inputsNumber,+ "Can not make Eltwise executor. Wrong input precisions vector size.");if (!useRuntimePtrs) {_batchDimIdx = jep.input_size - outBlkDims.size() + collapsedDims;@@ -762,9 +753,7 @@ public:}void exec(const jit_eltwise_call_args_ptrs& args_ptrs, const VectorDims& dims_out) override {- if (!_pKernel) {- OPENVINO_THROW("Can't execute, kernel for eltwise node is not compiled");- }+ OPENVINO_ASSERT(_pKernel, "Can't execute, kernel for eltwise node is not compiled");if (_pKernel->jep_.input_size == optimalTensorRank) {// execute Optimized 6D@@ -815,9 +804,7 @@ public:}}[[nodiscard]] const VectorDims& getOutDims() const override {- if (!_pKernel) {- OPENVINO_THROW("Can't get jit eltwise params, kernel for Eltwise executor is not compiled");- }+ OPENVINO_ASSERT(_pKernel, "Can't get jit eltwise params, kernel for Eltwise executor is not compiled");return _pKernel->jep_.dims;}[[nodiscard]] size_t getBatchDimIdx() const override {@@ -969,15 +956,9 @@ public:const std::vector<VectorDims>& inpDims): _opData(opData),_inpDims(inpDims) {- if (inpDims.empty()) {- OPENVINO_THROW("Can not make Eltwise executor from empty input dims array");- } else if (inpDims.front().empty()) {- OPENVINO_THROW("Can not make Eltwise executor from empty input dims array members");- }-- if (outBlkDims.empty()) {- OPENVINO_THROW("Can not make Eltwise executor from empty output blocked dims vector");- }+ OPENVINO_ASSERT(!inpDims.empty(), "Can not make Eltwise executor from empty input dims array");+ OPENVINO_ASSERT(!inpDims.front().empty(), "Can not make Eltwise executor from empty input dims array members");+ OPENVINO_ASSERT(!outBlkDims.empty(), "Can not make Eltwise executor from empty output blocked dims vector");_inputNum = inpDims.size();size_t input_size = inpDims.front().size();@@ -1485,7 +1466,7 @@ size_t Eltwise::getOpInputsNum() const {case Algorithm::EltwiseSelect:return 3;default:- THROW_CPU_NODE_ERR("Unsupported operation.");+ CPU_NODE_THROW("Unsupported operation.");}}@@ -1502,12 +1483,8 @@ bool Eltwise::isWithBroadcast() {}void Eltwise::getSupportedDescriptors() {- if (getParentEdges().empty()) {- THROW_CPU_NODE_ERR("Incorrect number of input edges");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("Incorrect number of output edges");- }+ CPU_NODE_ASSERT(!getParentEdges().empty(), "Incorrect number of input edges");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "Incorrect number of output edges");}void Eltwise::initSupportedPrimitiveDescriptors() {@@ -1544,9 +1521,8 @@ void Eltwise::initSupportedPrimitiveDescriptors() {bool canUseOptimizedImpl = EltwiseJitExecutor::isSupportedOp(this, getAlpha(), getBeta(), getGamma());bool canUseOptimizedShapeAgnosticImpl = isDynamicNode() && canUseOptimizedImpl;- if (!canUseOptimizedImpl && !fusedWith.empty()) {- THROW_CPU_NODE_ERR("uses reference impl, but unexpectedly fused with other ops");- }+ CPU_NODE_ASSERT(canUseOptimizedImpl || fusedWith.empty(),+ "uses reference impl, but unexpectedly fused with other ops");size_t expectedInputsNum = getOpInputsNum();for (auto& postOp : fusedWith) {@@ -1555,21 +1531,19 @@ void Eltwise::initSupportedPrimitiveDescriptors() {expectedInputsNum += eltwiseNode->getOpInputsNum() - 1;}}- if (getParentEdges().size() > MAX_ELTWISE_INPUTS) {- THROW_CPU_NODE_ERR("doesn't support more than ",- MAX_ELTWISE_INPUTS,- " inputs (actual = ",- getParentEdges().size(),- ")");- }+ CPU_NODE_ASSERT(getParentEdges().size() <= MAX_ELTWISE_INPUTS,+ "doesn't support more than ",+ MAX_ELTWISE_INPUTS,+ " inputs (actual = ",+ getParentEdges().size(),+ ")");- if (expectedInputsNum != getParentEdges().size()) {- THROW_CPU_NODE_ERR("has invalid input number of inputs: expected = ",- expectedInputsNum,- " (actual = ",- getParentEdges().size(),- ")");- }+ CPU_NODE_ASSERT(expectedInputsNum == getParentEdges().size(),+ "has invalid input number of inputs: expected = ",+ expectedInputsNum,+ " (actual = ",+ getParentEdges().size(),+ ")");std::vector<ov::element::Type> inputPrecisions;for (const auto& prec : getOriginalInputPrecisions()) {@@ -1591,9 +1565,7 @@ void Eltwise::initSupportedPrimitiveDescriptors() {#endif}- if (inputPrecisions.size() != getParentEdges().size()) {- THROW_CPU_NODE_ERR("has invalid input precisions configuration.");- }+ CPU_NODE_ASSERT(inputPrecisions.size() == getParentEdges().size(), "has invalid input precisions configuration.");ov::element::Type outputPrecision = getOriginalOutputPrecisionAtPort(0);if (!fusedWith.empty()) {@@ -1619,18 +1591,19 @@ void Eltwise::initSupportedPrimitiveDescriptors() {}}- if (outputPrecision == ov::element::bf16 || hasBF16) {- THROW_CPU_NODE_ERR("doesn't support BF16 precision on this target.");- }+ CPU_NODE_ASSERT(outputPrecision != ov::element::bf16 && !hasBF16,+ "doesn't support BF16 precision on this target.");}#endif#if defined(OV_CPU_WITH_ACL)auto filterPrecision = [&](const ov::element::Type& prc, const ov::element::Type& forcedPrec) {if (isBitwise(algorithm)) {- if (std::find(supportedPrecisions.begin(), supportedPrecisions.end(), prc) == supportedPrecisions.end()) {- THROW_CPU_NODE_ERR("doesn't support ", prc, " precision.");- }+ CPU_NODE_ASSERT(+ std::find(supportedPrecisions.begin(), supportedPrecisions.end(), prc) != supportedPrecisions.end(),+ "doesn't support ",+ prc,+ " precision.");return prc;}return forcedPrec;@@ -1676,10 +1649,11 @@ void Eltwise::initSupportedPrimitiveDescriptors() {auto filterPrecision = [&](const ov::element::Type& prc) {if (implType == EltwiseImplType::reference) {if (isBitwise(algorithm)) {- if (std::find(supportedPrecisions.begin(), supportedPrecisions.end(), prc) ==- supportedPrecisions.end()) {- THROW_CPU_NODE_ERR("doesn't support ", prc, " precision.");- }+ CPU_NODE_ASSERT(std::find(supportedPrecisions.begin(), supportedPrecisions.end(), prc) !=+ supportedPrecisions.end(),+ "doesn't support ",+ prc,+ " precision.");return prc;}return ov::element::f32;@@ -1692,7 +1666,7 @@ void Eltwise::initSupportedPrimitiveDescriptors() {if (prc == ov::element::f64) {return ov::element::f32;}- THROW_CPU_NODE_ERR("doesn't support ", prc, " precision.");+ CPU_NODE_THROW("doesn't support ", prc, " precision.");} else {return prc;}@@ -1827,11 +1801,8 @@ void Eltwise::initSupportedPrimitiveDescriptors() {impl_desc_type impl_type = impl_desc_type::ref;if (useJitExecutor) {#if defined(OPENVINO_ARCH_ARM64)- if (mayiuse(dnnl::impl::cpu::aarch64::asimd)) {- impl_type = impl_desc_type::jit_asimd;- } else {- THROW_CPU_NODE_ERR("not supported architecture");- }+ CPU_NODE_ASSERT(mayiuse(dnnl::impl::cpu::aarch64::asimd), "not supported architecture");+ impl_type = impl_desc_type::jit_asimd;#elif defined(OPENVINO_ARCH_RISCV64)if (mayiuse(ov::intel_cpu::riscv64::gv)) {impl_type = impl_desc_type::jit_gv;@@ -2076,7 +2047,7 @@ void Eltwise::prepareParams() {int channelAxis = 1;node->appendPostOps(key.postOps, {}, fqDataPtrs, channelAxis);} else {- THROW_CPU_NODE_ERR("has unexpected fused op of type '", node->getTypeStr(), "'");+ CPU_NODE_THROW("has unexpected fused op of type '", node->getTypeStr(), "'");}}@@ -2177,7 +2148,7 @@ void Eltwise::execute([[maybe_unused]] const dnnl::stream& strm) {eltwiseExecPtr->exec(srcMemory, dstMemory, reinterpret_cast<void*>(fqDataPtrs.data()));} else {- THROW_CPU_NODE_ERR("Primitive isn't created");+ CPU_NODE_THROW("Primitive isn't created");}}@@ -2271,7 +2242,7 @@ void Eltwise::appendPostOpsImpl(dnnl::post_ops& ops,ops.append_eltwise(getOneDnnAlgorithm(), getAlpha(), getBeta());break;default:- THROW_CPU_NODE_ERR("Appending Eltwise node with name '", getName(), "' as post operation is not supported");+ CPU_NODE_THROW("Appending Eltwise node with name '", getName(), "' as post operation is not supported");}} else {// per-tensor EltwisePowerStatic can be implemented with more well-supported eltwise postOps@@ -2298,8 +2269,9 @@ void Eltwise::appendPostOpsImpl(dnnl::post_ops& ops,depthwiseData.insert(depthwiseData.end(), scales.begin(), scales.end());if (scales.size() == 1) {depthwiseData.resize(channelSize, depthwiseData.back());- } else if (scales.size() != channelSize) {- THROW_CPU_NODE_ERR("Appending node has failed due to scales data size inconsistency");+ } else {+ CPU_NODE_ASSERT(scales.size() == channelSize,+ "Appending node has failed due to scales data size inconsistency");}depthwiseData.insert(depthwiseData.end(), shifts.begin(), shifts.end());if (shifts.empty()) {@@ -2307,8 +2279,9 @@ void Eltwise::appendPostOpsImpl(dnnl::post_ops& ops,depthwiseData.resize(2 * channelSize, 0);} else if (shifts.size() == 1) {depthwiseData.resize(2 * channelSize, depthwiseData.back());- } else if (shifts.size() != channelSize) {- THROW_CPU_NODE_ERR("Appending node has failed due to shifts data size inconsistency");+ } else {+ CPU_NODE_ASSERT(shifts.size() == channelSize,+ "Appending node has failed due to shifts data size inconsistency");}depthwiseDataSize = 2 * channelSize;@@ -2318,9 +2291,7 @@ void Eltwise::appendPostOpsImpl(dnnl::post_ops& ops,depthwiseData.resize(depthwiseDataSize + bufferPaddingSize, 0);}- if (depthwiseData.empty()) {- THROW_CPU_NODE_ERR("cannot be performed since buffers are not allocated");- }+ CPU_NODE_ASSERT(!depthwiseData.empty(), "cannot be performed since buffers are not allocated");std::array<size_t, 2> offsets = {0};offsets[1] = offsets[0] + channelSize;@@ -2341,7 +2312,7 @@ void Eltwise::appendPostOpsImpl(dnnl::post_ops& ops,ops.append_depthwise(dnnl::algorithm::depthwise_prelu, offsets);break;default:- THROW_CPU_NODE_ERR("as post operation is not supported");+ CPU_NODE_THROW("as post operation is not supported");}appendMemory(depthwiseData, depthwiseMemory, postOpsMem);@@ -2400,7 +2371,7 @@ bool Eltwise::appendAttrPostOps(DnnlPostOpsComposerLegacy& dnnlpoc,dnnlpoc.appendLinear({getAlpha()}, {getBeta()}, isLastPostOp);break;default:- THROW_CPU_NODE_ERR("as post operation is not supported");+ CPU_NODE_THROW("as post operation is not supported");}} else {switch (getAlgorithm()) {@@ -2428,7 +2399,7 @@ bool Eltwise::appendAttrPostOps(DnnlPostOpsComposerLegacy& dnnlpoc,dnnlpoc.appendBinary(dnnl::algorithm::binary_prelu, scales);break;default:- THROW_CPU_NODE_ERR("as post operation is not supported");+ CPU_NODE_THROW("as post operation is not supported");}}return true;diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag.cppindex 7e751229eea..b2275c4e56c 100644--- a/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp+++ b/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp@@ -30,9 +30,9 @@ EmbeddingBag::EmbeddingBag(const std::shared_ptr<ov::Node>& op,DEFAULT_INDEX_IDX(defaultIndexIdx),_layerName(op->get_friendly_name()) {std::string logPrefix = std::string("Layer EmbeddingBag with name '") + _layerName + "' ";- if (op->get_input_size() < requiredInputNum || op->get_output_size() != 1) {- OPENVINO_THROW(logPrefix, "has incorrect number of input or output edges!");- }+ OPENVINO_ASSERT(op->get_input_size() >= requiredInputNum && op->get_output_size() == 1,+ logPrefix,+ "has incorrect number of input or output edges!");if ((op->get_input_size() > PER_SAMPLE_WEIGHTS_IDX)) {_withWeights = true;}@@ -83,9 +83,8 @@ void EmbeddingBag::processData(const T* srcData,withWeights = withWeights & _withWeights;size_t inIdx = 0LU;- if (static_cast<size_t>(indices[inIdx]) >= inDataDims[0]) {- OPENVINO_THROW(msgPrefix + "' has invalid embedding bag index: " + std::to_string(indices[inIdx]));- }+ OPENVINO_ASSERT(static_cast<size_t>(indices[inIdx]) < inDataDims[0],+ msgPrefix + "' has invalid embedding bag index: " + std::to_string(indices[inIdx]));size_t srcIndex = indices[inIdx] * _embDepth;if (withWeights) {@@ -100,10 +99,8 @@ void EmbeddingBag::processData(const T* srcData,}for (inIdx = 1LU; inIdx < indicesSize; inIdx++) {- if (static_cast<size_t>(indices[inIdx]) >= inDataDims[0]) {- OPENVINO_THROW(msgPrefix +- "' has invalid embedding bag index: " + std::to_string(indices[inIdx]));- }+ OPENVINO_ASSERT(static_cast<size_t>(indices[inIdx]) < inDataDims[0],+ msgPrefix + "' has invalid embedding bag index: " + std::to_string(indices[inIdx]));size_t srcIndex = indices[inIdx] * _embDepth;if (withWeights) {diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cppindex a20c091262e..5278e25e1ce 100644--- a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp+++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp@@ -66,17 +66,13 @@ EmbeddingBagOffset::EmbeddingBagOffset(const std::shared_ptr<ov::Node>& op, cons_reduction = Reduction::MEAN;break;default:- THROW_CPU_NODE_ERR("EmbeddingBagOffsets does not support reduction mode: ",- ov::as_string(offsets_op->get_reduction()));+ CPU_NODE_THROW("EmbeddingBagOffsets does not support reduction mode: ",+ ov::as_string(offsets_op->get_reduction()));}}- if (getInputShapeAtPort(INDICES_IDX).getRank() != 1UL) {- THROW_CPU_NODE_ERR("has indices data with invalid rank.");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(INDICES_IDX).getRank() == 1UL, "has indices data with invalid rank.");- if (getInputShapeAtPort(OFFSETS_IDX).getRank() != 1UL) {- THROW_CPU_NODE_ERR("offsets data has invalid rank.");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(OFFSETS_IDX).getRank() == 1UL, "offsets data has invalid rank.");}void EmbeddingBagOffset::initSupportedPrimitiveDescriptors() {@@ -95,7 +91,7 @@ void EmbeddingBagOffset::initSupportedPrimitiveDescriptors() {}if (!supportedPrecisions.empty()) {if (supportedPrecisions.find(inDataPrecision) == supportedPrecisions.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", inDataPrecision.get_type_name());+ CPU_NODE_THROW("has unsupported precision: ", inDataPrecision.get_type_name());}} else {static const std::set<ov::element::Type> defaultSupportedPrecisions = {ov::element::f32,@@ -103,7 +99,7 @@ void EmbeddingBagOffset::initSupportedPrimitiveDescriptors() {ov::element::u8,ov::element::i32};if (defaultSupportedPrecisions.find(inDataPrecision) == defaultSupportedPrecisions.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", inDataPrecision.get_type_name());+ CPU_NODE_THROW("has unsupported precision: ", inDataPrecision.get_type_name());}}@@ -140,12 +136,8 @@ void EmbeddingBagOffset::getIndices(size_t embIndex,size_t& size,int& weightsIdx,bool& withWeight) {- if (embIndex >= _offsetsLen) {- THROW_CPU_NODE_ERR("Invalid embedding bag index.");- }- if (static_cast<size_t>(offsetsData_[embIndex]) >= _indicesLen) {- THROW_CPU_NODE_ERR("Offset value exceeds indices size.");- }+ CPU_NODE_ASSERT(embIndex < _offsetsLen, "Invalid embedding bag index.");+ CPU_NODE_ASSERT(static_cast<size_t>(offsetsData_[embIndex]) < _indicesLen, "Offset value exceeds indices size.");indices = nullptr;size = 0LU;diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cppindex 21e849f9888..dd40318ce5b 100644--- a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp+++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp@@ -66,13 +66,11 @@ EmbeddingBagPacked::EmbeddingBagPacked(const std::shared_ptr<ov::Node>& op, cons_reduction = Reduction::MEAN;break;default:- THROW_CPU_NODE_ERR("EmbeddingBagPacked does not support reduction mode: ",- ov::as_string(packed_op->get_reduction()));+ CPU_NODE_THROW("EmbeddingBagPacked does not support reduction mode: ",+ ov::as_string(packed_op->get_reduction()));}}- if (getInputShapeAtPort(INDICES_IDX).getRank() != 2UL) {- THROW_CPU_NODE_ERR("has indices data with invalid rank.");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(INDICES_IDX).getRank() == 2UL, "has indices data with invalid rank.");}void EmbeddingBagPacked::initSupportedPrimitiveDescriptors() {@@ -90,17 +88,17 @@ void EmbeddingBagPacked::initSupportedPrimitiveDescriptors() {inDataPrecision = ov::element::f32;}if (!supportedPrecisions.empty()) {- if (supportedPrecisions.find(inDataPrecision) == supportedPrecisions.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", inDataPrecision.get_type_name());- }+ CPU_NODE_ASSERT(supportedPrecisions.find(inDataPrecision) != supportedPrecisions.end(),+ "has unsupported precision: ",+ inDataPrecision.get_type_name());} else {static const std::set<ov::element::Type> defaultSupportedPrecisions = {ov::element::f32,ov::element::i8,ov::element::u8,ov::element::i32};- if (defaultSupportedPrecisions.find(inDataPrecision) == defaultSupportedPrecisions.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", inDataPrecision.get_type_name());- }+ CPU_NODE_ASSERT(defaultSupportedPrecisions.find(inDataPrecision) != defaultSupportedPrecisions.end(),+ "has unsupported precision: ",+ inDataPrecision.get_type_name());}std::vector<PortConfigurator> inDataConfigurators(@@ -127,9 +125,7 @@ void EmbeddingBagPacked::getIndices(size_t embIndex,size_t& size,int& weightsIdx,bool& withWeight) {- if (embIndex >= _batch * _indicesPerBag) {- THROW_CPU_NODE_ERR("Invalid embedding bag index.");- }+ CPU_NODE_ASSERT(embIndex < _batch * _indicesPerBag, "Invalid embedding bag index.");withWeight = true;diff --git a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cppindex 3c4ce699b07..a5079322bd3 100644--- a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp+++ b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp@@ -51,13 +51,13 @@ EmbeddingSegmentsSum::EmbeddingSegmentsSum(const std::shared_ptr<ov::Node>& op,OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}_reduction = Reduction::SUM;- if (getInputShapeAtPort(INDICES_IDX).getRank() != 1UL) {- THROW_CPU_NODE_ERR("has indices data with invalid rank: ", getInputShapeAtPort(INDICES_IDX).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(INDICES_IDX).getRank() == 1UL,+ "has indices data with invalid rank: ",+ getInputShapeAtPort(INDICES_IDX).getRank());- if (getInputShapeAtPort(SEGMENT_ID_IDX).getRank() != 1UL) {- THROW_CPU_NODE_ERR("has invalid segmentID data rank: ", getInputShapeAtPort(SEGMENT_ID_IDX).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(SEGMENT_ID_IDX).getRank() == 1UL,+ "has invalid segmentID data rank: ",+ getInputShapeAtPort(SEGMENT_ID_IDX).getRank());}void EmbeddingSegmentsSum::initSupportedPrimitiveDescriptors() {@@ -75,17 +75,17 @@ void EmbeddingSegmentsSum::initSupportedPrimitiveDescriptors() {inDataPrecision = ov::element::f32;}if (!supportedPrecisions.empty()) {- if (supportedPrecisions.find(inDataPrecision) == supportedPrecisions.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", inDataPrecision.get_type_name());- }+ CPU_NODE_ASSERT(supportedPrecisions.find(inDataPrecision) != supportedPrecisions.end(),+ "has unsupported precision: ",+ inDataPrecision.get_type_name());} else {static const std::set<ov::element::Type> defaultSupportedPrecisions = {ov::element::f32,ov::element::i8,ov::element::u8,ov::element::i32};- if (defaultSupportedPrecisions.find(inDataPrecision) == defaultSupportedPrecisions.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", inDataPrecision.get_type_name());- }+ CPU_NODE_ASSERT(defaultSupportedPrecisions.find(inDataPrecision) != defaultSupportedPrecisions.end(),+ "has unsupported precision: ",+ inDataPrecision.get_type_name());}std::vector<PortConfigurator> inDataConfigurators({{LayoutType::ncsp, inDataPrecision},@@ -123,9 +123,7 @@ void EmbeddingSegmentsSum::getIndices(size_t embIndex,size_t& size,int& weightsIdx,bool& withWeight) {- if (embIndex >= static_cast<size_t>(lastNumSegments_)) {- THROW_CPU_NODE_ERR("Invalid embedding bag index.");- }+ CPU_NODE_ASSERT(embIndex < static_cast<size_t>(lastNumSegments_), "Invalid embedding bag index.");indices = nullptr;size = 0;diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.cppindex 99d40f2be11..53d2a615de1 100644--- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.cpp+++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.cpp@@ -167,9 +167,8 @@ MemoryPtr acl_fc_executor::reorderData(const DnnlMemoryDescPtr& srcWeightDesc,const ExecutorContext::CPtr& context) {MemoryPtr input = std::make_shared<Memory>(context->getEngine(), srcWeightDesc, weightsMem->getData());MemoryPtr output = std::make_shared<Memory>(context->getEngine(), dstWeightDesc);- if (!input->getDesc().isDefined() || !output->getDesc().isDefined()) {- OPENVINO_THROW("Can't reorder data with dynamic shapes");- }+ OPENVINO_ASSERT(input->getDesc().isDefined() && output->getDesc().isDefined(),+ "Can't reorder data with dynamic shapes");if (input->getShape().hasZeroDims() || output->getShape().hasZeroDims()) {return output;diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_utils.cpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_utils.cppindex c70e44a7812..12c5e71d0e1 100644--- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_utils.cpp+++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_utils.cpp@@ -88,7 +88,7 @@ MemoryPtr prepareWeightsMemory(const DnnlMemoryDescPtr& srcWeightDesc,data[i] = (high << 4) | (low & 0xF);}} else {- OPENVINO_ASSERT(false, "Unsupported data type for shiftting sign to unsign");+ OPENVINO_THROW("Unsupported data type for shiftting sign to unsign");}return _ptr;}diff --git a/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/executors/interpolate.cppindex 828ff4e9d4a..6fdb4646e90 100644--- a/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp+++ b/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp@@ -576,9 +576,8 @@ const uint8_t* ov::intel_cpu::InterpolateExecutor::padPreprocess(const std::vectsize_t eltsTotal = srcDimPad5d[0] * CB * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize;srcPadded.resize(eltsTotal * srcDataSize, 0x0);auto* src_data_pad = static_cast<uint8_t*>(srcPadded.data());- if ((srcDim5d[0] != srcDimPad5d[0]) || (srcDim5d[1] != srcDimPad5d[1])) {- OPENVINO_THROW("Interpolate executor does not support padding on batch and channel dimensions");- }+ OPENVINO_ASSERT(srcDim5d[0] == srcDimPad5d[0] && srcDim5d[1] == srcDimPad5d[1],+ "Interpolate executor does not support padding on batch and channel dimensions");parallel_for5d(srcDim5d[0],CB,diff --git a/src/plugins/intel_cpu/src/nodes/executors/shl/shl.hpp b/src/plugins/intel_cpu/src/nodes/executors/shl/shl.hppindex 8af7c8869ad..7161e6e93b8 100644--- a/src/plugins/intel_cpu/src/nodes/executors/shl/shl.hpp+++ b/src/plugins/intel_cpu/src/nodes/executors/shl/shl.hpp@@ -34,7 +34,7 @@ public:[[nodiscard]] T get(bool allow_empty = false) const {T result = m_ptr.get();- OPENVINO_ASSERT(allow_empty || result != nullptr, "ShlStructure is not initialized");+ OPENVINO_ASSERT(allow_empty || result, "ShlStructure is not initialized");return result;}@@ -74,7 +74,7 @@ struct ShlStructureTraits<csinn_session*> {struct ShlSession : public ShlStructure<csinn_session*> {ShlSession() {csinn_session* session = csinn_alloc_session();- OPENVINO_ASSERT(session != nullptr, "Failed to create csinn_session");+ OPENVINO_ASSERT(session, "Failed to create csinn_session");// CPU Plugin supports only per layer execution in SHLsession->base_run_mode = CSINN_RM_LAYER;reset(session);@@ -90,13 +90,13 @@ struct ShlStructureTraits<csinn_tensor*> {struct ShlTensor : public ShlStructure<csinn_tensor*> {ShlTensor() {csinn_tensor* tensor = csinn_alloc_tensor(nullptr);- OPENVINO_ASSERT(tensor != nullptr, "Failed to create csinn_tensor");+ OPENVINO_ASSERT(tensor, "Failed to create csinn_tensor");reset(tensor);}ShlTensor(const ShlSession& session) {csinn_tensor* tensor = csinn_alloc_tensor(session.get());- OPENVINO_ASSERT(tensor != nullptr, "Failed to create csinn_tensor");+ OPENVINO_ASSERT(tensor, "Failed to create csinn_tensor");reset(tensor);}@@ -185,13 +185,13 @@ template <typename T, typename traits = ShlStructureTraits<T>>struct ShlParams : public ShlStructure<T>, public IShlParams {ShlParams() {T params = static_cast<T>(csinn_alloc_params(sizeof(std::remove_pointer_t<T>), nullptr));- OPENVINO_ASSERT(params != nullptr, "Failed to create csinn_params");+ OPENVINO_ASSERT(params, "Failed to create csinn_params");this->reset(params);}ShlParams(const ShlSession& session) {T params = static_cast<T>(csinn_alloc_params(sizeof(std::remove_pointer_t<T>), session.get()));- OPENVINO_ASSERT(params != nullptr, "Failed to create csinn_params");+ OPENVINO_ASSERT(params, "Failed to create csinn_params");this->reset(params);}diff --git a/src/plugins/intel_cpu/src/nodes/executors/x64/jit_transpose.cpp b/src/plugins/intel_cpu/src/nodes/executors/x64/jit_transpose.cppindex 57cdd37ddc4..86a34d25a93 100644--- a/src/plugins/intel_cpu/src/nodes/executors/x64/jit_transpose.cpp+++ b/src/plugins/intel_cpu/src/nodes/executors/x64/jit_transpose.cpp@@ -21,10 +21,7 @@ using namespace dnnl::impl::cpu::x64;namespace ov::intel_cpu {void JitTransposeExecutor::exec(const std::vector<MemoryCPtr>& src, const std::vector<MemoryPtr>& dst) {- if (!pKernel) {- OPENVINO_THROW("Could not execute. Kernel for Transpose node was not compiled.");- }-+ OPENVINO_ASSERT(pKernel, "Could not execute. Kernel for Transpose node was not compiled.");const auto* srcData = src[0]->getDataAs<const uint8_t>();auto* dstData = dst[0]->getDataAs<uint8_t>();const int MB = src[0]->getStaticDims()[0];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 f5be2b8d557..9569c52131b 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@@ -349,7 +349,7 @@ void ExperimentalDetectronGenerateProposalsSingleImage::initSupportedPrimitiveDevoid ExperimentalDetectronGenerateProposalsSingleImage::execute([[maybe_unused]] const dnnl::stream& strm) {try {if (inputShapes.size() != 4 || outputShapes.size() != 2) {- THROW_CPU_NODE_ERR("Incorrect number of input or output edges!");+ CPU_NODE_THROW("Incorrect number of input or output edges!");}size_t anchor_dims_size = 1;@@ -363,18 +363,16 @@ void ExperimentalDetectronGenerateProposalsSingleImage::execute([[maybe_unused]]for (uint64_t deltaDim : deltaDims) {deltas_dims_size *= deltaDim;}- if (anchor_dims_size != deltas_dims_size) {- THROW_CPU_NODE_ERR("'Anchors' blob size for ONNXProposal is incompatible with 'deltas' blob size!");- }+ CPU_NODE_ASSERT(anchor_dims_size == deltas_dims_size,+ "'Anchors' blob size for ONNXProposal is incompatible with 'deltas' blob size!");size_t score_dims_size = 1;const auto& scoreDims = getParentEdgeAt(INPUT_SCORES)->getMemory().getStaticDims();for (uint64_t scoreDim : scoreDims) {score_dims_size *= scoreDim;}- if (deltas_dims_size != (4 * score_dims_size)) {- THROW_CPU_NODE_ERR("'Deltas' blob size for ONNXProposal is incompatible with 'scores' blob size!");- }+ CPU_NODE_ASSERT(deltas_dims_size == (4 * score_dims_size),+ "'Deltas' blob size for ONNXProposal is incompatible with 'scores' blob size!");// Prepare memoryconst auto* p_deltas_item = getSrcDataAtPortAs<const float>(INPUT_DELTAS);@@ -467,7 +465,7 @@ void ExperimentalDetectronGenerateProposalsSingleImage::execute([[maybe_unused]]post_nms_topn_);}} catch (const std::exception& e) {- THROW_CPU_NODE_ERR(e.what());+ CPU_NODE_THROW(e.what());}}diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cppindex 2f2dbe8afad..d73628f0e0b 100644--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp@@ -47,7 +47,7 @@ ExperimentalDetectronPriorGridGenerator::ExperimentalDetectronPriorGridGeneratorconst auto priorGridGen = ov::as_type_ptr<const ov::op::v6::ExperimentalDetectronPriorGridGenerator>(op);if (getOriginalInputsNumber() != 3 || getOriginalOutputsNumber() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");+ CPU_NODE_THROW("has incorrect number of input/output edges!");}const auto& attr = priorGridGen->get_attrs();diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cppindex 31e40a4d0a0..e1d7314e1ca 100644--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp@@ -50,17 +50,12 @@ ExperimentalDetectronTopKROIs::ExperimentalDetectronTopKROIs(const std::shared_p}const auto topKROI = ov::as_type_ptr<const ov::op::v6::ExperimentalDetectronTopKROIs>(op);- if (topKROI == nullptr) {- THROW_CPU_NODE_ERR("is not an instance of ExperimentalDetectronTopKROIs from opset6.");- }+ CPU_NODE_ASSERT(topKROI, "is not an instance of ExperimentalDetectronTopKROIs from opset6.");- if (inputShapes.size() != 2 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 2 && outputShapes.size() == 1, "has incorrect number of input/output edges!");- if (getInputShapeAtPort(INPUT_ROIS).getRank() != 2 || getInputShapeAtPort(INPUT_PROBS).getRank() != 1) {- THROW_CPU_NODE_ERR("has unsupported input shape");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(INPUT_ROIS).getRank() == 2 && getInputShapeAtPort(INPUT_PROBS).getRank() == 1,+ "has unsupported input shape");max_rois_num_ = topKROI->get_max_rois();}diff --git a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cppindex 4a20391e76c..f88814c2020 100644--- a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp+++ b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp@@ -399,19 +399,19 @@ ExtractImagePatches::ExtractImagePatches(const std::shared_ptr<ov::Node>& op, coauto extImgPatcher = ov::as_type_ptr<const ov::op::v3::ExtractImagePatches>(op);if (inputShapes.size() != 1 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input or output edges!",- " Input: ",- inputShapes.size(),- "); Output: ",- outputShapes.size());+ CPU_NODE_THROW("has incorrect number of input or output edges!",+ " Input: ",+ inputShapes.size(),+ "); Output: ",+ outputShapes.size());}if (getInputShapeAtPort(0).getRank() != 4) {- THROW_CPU_NODE_ERR("must have 4D input tensor. Actual: ", getInputShapeAtPort(0).getRank());+ CPU_NODE_THROW("must have 4D input tensor. Actual: ", getInputShapeAtPort(0).getRank());}if (getOutputShapeAtPort(0).getRank() != 4) {- THROW_CPU_NODE_ERR("must have 4D output tensor. Actual: ", getOutputShapeAtPort(0).getRank());+ CPU_NODE_THROW("must have 4D output tensor. Actual: ", getOutputShapeAtPort(0).getRank());}if (extImgPatcher->get_auto_pad() == ov::op::PadType::VALID) {@@ -421,7 +421,7 @@ ExtractImagePatches::ExtractImagePatches(const std::shared_ptr<ov::Node>& op, co} else if (extImgPatcher->get_auto_pad() == ov::op::PadType::SAME_UPPER) {_auto_pad = ExtImgPatcherPadType::SAME_UPPER;} else {- THROW_CPU_NODE_ERR("has unsupported pad type: ", extImgPatcher->get_auto_pad());+ CPU_NODE_THROW("has unsupported pad type: ", extImgPatcher->get_auto_pad());}_ksizes = extImgPatcher->get_sizes();@@ -429,7 +429,7 @@ ExtractImagePatches::ExtractImagePatches(const std::shared_ptr<ov::Node>& op, co_strides = extImgPatcher->get_strides();_rates = extImgPatcher->get_rates();if (_ksizes.size() != 2 || _strides.size() != 2 || _rates.size() != 2) {- THROW_CPU_NODE_ERR("must have the following attributes with shape {2}: sizes, strides, rates.");+ CPU_NODE_THROW("must have the following attributes with shape {2}: sizes, strides, rates.");}}@@ -437,13 +437,13 @@ void ExtractImagePatches::prepareParams() {const auto& srcMemPtr0 = getSrcMemoryAtPort(0);const auto& dstMemPtr = getDstMemoryAtPort(0);if (!srcMemPtr0 || !srcMemPtr0->isDefined()) {- THROW_CPU_NODE_ERR("Input memory is undefined.");+ CPU_NODE_THROW("Input memory is undefined.");}if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Destination memory is undefined.");+ CPU_NODE_THROW("Destination memory is undefined.");}if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");+ CPU_NODE_THROW("Preferable primitive descriptor is not set.");}const auto& in_dims = getParentEdgeAt(0)->getMemory().getStaticDims();@@ -481,7 +481,7 @@ void ExtractImagePatches::initSupportedPrimitiveDescriptors() {const auto precision = getOriginalInputPrecisionAtPort(0);if (_supported_precisions_sizes.find(precision.size()) == _supported_precisions_sizes.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", precision.get_type_name());+ CPU_NODE_THROW("has unsupported precision: ", precision.get_type_name());}addSupportedPrimDesc({{LayoutType::ncsp, precision}}, {{LayoutType::ncsp, precision}}, impl_desc_type::ref_any);@@ -495,7 +495,7 @@ void ExtractImagePatches::execute([[maybe_unused]] const dnnl::stream& strm) {const auto outStrides = getChildEdgeAt(0)->getMemory().getDescWithType<BlockedMemoryDesc>()->getStrides();execPtr->exec(src, dst, inStrides, outStrides);} else {- THROW_CPU_NODE_ERR("Primitive wasn't created");+ CPU_NODE_THROW("Primitive wasn't created");}}@@ -701,9 +701,7 @@ void ExtractImagePatches::ExtractImagePatchesJitExecutor::exec(void* src,void* dst,const VectorDims& istrides,const VectorDims& ostrides) {- if (!pKernel) {- OPENVINO_THROW("Can't execute, kernel for extract image patches node is not compiled");- }+ OPENVINO_ASSERT(pKernel, "Can't execute, kernel for extract image patches node is not compiled");executeOptimizedGeneric(src, dst, istrides, ostrides);}diff --git a/src/plugins/intel_cpu/src/nodes/eye.cpp b/src/plugins/intel_cpu/src/nodes/eye.cppindex d693e7720b8..f02a2e4884a 100644--- a/src/plugins/intel_cpu/src/nodes/eye.cpp+++ b/src/plugins/intel_cpu/src/nodes/eye.cpp@@ -53,16 +53,16 @@ Eye::Eye(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)outType = op->get_output_element_type(0);withBatchShape = (op->get_input_size() == 4);if (!one_of(outType, ov::element::f32, ov::element::bf16, ov::element::i32, ov::element::i8, ov::element::u8)) {- THROW_CPU_NODE_ERR("doesn't support demanded output precision");+ CPU_NODE_THROW("doesn't support demanded output precision");}}void Eye::getSupportedDescriptors() {if (!one_of(getParentEdges().size(), 3U, 4U)) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getParentEdges().size());+ CPU_NODE_THROW("has incorrect number of input edges: ", getParentEdges().size());}if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getChildEdges().size());+ CPU_NODE_THROW("has incorrect number of output edges: ", getChildEdges().size());}}@@ -110,7 +110,7 @@ void Eye::executeSpecified() {const int64_t shift = getDiagIndex();auto outPtr = getDstMemoryAtPort(0);if (!outPtr || !outPtr->isDefined()) {- THROW_CPU_NODE_ERR("Destination memory is undefined.");+ CPU_NODE_THROW("Destination memory is undefined.");}T* dst = outPtr->getDataAs<T>();diff --git a/src/plugins/intel_cpu/src/nodes/eye.h b/src/plugins/intel_cpu/src/nodes/eye.hindex 74a5b17c177..314132bb7d2 100644--- a/src/plugins/intel_cpu/src/nodes/eye.h+++ b/src/plugins/intel_cpu/src/nodes/eye.h@@ -51,27 +51,21 @@ private:struct EyeExecute;size_t getRowNum() const {auto rowMem = getSrcMemoryAtPort(ROWS_NUM);- if (rowMem == nullptr) {- THROW_CPU_NODE_ERR("doesn't contain row_count data");- }+ CPU_NODE_ASSERT(rowMem, "doesn't contain row_count data");const auto* rowPtr = rowMem->getDataAs<const int>();return rowPtr[0];}size_t getColNum() const {auto colMem = getSrcMemoryAtPort(COLS_NUM);- if (colMem == nullptr) {- THROW_CPU_NODE_ERR("doesn't contain col_count data");- }+ CPU_NODE_ASSERT(colMem, "doesn't contain col_count data");const auto* colPtr = colMem->getDataAs<const int>();return colPtr[0];}int getDiagIndex() const {auto diagIndMem = getSrcMemoryAtPort(DIAGONAL_INDEX);- if (diagIndMem == nullptr) {- THROW_CPU_NODE_ERR("doesn't contain diag_index data");- }+ CPU_NODE_ASSERT(diagIndMem, "doesn't contain diag_index data");const auto* diagIndexPtr = diagIndMem->getDataAs<const int>();return diagIndexPtr[0];diff --git a/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp b/src/plugins/intel_cpu/src/nodes/fake_quantize.cppindex c26ec52febd..0e1334389cc 100644--- a/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp+++ b/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp@@ -1151,16 +1151,10 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConteconst auto fq = ov::as_type_ptr<const ov::op::v0::FakeQuantize>(op);levels = fq->get_levels();- if (levels <= 1) {- THROW_CPU_NODE_ERR("supports 'levels' attribute greater than or equal to 2");- }+ CPU_NODE_ASSERT(levels > 1, "supports 'levels' attribute greater than or equal to 2");- if (inputShapes.size() != 5) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", inputShapes.size());- }- if (outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", outputShapes.size());- }+ CPU_NODE_ASSERT(inputShapes.size() == 5, "has incorrect number of input edges: ", inputShapes.size());+ CPU_NODE_ASSERT(outputShapes.size() == 1, "has incorrect number of output edges: ", outputShapes.size());auto initAxisIdx = [&](const VectorDims& inputDims) {size_t axisIdx = 0;@@ -1214,9 +1208,8 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConteauto outputLowAxisSize = ov::is_scalar(olShape) ? 1 : olShape[outputLowAxis];auto outputHighAxisSize = ov::is_scalar(ohShape) ? 1 : ohShape[outputHighAxis];- if (axisSize != -1 && !dimsEqualWeak(axisSize, getInputShapeAtPort(0).getDims()[axis])) {- THROW_CPU_NODE_ERR("has different quantization axis size on 'data' and 'range' inputs");- }+ CPU_NODE_ASSERT(axisSize == -1 || dimsEqualWeak(axisSize, getInputShapeAtPort(0).getDims()[axis]),+ "has different quantization axis size on 'data' and 'range' inputs");const auto inputLowNode = ov::as_type_ptr<const ov::op::v0::Constant>(fq->get_input_node_shared_ptr(1));auto inputLowData = inputLowNode->cast_vector<float>();@@ -1371,7 +1364,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConte#if defined(VALIDATE_QUANTIZATION_RANGES)if ((il == ih && levels != 2) || il > ih || std::isnan(il) || std::isnan(ih) || std::isinf(il) ||std::isinf(ih)) {- THROW_CPU_NODE_ERR("has invalid input quantize ranges: ", "inputLow = ", il, ", inputHigh = ", ih);+ CPU_NODE_THROW("has invalid input quantize ranges: ", "inputLow = ", il, ", inputHigh = ", ih);}#endif#ifdef FQ_DOUBLE_PRECISION@@ -1389,7 +1382,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConte#if defined(VALIDATE_QUANTIZATION_RANGES)if (std::isnan(ol) || std::isnan(oh) || std::isinf(ol) || std::isinf(oh)) {- THROW_CPU_NODE_ERR("has wrong output quantize ranges: ", "outputLow = ", ol, ", outputHigh = ", oh);+ CPU_NODE_THROW("has wrong output quantize ranges: ", "outputLow = ", ol, ", outputHigh = ", oh);}#endif#ifdef FQ_DOUBLE_PRECISION@@ -1490,30 +1483,19 @@ void FakeQuantize::init() {}void FakeQuantize::getSupportedDescriptors() {- if (getParentEdges().size() != 5) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getParentEdges().size());- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getChildEdges().size());- }+ CPU_NODE_ASSERT(getParentEdges().size() == 5, "has incorrect number of input edges: ", getParentEdges().size());+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges: ", getChildEdges().size());- if (getInputShapeAtPort(0).getRank() != getOutputShapeAtPort(0).getRank()) {- THROW_CPU_NODE_ERR("has different ranks for input and output tensors");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(0).getRank() == getOutputShapeAtPort(0).getRank(),+ "has different ranks for input and output tensors");if (isBinarization()) {- if (getInputShapeAtPort(0).getRank() != 4UL) {- THROW_CPU_NODE_ERR("doesn't support input/output rank != 4");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(0).getRank() == 4UL, "doesn't support input/output rank != 4");}if (getAxis() != 1) {- if (isBinarization()) {- THROW_CPU_NODE_ERR("doesn't support non per-tensor binarization for axis: ", getAxis());- }- if (getAxis() != 0) {- THROW_CPU_NODE_ERR("doesn't support non per-tensor quantization for axis: ", getAxis());- }+ CPU_NODE_ASSERT(!isBinarization(), "doesn't support non per-tensor binarization for axis: ", getAxis());+ CPU_NODE_ASSERT(getAxis() == 0, "doesn't support non per-tensor quantization for axis: ", getAxis());}}@@ -1582,9 +1564,7 @@ void FakeQuantize::initSupportedPrimitiveDescriptors() {bool FakeQuantize::needPrepareParams() const {if (isBinarization()) {const auto* selectedPrimitiveDescriptor = getSelectedPrimitiveDescriptor();- if (!selectedPrimitiveDescriptor) {- THROW_CPU_NODE_ERR("doesn't have primitive descriptors.");- }+ CPU_NODE_ASSERT(selectedPrimitiveDescriptor, "doesn't have primitive descriptors.");if (internalBlobMemory.empty() ||(selectedPrimitiveDescriptor->getImplementationType() != impl_desc_type::ref && inputShapesModified())) {@@ -1660,9 +1640,7 @@ void FakeQuantize::prepareParams() {void FakeQuantize::createPrimitive() {Node::createPrimitive();auto* selectedPrimitiveDescriptor = getSelectedPrimitiveDescriptor();- if (!selectedPrimitiveDescriptor) {- THROW_CPU_NODE_ERR("doesn't have primitive descriptors.");- }+ CPU_NODE_ASSERT(selectedPrimitiveDescriptor, "doesn't have primitive descriptors.");if (selectedPrimitiveDescriptor->getImplementationType() != impl_desc_type::ref) {const auto& config = getSelectedPrimitiveDescriptor()->getConfig();@@ -2483,10 +2461,7 @@ FakeQuantize::FakeQuantizeJitExecutor::FakeQuantizeJitExecutor([[maybe_unused]]}void FakeQuantize::FakeQuantizeJitExecutor::exec(const FakeQuantize& node) {- if (!pKernel) {- OPENVINO_THROW("Can't execute, kernel for fake quantize node is not compiled");- }-+ OPENVINO_ASSERT(pKernel, "Can't execute, kernel for fake quantize node is not compiled");if (pKernel->jqp_.op_type == Algorithm::FQBinarization) {node.executeBinarization(pKernel);} else {diff --git a/src/plugins/intel_cpu/src/nodes/gather.cpp b/src/plugins/intel_cpu/src/nodes/gather.cppindex 4a1620e683a..41dee086264 100644--- a/src/plugins/intel_cpu/src/nodes/gather.cpp+++ b/src/plugins/intel_cpu/src/nodes/gather.cpp@@ -91,8 +91,9 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& coif (one_of(op->get_input_size(), 4U, 5U) && op->get_output_size() == 1U) {compressed = true;- } else if (op->get_input_size() != 3 || op->get_output_size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");+ } else {+ CPU_NODE_ASSERT(op->get_input_size() == 3 && op->get_output_size() == 1,+ "has incorrect number of input/output edges!");}const auto& dataShape = getInputShapeAtPort(GATHER_DATA);@@ -102,9 +103,7 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& coconst auto& idxShape = getInputShapeAtPort(GATHER_INDICES);isIdxShapeStat = idxShape.isStatic();const auto indicesRank = idxShape.getRank();- if (dataSrcRank == 0LU || indicesRank == 0LU) {- THROW_CPU_NODE_ERR("has incorrect input parameters ranks.");- }+ CPU_NODE_ASSERT(dataSrcRank != 0LU && indicesRank != 0LU, "has incorrect input parameters ranks.");if (ov::is_type<ov::op::v8::Gather>(op)) {batchDims = static_cast<int>(ov::as_type_ptr<ov::op::v8::Gather>(op)->get_batch_dims());@@ -125,9 +124,10 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& coif (batchDims < 0) {batchDims += indicesRank;}- if (batchDims < 0 || batchDims > std::min(dataSrcRank, static_cast<int>(indicesRank))) {- THROW_CPU_NODE_ERR("has incorrect batch_dims ", batchDims, "!");- }+ CPU_NODE_ASSERT(batchDims >= 0 && batchDims <= std::min(dataSrcRank, static_cast<int>(indicesRank)),+ "has incorrect batch_dims ",+ batchDims,+ "!");if (ov::is_type<ov::op::v0::Constant>(op->get_input_node_ptr(GATHER_AXIS))) {isAxisInputConst = true;@@ -135,9 +135,9 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& coif (axis < 0) {axis += dataSrcRank;}- if (axis < 0 || axis >= dataSrcRank || batchDims > axis) {- THROW_CPU_NODE_ERR("has incorrect input parameter axis value: ", axis);- }+ CPU_NODE_ASSERT(axis >= 0 && axis < dataSrcRank && batchDims <= axis,+ "has incorrect input parameter axis value: ",+ axis);}if (auto* indices = ov::as_type<ov::op::v0::Constant>(op->get_input_node_ptr(GATHER_INDICES))) {@@ -381,14 +381,14 @@ bool Gather::needPrepareParams() const {void Gather::prepareParams() {auto dataMemPtr = getSrcMemoryAtPort(GATHER_DATA);if (!dataMemPtr || !dataMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input data memory.");+ CPU_NODE_THROW("has undefined input data memory.");}auto idxMemPtr = getSrcMemoryAtPort(GATHER_INDICES);if (!idxMemPtr || !idxMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input indices memory.");+ CPU_NODE_THROW("has undefined input indices memory.");}if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor.");+ CPU_NODE_THROW("has unidentified preferable primitive descriptor.");}// short 1D vector fast execution impl (typical in shape infer subgraph)@@ -408,9 +408,9 @@ void Gather::prepareParams() {if (axis < 0) {axis += dataSrcRank;}- if (axis < 0 || axis >= dataSrcRank || batchDims > axis) {- THROW_CPU_NODE_ERR("has incorrect input parameter axis value: ", axis);- }+ CPU_NODE_ASSERT(axis >= 0 && axis < dataSrcRank && batchDims <= axis,+ "has incorrect input parameter axis value: ",+ axis);}if (!isDataShapeStat || !isAxisInputConst) {@@ -605,9 +605,7 @@ void Gather::executeDynamicImpl([[maybe_unused]] const dnnl::stream& strm) {}void Gather::initShortParams(threadExecParams& p, const uint64_t start) {- if (!jitKernel) {- THROW_CPU_NODE_ERR("has uninitialized kernel in function initShortParams.");- }+ CPU_NODE_ASSERT(jitKernel, "has uninitialized kernel in function initShortParams.");const uint64_t idxElPerVec = jitKernel->getIdxElPerVec();if (afterAxisSize == 1) { // Elementwise gather.@@ -1006,9 +1004,7 @@ void Gather::resolveInPlaceEdges(Edge::LOOK look) {}auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(selected_pd, "Preferable primitive descriptor is not set.");constexpr size_t outputPort = 0;const auto& config = selected_pd->getConfig();diff --git a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp b/src/plugins/intel_cpu/src/nodes/gather_elements.cppindex ed1da29f777..ea5014bd7b9 100644--- a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp+++ b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp@@ -48,24 +48,19 @@ GatherElements::GatherElements(const std::shared_ptr<ov::Node>& op, const GraphCif (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (inputShapes.size() != 2 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has invalid number of input/output edges.");- }+ CPU_NODE_ASSERT(inputShapes.size() == 2 && outputShapes.size() == 1, "has invalid number of input/output edges.");const auto dataRank = getInputShapeAtPort(dataIndex_).getRank();const auto indicesRank = getInputShapeAtPort(indicesIndex_).getRank();- if (dataRank != indicesRank) {- THROW_CPU_NODE_ERR("has invalid input shapes. Inputs 'Data' and 'Indices' must have equal ranks.");- }+ CPU_NODE_ASSERT(dataRank == indicesRank,+ "has invalid input shapes. Inputs 'Data' and 'Indices' must have equal ranks.");auto gatherElementsOp = ov::as_type_ptr<ov::op::v6::GatherElements>(op);auto axis = gatherElementsOp->get_axis();if (axis < 0) {axis += dataRank;}- if (axis < 0 || axis >= static_cast<int>(dataRank)) {- THROW_CPU_NODE_ERR("has invalid axis attribute: ", axis);- }+ CPU_NODE_ASSERT(axis >= 0 && axis < static_cast<int>(dataRank), "has invalid axis attribute: ", axis);axis_ = axis;}@@ -93,17 +88,17 @@ void GatherElements::initSupportedPrimitiveDescriptors() {}ov::element::Type inDataPrecision = getOriginalInputPrecisionAtPort(dataIndex_);- if (!one_of(inDataPrecision.size(),- sizeof(element_type_traits<ov::element::i32>::value_type),- sizeof(element_type_traits<ov::element::i16>::value_type),- sizeof(element_type_traits<ov::element::i8>::value_type))) {- THROW_CPU_NODE_ERR("has unsupported 'inputData' input precision: ", inDataPrecision);- }+ CPU_NODE_ASSERT(one_of(inDataPrecision.size(),+ sizeof(element_type_traits<ov::element::i32>::value_type),+ sizeof(element_type_traits<ov::element::i16>::value_type),+ sizeof(element_type_traits<ov::element::i8>::value_type)),+ "has unsupported 'inputData' input precision: ",+ inDataPrecision);ov::element::Type indicesPrecision = getOriginalInputPrecisionAtPort(indicesIndex_);- if (!one_of(indicesPrecision, ov::element::i32, ov::element::i64)) {- THROW_CPU_NODE_ERR("has unsupported 'indices' input precision: ", indicesPrecision);- }+ CPU_NODE_ASSERT(one_of(indicesPrecision, ov::element::i32, ov::element::i64),+ "has unsupported 'indices' input precision: ",+ indicesPrecision);dataTypeSize_ = inDataPrecision.size();@@ -175,7 +170,7 @@ void GatherElements::execute([[maybe_unused]] const dnnl::stream& strm) {break;}default:- THROW_CPU_NODE_ERR("Unsupported data type size");+ CPU_NODE_THROW("Unsupported data type size");}}diff --git a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp b/src/plugins/intel_cpu/src/nodes/gather_nd.cppindex 22faa1fe5a0..041ed4388d8 100644--- a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp+++ b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp@@ -59,7 +59,7 @@ GatherND::GatherND(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr}if (inputShapes.size() != 2 && outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has invalid number of input/output edges.");+ CPU_NODE_THROW("has invalid number of input/output edges.");}const size_t dataInputRank = getInputShapeAtPort(GATHERND_DATA).getRank();@@ -70,10 +70,10 @@ GatherND::GatherND(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr} else if (auto gatherNdOp = ov::as_type_ptr<const ov::op::v5::GatherND>(op)) {attrs.batchDims = gatherNdOp->get_batch_dims();} else {- THROW_CPU_NODE_ERR("has support only opset5.");+ CPU_NODE_THROW("has support only opset5.");}if (attrs.batchDims >= std::min(dataInputRank, indicesInputRank)) {- THROW_CPU_NODE_ERR("has invalid batch_dims attribute: ", attrs.batchDims);+ CPU_NODE_THROW("has invalid batch_dims attribute: ", attrs.batchDims);}}@@ -87,7 +87,7 @@ void GatherND::initSupportedPrimitiveDescriptors() {sizeof(element_type_traits<ov::element::i32>::value_type),sizeof(element_type_traits<ov::element::i16>::value_type),sizeof(element_type_traits<ov::element::i8>::value_type))) {- THROW_CPU_NODE_ERR("has unsupported 'data' input precision: ", inDataPrecision);+ CPU_NODE_THROW("has unsupported 'data' input precision: ", inDataPrecision);}attrs.dataSize = inDataPrecision.size();@@ -99,7 +99,7 @@ void GatherND::initSupportedPrimitiveDescriptors() {ov::element::u16,ov::element::i8,ov::element::u8)) {- THROW_CPU_NODE_ERR("has unsupported 'indices' input precision: ", indicesPrecision);+ CPU_NODE_THROW("has unsupported 'indices' input precision: ", indicesPrecision);}addSupportedPrimDesc({{LayoutType::ncsp, inDataPrecision}, {LayoutType::ncsp, ov::element::i32}},@@ -111,18 +111,10 @@ void GatherND::prepareParams() {auto srcMemPtr = getSrcMemoryAtPort(GATHERND_DATA);auto idxMemPtr = getSrcMemoryAtPort(GATHERND_INDEXES);auto dstMemPtr = getDstMemoryAtPort(0);- if (!srcMemPtr || !srcMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'data'.");- }- if (!idxMemPtr || !idxMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'indices'.");- }- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined output memory.");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor.");- }+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "has undefined input memory of 'data'.");+ CPU_NODE_ASSERT(idxMemPtr && idxMemPtr->isDefined(), "has undefined input memory of 'indices'.");+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined output memory.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor() != nullptr, "has unidentified preferable primitive descriptor.");attrs.srcDims = srcMemPtr->getStaticDims();attrs.srcStrides = srcMemPtr->getDescWithType<BlockedMemoryDesc>()->getStrides();@@ -166,9 +158,7 @@ GatherND::GatherNDExecutor::GatherNDExecutor(const GatherNDAttributes& attrs)}void GatherND::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("has not compiled executor.");- }+ CPU_NODE_ASSERT(execPtr, "has not compiled executor.");execPtr->exec(getSrcMemoryAtPort(GATHERND_DATA), getSrcMemoryAtPort(GATHERND_INDEXES), getDstMemoryAtPort(0));}diff --git a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp b/src/plugins/intel_cpu/src/nodes/gather_tree.cppindex 270cbd860ae..a185d2124e6 100644--- a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp+++ b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp@@ -53,25 +53,15 @@ GatherTree::GatherTree(const std::shared_ptr<ov::Node>& op, const GraphContext::OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (inputShapes.size() != 4) {- THROW_CPU_NODE_ERR("has incorrect number of input edges.");- }- if (outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of output edges.");- }-- if (getInputShapeAtPort(GATHER_TREE_STEP_IDX).getRank() != 3) {- THROW_CPU_NODE_ERR("step_idx vector should be 3 dimension");- }- if (getInputShapeAtPort(GATHER_TREE_PARENT_IDX).getRank() != 3) {- THROW_CPU_NODE_ERR("parent_idx vector should be 3 dimension");- }- if (getInputShapeAtPort(GATHER_TREE_MAX_SEQ_LEN).getRank() != 1) {- THROW_CPU_NODE_ERR("max_seq_len vector should be 1 dimension");- }- if (!is_scalar(op->get_input_partial_shape(GATHER_TREE_END_TOKEN))) {- THROW_CPU_NODE_ERR("end_token should be scalar");- }+ CPU_NODE_ASSERT(inputShapes.size() == 4, "has incorrect number of input edges.");+ CPU_NODE_ASSERT(outputShapes.size() == 1, "has incorrect number of output edges.");++ CPU_NODE_ASSERT(getInputShapeAtPort(GATHER_TREE_STEP_IDX).getRank() == 3, "step_idx vector should be 3 dimension");+ CPU_NODE_ASSERT(getInputShapeAtPort(GATHER_TREE_PARENT_IDX).getRank() == 3,+ "parent_idx vector should be 3 dimension");+ CPU_NODE_ASSERT(getInputShapeAtPort(GATHER_TREE_MAX_SEQ_LEN).getRank() == 1,+ "max_seq_len vector should be 1 dimension");+ CPU_NODE_ASSERT(is_scalar(op->get_input_partial_shape(GATHER_TREE_END_TOKEN)), "end_token should be scalar");}void GatherTree::initSupportedPrimitiveDescriptors() {@@ -88,7 +78,7 @@ void GatherTree::initSupportedPrimitiveDescriptors() {getOriginalInputPrecisionAtPort(GATHER_TREE_MAX_SEQ_LEN) != precision ||getOriginalInputPrecisionAtPort(GATHER_TREE_END_TOKEN) != precision ||getOriginalOutputPrecisionAtPort(0) != precision) {- THROW_CPU_NODE_ERR("has incorrect input/output data precision. Must be the same.");+ CPU_NODE_THROW("has incorrect input/output data precision. Must be the same.");}addSupportedPrimDesc({{LayoutType::ncsp, precision},@@ -100,9 +90,7 @@ void GatherTree::initSupportedPrimitiveDescriptors() {}void GatherTree::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("has not compiled executor.");- }+ CPU_NODE_ASSERT(execPtr, "has not compiled executor.");if (precision == ov::element::f32) {execPtr->exec<float>(getSrcMemoryAtPort(GATHER_TREE_STEP_IDX),@@ -125,21 +113,11 @@ void GatherTree::prepareParams() {const auto& maxSeqLenMemPtr = getSrcMemoryAtPort(GATHER_TREE_MAX_SEQ_LEN);const auto& dstMemPtr = getDstMemoryAtPort(0);- if (!stepIdxMemPtr || !stepIdxMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'step_ids'.");- }- if (!parentIdxMemPtr || !parentIdxMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'parent_ids'.");- }- if (!maxSeqLenMemPtr || !maxSeqLenMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'max_seq_len'.");- }- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined output memory.");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor.");- }+ CPU_NODE_ASSERT(stepIdxMemPtr && stepIdxMemPtr->isDefined(), "has undefined input memory of 'step_ids'.");+ CPU_NODE_ASSERT(parentIdxMemPtr && parentIdxMemPtr->isDefined(), "has undefined input memory of 'parent_ids'.");+ CPU_NODE_ASSERT(maxSeqLenMemPtr && maxSeqLenMemPtr->isDefined(), "has undefined input memory of 'max_seq_len'.");+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined output memory.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "has unidentified preferable primitive descriptor.");const VectorDims& stepIdxDims = stepIdxMemPtr->getStaticDims();const VectorDims& parentIdxDims = parentIdxMemPtr->getStaticDims();diff --git a/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp b/src/plugins/intel_cpu/src/nodes/generate_proposals.cppindex 2cf421a3cc7..6e7d55bc18f 100644--- a/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp+++ b/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp@@ -352,9 +352,8 @@ void GenerateProposals::executeDynamicImpl(const dnnl::stream& strm) {void GenerateProposals::execute([[maybe_unused]] const dnnl::stream& strm) {try {- if (inputShapes.size() != 4 || outputShapes.size() != 3) {- THROW_CPU_NODE_ERR("Incorrect number of input or output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 4 && outputShapes.size() == 3,+ "Incorrect number of input or output edges!");size_t anchor_dims_size = 1;const auto& anchorDims = getParentEdgeAt(INPUT_ANCHORS)->getMemory().getStaticDims();@@ -367,18 +366,16 @@ void GenerateProposals::execute([[maybe_unused]] const dnnl::stream& strm) {for (size_t i = 1; i < deltaDims.size(); i++) {deltas_dims_size *= deltaDims[i];}- if (anchor_dims_size != deltas_dims_size) {- THROW_CPU_NODE_ERR("'Anchors' blob size for GenerateProposals is incompatible with 'deltas' blob size!");- }+ CPU_NODE_ASSERT(anchor_dims_size == deltas_dims_size,+ "'Anchors' blob size for GenerateProposals is incompatible with 'deltas' blob size!");size_t score_dims_size = 1;const auto& scoreDims = getParentEdgeAt(INPUT_SCORES)->getMemory().getStaticDims();for (size_t i = 1; i < scoreDims.size(); i++) {score_dims_size *= scoreDims[i];}- if (deltas_dims_size != (4 * score_dims_size)) {- THROW_CPU_NODE_ERR("'Deltas' blob size for GenerateProposals is incompatible with 'scores' blob size!");- }+ CPU_NODE_ASSERT(deltas_dims_size == (4 * score_dims_size),+ "'Deltas' blob size for GenerateProposals is incompatible with 'scores' blob size!");size_t im_info_dims_size = 1;const auto& infoDims = getParentEdgeAt(INPUT_IM_INFO)->getMemory().getStaticDims();@@ -511,7 +508,7 @@ void GenerateProposals::execute([[maybe_unused]] const dnnl::stream& strm) {memcpy(p_roi_score_item, score_item.data(), score_item.size() * sizeof(float));memcpy(p_roi_num_item, roi_num.data(), getDstMemoryAtPort(OUTPUT_ROI_NUM)->getSize());} catch (const std::exception& e) {- THROW_CPU_NODE_ERR(e.what());+ CPU_NODE_THROW(e.what());}}diff --git a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/grid_sample.cppindex b1462eff4f7..32f6a92a98f 100644--- a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp+++ b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp@@ -67,22 +67,16 @@ GridSample::GridSample(const std::shared_ptr<ov::Node>& op, const GraphContext::OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (op->get_input_size() != 2 || op->get_output_size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output ports.");- }+ CPU_NODE_ASSERT(op->get_input_size() == 2 && op->get_output_size() == 1,+ "has incorrect number of input/output ports.");const auto& dataShape = getInputShapeAtPort(IN_DATA);- if (dataShape.getRank() != 4) {- THROW_CPU_NODE_ERR("has incorrect rank of the Data input.");- }+ CPU_NODE_ASSERT(dataShape.getRank() == 4, "has incorrect rank of the Data input.");const auto& gridShape = getInputShapeAtPort(IN_GRID);- if (gridShape.getRank() != 4) {- THROW_CPU_NODE_ERR("has incorrect rank of the Grid input.");- }- if (gridShape.isStatic() && gridShape.getDims()[3] != 2) {- THROW_CPU_NODE_ERR("has incorrect shape of the Grid input. The 4th dimension should be equal to 2.");- }+ CPU_NODE_ASSERT(gridShape.getRank() == 4, "has incorrect rank of the Grid input.");+ CPU_NODE_ASSERT(!gridShape.isStatic() || gridShape.getDims()[3] == 2,+ "has incorrect shape of the Grid input. The 4th dimension should be equal to 2.");const auto& attributes = ov::as_type_ptr<ov::op::v9::GridSample>(op)->get_attributes();alignCorners = attributes.align_corners;@@ -97,7 +91,7 @@ GridSample::GridSample(const std::shared_ptr<ov::Node>& op, const GraphContext::interpolationMode = GridSampleInterpolationMode::NEAREST;break;default:- THROW_CPU_NODE_ERR("supports only BILINEAR, BICUBIC, NEAREST interpolation modes.");+ CPU_NODE_THROW("supports only BILINEAR, BICUBIC, NEAREST interpolation modes.");}switch (attributes.padding_mode) {case op::v9::GridSample::PaddingMode::ZEROS:@@ -110,7 +104,7 @@ GridSample::GridSample(const std::shared_ptr<ov::Node>& op, const GraphContext::paddingMode = GridSamplePaddingMode::REFLECTION;break;default:- THROW_CPU_NODE_ERR("supports only BORDER, REFLECTION, ZEROS paddings modes.");+ CPU_NODE_THROW("supports only BORDER, REFLECTION, ZEROS paddings modes.");}}@@ -171,9 +165,7 @@ void GridSample::createPrimitive() {} else if (x64::mayiuse(x64::sse41)) {jitKernel = std::make_shared<kernel::GridSampleKernel<x64::sse41>>(jcp);}- if (!jitKernel) {- THROW_CPU_NODE_ERR("could not create JIT kernel.");- }+ CPU_NODE_ASSERT(jitKernel, "could not create JIT kernel.");jitKernel->create_ker();m_threads_num = parallel_get_max_threads();@@ -209,20 +201,12 @@ void GridSample::createPrimitive() {void GridSample::prepareParams() {auto dataMemPtr = getSrcMemoryAtPort(IN_DATA);- if (!dataMemPtr || !dataMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input data memory.");- }+ CPU_NODE_ASSERT(dataMemPtr && dataMemPtr->isDefined(), "has undefined input data memory.");auto gridMemPtr = getSrcMemoryAtPort(IN_GRID);- if (!gridMemPtr || !gridMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input grid memory.");- }+ CPU_NODE_ASSERT(gridMemPtr && gridMemPtr->isDefined(), "has undefined input grid memory.");auto dstMemPtr = getDstMemoryAtPort(0);- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined output memory.");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor.");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined output memory.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor() != nullptr, "has unidentified preferable primitive descriptor.");const uint64_t dataElPerVec = jitKernel->getDataElPerVec();const auto& srcDataShape = dataMemPtr->getStaticDims();diff --git a/src/plugins/intel_cpu/src/nodes/grn.cpp b/src/plugins/intel_cpu/src/nodes/grn.cppindex d7f0e6eff46..c68a5c70dd3 100644--- a/src/plugins/intel_cpu/src/nodes/grn.cpp+++ b/src/plugins/intel_cpu/src/nodes/grn.cpp@@ -46,19 +46,13 @@ GRN::GRN(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)}const auto grn = ov::as_type_ptr<const ov::op::v0::GRN>(op);- if (grn == nullptr) {- THROW_CPU_NODE_ERR("is not an instance of GRN from v0.");- }+ CPU_NODE_ASSERT(grn, "is not an instance of GRN from v0.");- if (inputShapes.size() != 1 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 1 && outputShapes.size() == 1, "has incorrect number of input/output edges!");const auto dataRank = getInputShapeAtPort(0).getRank();- if (dataRank != getOutputShapeAtPort(0).getRank()) {- THROW_CPU_NODE_ERR("has input/output rank mismatch");- }+ CPU_NODE_ASSERT(dataRank == getOutputShapeAtPort(0).getRank(), "has input/output rank mismatch");bias = grn->get_bias();}@@ -77,23 +71,15 @@ void GRN::prepareParams() {const auto& dataMemPtr = getSrcMemoryAtPort(0);const auto& dstMemPtr = getDstMemoryAtPort(0);- if (!dataMemPtr || !dataMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input 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");- }+ CPU_NODE_ASSERT(dataMemPtr && dataMemPtr->isDefined(), "has undefined input memory");+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined output memory");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "has unidentified preferable primitive descriptor");const VectorDims& dataDims = dataMemPtr->getStaticDims();const VectorDims& dstDims = dstMemPtr->getStaticDims();for (size_t i = 0; i < dataDims.size(); ++i) {- if (dataDims[i] != dstDims[i]) {- THROW_CPU_NODE_ERR("hsd input/output tensors dimensions mismatch");- }+ CPU_NODE_ASSERT(dataDims[i] == dstDims[i], "hsd input/output tensors dimensions mismatch");}if (!dataDims.empty()) {diff --git a/src/plugins/intel_cpu/src/nodes/if.cpp b/src/plugins/intel_cpu/src/nodes/if.cppindex 1a11101b2ee..ce9bd8cc874 100644--- a/src/plugins/intel_cpu/src/nodes/if.cpp+++ b/src/plugins/intel_cpu/src/nodes/if.cpp@@ -141,7 +141,7 @@ void If::createPrimitive() {if (auto inNode = m_thenGraph.getInputNodeByIndex(m_op->get_then_body()->get_parameter_index(param))) {inputMemThen.push_back(getToMemories(inNode.get(), 0));} else {- THROW_CPU_NODE_ERR("Then body of node does not have input with name: ", param->get_friendly_name());+ CPU_NODE_THROW("Then body of node does not have input with name: ", param->get_friendly_name());}}@@ -149,7 +149,7 @@ void If::createPrimitive() {if (auto inNode = m_elseGraph.getInputNodeByIndex(m_op->get_else_body()->get_parameter_index(param))) {inputMemElse.push_back(getToMemories(inNode.get(), 0));} else {- THROW_CPU_NODE_ERR("Else body of node does not have input with name: ", param->get_friendly_name());+ CPU_NODE_THROW("Else body of node does not have input with name: ", param->get_friendly_name());}}@@ -158,7 +158,7 @@ void If::createPrimitive() {auto outMem = outNode->getSrcMemoryAtPort(0);outputMemThen.push_back(outMem);} else {- THROW_CPU_NODE_ERR("Then body of node does not have output with name: ", out->get_friendly_name());+ CPU_NODE_THROW("Then body of node does not have output with name: ", out->get_friendly_name());}}@@ -167,7 +167,7 @@ void If::createPrimitive() {auto outMem = outNode->getSrcMemoryAtPort(0);outputMemElse.push_back(outMem);} else {- THROW_CPU_NODE_ERR("Else body of node does not have output with name: ", out->get_friendly_name());+ CPU_NODE_THROW("Else body of node does not have output with name: ", out->get_friendly_name());}}diff --git a/src/plugins/intel_cpu/src/nodes/input.cpp b/src/plugins/intel_cpu/src/nodes/input.cppindex c4db3573fa2..812231a8d01 100644--- a/src/plugins/intel_cpu/src/nodes/input.cpp+++ b/src/plugins/intel_cpu/src/nodes/input.cpp@@ -669,19 +669,11 @@ MemoryCPtr Input::getMemoryPtr() const {void Input::getSupportedDescriptors() {if (getType() == Type::Input) {- if (!getParentEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of input edges.");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges.");- }+ CPU_NODE_ASSERT(getParentEdges().empty(), "has incorrect number of input edges.");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges.");} else if (getType() == Type::Output) {- if (getParentEdges().size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input edges.");- }- if (!getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges.");- }+ CPU_NODE_ASSERT(getParentEdges().size() == 1, "has incorrect number of input edges.");+ CPU_NODE_ASSERT(getChildEdges().empty(), "has incorrect number of output edges.");}}@@ -731,28 +723,26 @@ void Input::createPrimitive() {for (size_t i = 0; i < getChildEdges().size(); i++) {auto dstMemPtr = getDstMemoryAtPort(i);if (!dstMemPtr) {- THROW_CPU_NODE_ERR("has null memory object at port ",- i,- " to node ",- getChildEdgeAt(i)->getChild()->getName(),- ".");+ CPU_NODE_THROW("has null 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) {- THROW_CPU_NODE_ERR("has null memory object at port ",- i,- " from node ",- getParentEdgeAt(i)->getParent()->getName(),- ".");+ CPU_NODE_THROW("has null memory object at port ",+ i,+ " from node ",+ getParentEdgeAt(i)->getParent()->getName(),+ ".");}}const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("doesn't have selected primitive descriptor.");- }+ CPU_NODE_ASSERT(selected_pd, "doesn't have selected primitive descriptor.");}bool Input::created() const {diff --git a/src/plugins/intel_cpu/src/nodes/interaction.cpp b/src/plugins/intel_cpu/src/nodes/interaction.cppindex d1cd65b4264..7704ddb5702 100644--- a/src/plugins/intel_cpu/src/nodes/interaction.cpp+++ b/src/plugins/intel_cpu/src/nodes/interaction.cpp@@ -367,7 +367,7 @@ void Interaction::prepareParams() {moveFeatureKernel->create_ker();moveInteractKernel->create_ker();} else {- THROW_CPU_NODE_ERR("cannot create jit eltwise kernel");+ CPU_NODE_THROW("cannot create jit eltwise kernel");}#ifdef CPU_DEBUG_CAPSif (prim) {diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/interpolate.cppindex e64de250d69..182ceab18eb 100644--- a/src/plugins/intel_cpu/src/nodes/interpolate.cpp+++ b/src/plugins/intel_cpu/src/nodes/interpolate.cpp@@ -1933,12 +1933,8 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContextif (const auto interp = ov::as_type_ptr<const ov::op::v4::Interpolate>(op)) {is_version11 = false;const auto numInputs = inputShapes.size();- if (numInputs != 3 && numInputs != 4) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }+ CPU_NODE_ASSERT(numInputs == 3 || numInputs == 4, "has incorrect number of input edges");+ CPU_NODE_ASSERT(outputShapes.size() == 1, "has incorrect number of output edges");isAxesSpecified = numInputs != 3;const auto& interpAttr = interp->get_attrs();@@ -1957,7 +1953,7 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext} else if (interpMode == ngInterpMode::CUBIC) {interpAttrs.mode = InterpolateMode::cubic;} else {- THROW_CPU_NODE_ERR("has unsupported interpolate mode");+ CPU_NODE_THROW("has unsupported interpolate mode");}const auto& interpCoordTransMode = interpAttr.coordinate_transformation_mode;@@ -1972,7 +1968,7 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext} else if (interpCoordTransMode == ngInterpCoordTransf::ALIGN_CORNERS) {interpAttrs.coordTransMode = InterpolateCoordTransMode::align_corners;} else {- THROW_CPU_NODE_ERR("has unsupported coordination transformation mode");+ CPU_NODE_THROW("has unsupported coordination transformation mode");}if (interpAttrs.mode == InterpolateMode::nearest) {@@ -1988,7 +1984,7 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext} else if (interpNearestMode == ngInterpNearMode::SIMPLE) {interpAttrs.nearestMode = InterpolateNearestMode::simple;} else {- THROW_CPU_NODE_ERR("has unsupported nearest mode");+ CPU_NODE_THROW("has unsupported nearest mode");}} else if (interpAttrs.mode == InterpolateMode::cubic) {interpAttrs.cubeCoeff = static_cast<float>(interpAttr.cube_coeff);@@ -2001,7 +1997,7 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext} else if (interpShapeCalcMode == ngInterpShapeCalcMode::SIZES) {interpAttrs.shapeCalcMode = InterpolateShapeCalcMode::sizes;} else {- THROW_CPU_NODE_ERR("has unsupported shape calculation mode");+ CPU_NODE_THROW("has unsupported shape calculation mode");}if (interpAttr.pads_begin.empty()) {@@ -2041,12 +2037,8 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext} else if (const auto interp = ov::as_type_ptr<const ov::op::v11::Interpolate>(op)) {is_version11 = true;const auto numInputs = inputShapes.size();- if (numInputs != 2 && numInputs != 3) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }+ CPU_NODE_ASSERT(numInputs == 2 || numInputs == 3, "has incorrect number of input edges");+ CPU_NODE_ASSERT(outputShapes.size() == 1, "has incorrect number of output edges");isAxesSpecified = numInputs != 2;const auto& interpAttr = interp->get_attrs();@@ -2057,7 +2049,7 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContextinterpAttrs.mode = InterpolateMode::bicubic_pillow;interpAttrs.cubeCoeff = static_cast<float>(interpAttr.cube_coeff); // fixed to be -0.5} else {- THROW_CPU_NODE_ERR("has unsupported interpolate mode");+ CPU_NODE_THROW("has unsupported interpolate mode");}// pillow use fixed tf_half_pixel_for_nn style mode for coodinate transformation@@ -2076,7 +2068,7 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext} else if (interpShapeCalcMode == ngInterpShapeCalcMode::SIZES) {interpAttrs.shapeCalcMode = InterpolateShapeCalcMode::sizes;} else {- THROW_CPU_NODE_ERR("has unsupported shape calculation mode");+ CPU_NODE_THROW("has unsupported shape calculation mode");}if (interpAttr.pads_begin.empty()) {@@ -2118,14 +2110,11 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext}void Interpolate::getSupportedDescriptors() {- if (getParentEdges().size() != 2 && getParentEdges().size() != 3 && getParentEdges().size() != 4) {- // v4: data, target_shape, scale, axis(optional).- // v11: data, size_or_scale, axis(optional)- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }+ // v4: data, target_shape, scale, axis(optional).+ // v11: data, size_or_scale, axis(optional)+ CPU_NODE_ASSERT(getParentEdges().size() == 2 || getParentEdges().size() == 3 || getParentEdges().size() == 4,+ "has incorrect number of input edges");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges");// get padfor (int i : interpAttrs.padBegin) {@@ -2429,43 +2418,29 @@ inline int Interpolate::get_axis_id() const {}void Interpolate::prepareParams() {- if (!shapesDefined()) {- THROW_CPU_NODE_ERR("input/output dims aren't defined");- }+ CPU_NODE_ASSERT(shapesDefined(), "input/output dims aren't defined");auto dstMemPtr = getDstMemoryAtPort(0);- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined destination memory");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined destination memory");auto srcMemPtr = getSrcMemoryAtPort(DATA_ID);- if (!srcMemPtr || !srcMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory");- }+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "has undefined input memory");if (interpAttrs.shapeCalcMode == InterpolateShapeCalcMode::sizes) {auto tsMemPtr = getSrcMemoryAtPort(TARGET_SHAPE_ID);- if (!tsMemPtr || !tsMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined target shape memory");- }+ CPU_NODE_ASSERT(tsMemPtr && tsMemPtr->isDefined(), "has undefined target shape memory");} else {auto scaleMemPtr = getSrcMemoryAtPort(get_scale_id());- if (!scaleMemPtr || !scaleMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined scales memory");- }+ CPU_NODE_ASSERT(scaleMemPtr && scaleMemPtr->isDefined(), "has undefined scales memory");}if (isAxesSpecified) {auto axesMemPtr = getSrcMemoryAtPort(get_axis_id());- if (!axesMemPtr || !axesMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined axes memory");- }+ CPU_NODE_ASSERT(axesMemPtr && axesMemPtr->isDefined(), "has undefined axes memory");}const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("did not set preferable primitive descriptor");- }+ CPU_NODE_ASSERT(selected_pd, "did not set preferable primitive descriptor");const auto& srcDimsOrign = srcMemPtr->getStaticDims();const auto& dstDimsOrign = dstMemPtr->getStaticDims();@@ -2498,7 +2473,7 @@ void Interpolate::prepareParams() {getScales(getPaddedInputShape(srcDims, interpAttrs.padBegin, interpAttrs.padEnd), dstDims);if (!interpAttrs.NCHWAsNHWC &&(getOutputShapeAtPort(0).getRank() > 2 && (dataScales[0] != 1.F || dataScales[1] != 1.F))) {- THROW_CPU_NODE_ERR("only supports resize on spatial dimensions(depth, height and width)");+ CPU_NODE_THROW("only supports resize on spatial dimensions(depth, height and width)");}if (canUseAclExecutor) {@@ -2560,12 +2535,8 @@ void Interpolate::prepareParams() {void Interpolate::createPrimitive() {auto srcMemPtr = getSrcMemoryAtPort(DATA_ID);auto dstMemPtr = getDstMemoryAtPort(0);- if (!srcMemPtr) {- THROW_CPU_NODE_ERR("has null input memory");- }- if (!dstMemPtr) {- THROW_CPU_NODE_ERR("has null destination memory");- }+ CPU_NODE_ASSERT(srcMemPtr, "has null input memory");+ CPU_NODE_ASSERT(dstMemPtr, "has null destination memory");if (dstMemPtr->getDesc().hasLayoutType(LayoutType::ncsp)) {interpAttrs.layout = InterpolateLayoutType::planar;@@ -2614,11 +2585,11 @@ void Interpolate::setPostOps(dnnl::primitive_attr& attr, const VectorDims& dims)continue;}- THROW_CPU_NODE_ERR("Fusing of ",- NameFromType(node->getType()),- " operation to ",- NameFromType(this->getType()),- " node is not implemented");+ CPU_NODE_THROW("Fusing of ",+ NameFromType(node->getType()),+ " operation to ",+ NameFromType(this->getType()),+ " node is not implemented");}attr.set_post_ops(ops);@@ -2724,9 +2695,8 @@ void Interpolate::execute([[maybe_unused]] const dnnl::stream& strm) {size_t eltsTotal = srcDimPad5d[0] * CB * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize;srcPadded.resize(eltsTotal * srcDataSize, 0x0);auto* src_data_pad = static_cast<uint8_t*>(srcPadded.data());- if ((srcDim5d[0] != srcDimPad5d[0]) || (srcDim5d[1] != srcDimPad5d[1])) {- THROW_CPU_NODE_ERR("does not support padding on batch and channel dimensions");- }+ CPU_NODE_ASSERT((srcDim5d[0] == srcDimPad5d[0]) && (srcDim5d[1] == srcDimPad5d[1]),+ "does not support padding on batch and channel dimensions");parallel_for5d(srcDim5d[0],CB,srcDim5d[2],@@ -2759,7 +2729,7 @@ void Interpolate::execute([[maybe_unused]] const dnnl::stream& strm) {} else if (aclExecPtr) {aclExecPtr->exec({srcMemPtr}, {dstMemPtr}, reinterpret_cast<void*>(postOpsDataPtrs.data()));} else {- THROW_CPU_NODE_ERR("Primitive wasn't created");+ CPU_NODE_THROW("Primitive wasn't created");}}@@ -4398,9 +4368,7 @@ void Interpolate::InterpolateJitExecutor::exec(const uint8_t* in_ptr_, uint8_t*size_t OH = dstDim5d[3];size_t OW = dstDim5d[4];- if (!interpolateKernel) {- OPENVINO_THROW("Can't execute, kernel for Interpolate node is not compiled");- }+ OPENVINO_ASSERT(interpolateKernel, "Can't execute, kernel for Interpolate node is not compiled");switch (mode) {case InterpolateMode::nearest: {if (configured_for_layout == InterpolateLayoutType::planar) {diff --git a/src/plugins/intel_cpu/src/nodes/inverse.cpp b/src/plugins/intel_cpu/src/nodes/inverse.cppindex 5728291a5c9..387e83fa6d1 100644--- a/src/plugins/intel_cpu/src/nodes/inverse.cpp+++ b/src/plugins/intel_cpu/src/nodes/inverse.cpp@@ -59,12 +59,8 @@ bool Inverse::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, st}void Inverse::getSupportedDescriptors() {- if (getParentEdges().size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input edges.");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges.");- }+ CPU_NODE_ASSERT(getParentEdges().size() == 1, "has incorrect number of input edges.");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges.");}void Inverse::initSupportedPrimitiveDescriptors() {@@ -81,11 +77,10 @@ void Inverse::initSupportedPrimitiveDescriptors() {void Inverse::prepareParams() {const auto& input_shape = getParentEdgeAt(INPUT_PORT)->getMemory().getStaticDims();- if (input_shape.size() < 2) {- THROW_CPU_NODE_ERR("has incompatible 'data' shape ",- PartialShape(input_shape),- ". Only tensors of rank at least 2 are allowed.");- }+ CPU_NODE_ASSERT(input_shape.size() >= 2,+ "has incompatible 'data' shape ",+ PartialShape(input_shape),+ ". Only tensors of rank at least 2 are allowed.");m_side = input_shape.back();m_side_squared = m_side * m_side;diff --git a/src/plugins/intel_cpu/src/nodes/istft.cpp b/src/plugins/intel_cpu/src/nodes/istft.cppindex 89d4f5d36b6..df1413b1c8f 100644--- a/src/plugins/intel_cpu/src/nodes/istft.cpp+++ b/src/plugins/intel_cpu/src/nodes/istft.cpp@@ -67,12 +67,8 @@ ISTFT::ISTFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contvoid ISTFT::getSupportedDescriptors() {const auto input_size = getParentEdges().size();- if (input_size < 4 || input_size > 5) {- THROW_CPU_NODE_ERR("ISTFT has incorrect number of input edges.");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("ISTFT has incorrect number of output edges.");- }+ CPU_NODE_ASSERT(input_size >= 4 && input_size <= 5, "ISTFT has incorrect number of input edges.");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "ISTFT has incorrect number of output edges.");}void ISTFT::initSupportedPrimitiveDescriptors() {diff --git a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cppindex 6820ff32236..864603aca4f 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp@@ -168,9 +168,7 @@ void jit_uni_eltwise_generic<isa>::generate() {is_valid_configuration = false;}- if (!is_valid_configuration) {- OPENVINO_THROW("Eltwise jitter has invalid configuration for Eltwise node");- }+ OPENVINO_ASSERT(is_valid_configuration, "Eltwise jitter has invalid configuration for Eltwise node");L(unroll_loop_label);{@@ -739,10 +737,7 @@ std::shared_ptr<jit_emitter> jit_uni_eltwise_generic<isa>::create_eltwise_emitteOV_CASE(Algorithm::EltwiseSwish, ov::intel_cpu::aarch64::jit_swish_emitter),OV_CASE(Algorithm::EltwiseTanh, ov::intel_cpu::aarch64::jit_tanh_emitter));- if (!ctx.emitter) {- OPENVINO_THROW("Unsupported operation type '" + algToString(data.algo) + "' for Eltwise emitter");- }-+ OPENVINO_ASSERT(ctx.emitter, "Unsupported operation type '" + algToString(data.algo) + "' for Eltwise emitter");return ctx.emitter;}@@ -876,9 +871,7 @@ std::set<std::vector<element::Type>> eltwise_precision_helper::get_supported_preOV_CASE(Algorithm::EltwiseSubtract, jit_subtract_emitter),OV_CASE(Algorithm::EltwiseSwish, jit_swish_emitter),OV_CASE(Algorithm::EltwiseTanh, jit_tanh_emitter));- if (precisions.empty()) {- OPENVINO_THROW("Unsupported operation type for Eltwise emitter");- }+ OPENVINO_ASSERT(!precisions.empty(), "Unsupported operation type for Eltwise emitter");return precisions;}diff --git a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.hpp b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.hppindex 0229140834a..9440ebadb96 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.hpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.hpp@@ -110,19 +110,14 @@ private:const XReg reg_dst = x16;XReg get_src_reg(uint32_t idx) {- if (idx > MAX_ELTWISE_INPUTS) {- OPENVINO_THROW("source vector ptr register " + std::to_string(idx) + " is not supported");- }-+ OPENVINO_ASSERT(idx <= MAX_ELTWISE_INPUTS,+ "source vector ptr register " + std::to_string(idx) + " is not supported");static const std::vector<uint32_t> src_gprs = {19, 20, 21, 22, 25, 26, 27};return XReg(src_gprs[idx]);}XReg get_aux_gpr(const uint32_t idx) {- if (idx > 3) {- OPENVINO_THROW("aux gpr register " + std::to_string(idx) + " is not supported");- }-+ OPENVINO_ASSERT(idx <= 3, "aux gpr register " + std::to_string(idx) + " is not supported");if (idx == 0) {return XReg(8);}@@ -155,23 +150,19 @@ private:TReg vmm_dst{9};TReg get_vmm_reg(const uint32_t idx) {- if (idx > MAX_ELTWISE_INPUTS) {- OPENVINO_THROW("source vector register " + std::to_string(idx) + " is not supported");- }+ OPENVINO_ASSERT(idx <= MAX_ELTWISE_INPUTS,+ "source vector register " + std::to_string(idx) + " is not supported");return TReg(19 + idx);}SReg get_scl_reg(const uint32_t idx) {- if (idx > MAX_ELTWISE_INPUTS) {- OPENVINO_THROW("source scalar register " + std::to_string(idx) + " is not supported");- }+ OPENVINO_ASSERT(idx <= MAX_ELTWISE_INPUTS,+ "source scalar register " + std::to_string(idx) + " is not supported");return SReg(19 + idx);}TReg get_aux_vmm(const uint32_t idx) {- if (idx > 8) {- OPENVINO_THROW("aux vector register " + std::to_string(idx) + " is not supported");- }+ OPENVINO_ASSERT(idx <= 8, "aux vector register " + std::to_string(idx) + " is not supported");return TReg(10 + idx);}diff --git a/src/plugins/intel_cpu/src/nodes/kernels/riscv64/jit_uni_eltwise_generic.cpp b/src/plugins/intel_cpu/src/nodes/kernels/riscv64/jit_uni_eltwise_generic.cppindex 0fcd0f1b563..97848506f37 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/riscv64/jit_uni_eltwise_generic.cpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/riscv64/jit_uni_eltwise_generic.cpp@@ -490,9 +490,7 @@ std::shared_ptr<jit_emitter> jit_uni_eltwise_generic<isa>::create_eltwise_emitteOV_CASE(Algorithm::EltwiseSqrt, jit_sqrt_emitter),OV_CASE(Algorithm::EltwiseSubtract, jit_subtract_emitter));- if (!ctx.emitter) {- OPENVINO_THROW("Unsupported operation type '" + algToString(data.algo) + "' for Eltwise emitter");- }+ OPENVINO_ASSERT(ctx.emitter, "Unsupported operation type '" + algToString(data.algo) + "' for Eltwise emitter");return ctx.emitter;}@@ -634,9 +632,7 @@ std::set<std::vector<element::Type>> eltwise_precision_helper::get_supported_preOV_CASE(Algorithm::EltwiseSqrt, jit_sqrt_emitter),OV_CASE(Algorithm::EltwiseSubtract, jit_subtract_emitter));- if (precisions.empty()) {- OPENVINO_THROW("Unsupported operation type for Eltwise emitter");- }+ OPENVINO_ASSERT(!precisions.empty(), "Unsupported operation type for Eltwise emitter");return precisions;}diff --git a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa.cpp b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa.cppindex 1e59e265a52..87c556132c2 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa.cpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa.cpp@@ -3635,22 +3635,20 @@ struct AttentionExecutor : public PagedAttentionExecutor {_helper._value_group_size ? v_cache.size(3) / (_helper._value_group_size + value_params_size) : 1;// check by_hidden_dims parameter of value cache- if ((value_group_num == 0U) && v_cache.get_precision().is_integral()) {- OPENVINO_THROW("PagedAttn value cache gets wrong group_size, ",- _helper._value_group_size,- " should be smaller than hidden_dims");- }+ OPENVINO_ASSERT(value_group_num != 0U || !v_cache.get_precision().is_integral(),+ "PagedAttn value cache gets wrong group_size, ",+ _helper._value_group_size,+ " should be smaller than hidden_dims");size_t S = 0;// check parameter of quantized key cacheif (k_cache.get_precision().is_integral()) {if (_helper._quant_key_bychannel) {S = k_cache.size(3);} else {- if (!key_group_num) {- OPENVINO_THROW("PagedAttn key cache gets wrong group_size, ",- _helper._key_group_size,- " should be smaller than hidden_dims");- }+ OPENVINO_ASSERT(key_group_num,+ "PagedAttn key cache gets wrong group_size, ",+ _helper._key_group_size,+ " should be smaller than hidden_dims");S = k_cache.size(3) - key_params_size * key_group_num;_helper._key_group_size = _helper._key_group_size ? _helper._key_group_size : S;}@@ -3664,11 +3662,10 @@ struct AttentionExecutor : public PagedAttentionExecutor {if (_helper._quant_value_bychannel) {SV = v_cache.size(3);} else {- if (!value_group_num) {- OPENVINO_THROW("PagedAttn value cache gets wrong group_size, ",- _helper._value_group_size,- " should be smaller than hidden_dims");- }+ OPENVINO_ASSERT(value_group_num,+ "PagedAttn value cache gets wrong group_size, ",+ _helper._value_group_size,+ " should be smaller than hidden_dims");SV = v_cache.size(3) - value_params_size * value_group_num;_helper._value_group_size = _helper._value_group_size ? _helper._value_group_size : SV;}diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cppindex b4868f6f217..0e367b2ac3c 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp@@ -90,9 +90,9 @@ jitUniGatherKernel<isa>::jitUniGatherKernel(const jGatherConfParams& jcp)template <x64::cpu_isa_t isa>void jitUniGatherKernel<isa>::create_ker() {auto code = x64::jit_generator_t::create_kernel();- if (code != dnnl::impl::status::success) {- OPENVINO_THROW("Could not create Gather kernel. Error code: ", std::to_string(code));- }+ OPENVINO_ASSERT(code == dnnl::impl::status::success,+ "Could not create Gather kernel. Error code: ",+ std::to_string(code));ker_ = (decltype(ker_))jit_ker();}diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cppindex ae689a87cd3..b4baf8690bf 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp@@ -38,9 +38,9 @@ GridSampleKernel<isa>::GridSampleKernel(const GridSampleKernelConfParams& jcp)template <x64::cpu_isa_t isa>void GridSampleKernel<isa>::create_ker() {auto code = x64::jit_generator_t::create_kernel();- if (code != dnnl::impl::status::success) {- OPENVINO_THROW("Could not create GridSample kernel. Error code: ", std::to_string(code));- }+ OPENVINO_ASSERT(code == dnnl::impl::status::success,+ "Could not create GridSample kernel. Error code: ",+ std::to_string(code));ker_ = (decltype(ker_))jit_ker();}diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cppindex 925849045cf..040cc724e30 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp@@ -52,9 +52,7 @@ void freeReg(jit_kernel::reg_indices& freeRegs, const registers<RegType>& regs,// if (it != freeRegs.end())// throw std::runtime_error("Some register was freed twice");freeRegs.emplace_back(idx);- if (freeRegs.size() > regs.size()) {- OPENVINO_THROW("Some register was freed twice");- }+ OPENVINO_ASSERT(freeRegs.size() <= regs.size(), "Some register was freed twice");}const registers<Reg64>& x64regs() {diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cppindex b3d3ba3085a..2230818adba 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp@@ -227,9 +227,7 @@ void JitKernelBase::gatherdd(const Xbyak::Xmm& v_dst,const Xbyak::Opmask& kReadMask,const bool useMask,const bool zeroFill) {- if (kReadMask.getIdx() == 0) {- OPENVINO_THROW("The vpgatherdd instruction cannot use the register k0 as mask.");- }+ OPENVINO_ASSERT(kReadMask.getIdx() != 0, "The vpgatherdd instruction cannot use the register k0 as mask.");if (!useMask) {kxnord(kReadMask, kReadMask, kReadMask);}@@ -246,10 +244,9 @@ void JitKernelBase::gatherdd(const Xbyak::Xmm& v_dst,const Xbyak::Xmm& vReadMask,const bool useMask,const bool zeroFill) {- if (v_dst.getIdx() == vSrcShift.getIdx() || v_dst.getIdx() == vReadMask.getIdx() ||- vSrcShift.getIdx() == vReadMask.getIdx()) {- OPENVINO_THROW("Any pair of the index, mask, or destination registers cannot be the same.");- }+ OPENVINO_ASSERT(v_dst.getIdx() != vSrcShift.getIdx() && v_dst.getIdx() != vReadMask.getIdx() &&+ vSrcShift.getIdx() != vReadMask.getIdx(),+ "Any pair of the index, mask, or destination registers cannot be the same.");if (zeroFill) {pxor(v_dst, v_dst); // Don't use vpxor. It zeros the rest of the YMM register.}@@ -288,10 +285,9 @@ void JitKernelBase::gatherdd(const Xbyak::Ymm& v_dst,const Xbyak::Ymm& vReadMask,const bool useMask,const bool zeroFill) {- if (v_dst.getIdx() == vSrcShift.getIdx() || v_dst.getIdx() == vReadMask.getIdx() ||- vSrcShift.getIdx() == vReadMask.getIdx()) {- OPENVINO_THROW("Any pair of the index, mask, or destination registers cannot be the same.");- }+ OPENVINO_ASSERT(v_dst.getIdx() != vSrcShift.getIdx() && v_dst.getIdx() != vReadMask.getIdx() &&+ vSrcShift.getIdx() != vReadMask.getIdx(),+ "Any pair of the index, mask, or destination registers cannot be the same.");if (isValidIsa(x64::avx2)) {if (!useMask) {uni_vpcmpeqd(vReadMask, vReadMask, vReadMask);@@ -419,9 +415,7 @@ void JitKernelBase::fillRestWorkMask(const Xbyak::Opmask& dstMask, const Xbyak::void JitKernelBase::fillRestWorkMask(const Xbyak::Xmm& xmmDstMask,const Xbyak::Reg64& rWorkRest,const uint64_t typeSize) {- if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {- OPENVINO_THROW("Could not fill data with type size ", typeSize);- }+ OPENVINO_ASSERT(one_of(typeSize, 1U, 2U, 4U, 8U), "Could not fill data with type size ", typeSize);Xbyak::Label lEnd;auto r32Ones = getReg32();Xbyak::Reg64 r64Ones(r32Ones.getIdx());@@ -448,9 +442,7 @@ void JitKernelBase::fillRestWorkMask(const Xbyak::Xmm& xmmDstMask,void JitKernelBase::fillRestWorkMask(const Xbyak::Ymm& ymmDstMask,const Xbyak::Reg64& rWorkRest,const uint64_t typeSize) {- if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {- OPENVINO_THROW("Could not fill data with type size ", typeSize);- }+ OPENVINO_ASSERT(one_of(typeSize, 1U, 2U, 4U, 8U), "Could not fill data with type size ", typeSize);Xbyak::Label lEnd;auto elPerVec = x64::cpu_isa_traits_t<x64::sse41>::vlen / typeSize;auto r32Ones = getReg32();@@ -488,9 +480,7 @@ void JitKernelBase::load(const Xbyak::Xmm& v_dst,const Xbyak::Reg64& rLoadNum,const size_t typeSize,const bool zeroFilling) {- if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {- OPENVINO_THROW("Could not load data with type size ", typeSize);- }+ OPENVINO_ASSERT(one_of(typeSize, 1U, 2U, 4U, 8U), "Could not load data with type size ", typeSize);const uint8_t elPerVec = x64::cpu_isa_traits_t<x64::sse41>::vlen / typeSize;Xbyak::Label lEnd;if (zeroFilling) {@@ -520,9 +510,7 @@ void JitKernelBase::load(const Xbyak::Ymm& v_dst,const Xbyak::Reg64& rLoadNum,const size_t typeSize,const bool zeroFilling) {- if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {- OPENVINO_THROW("Could not load data with type size ", typeSize);- }+ OPENVINO_ASSERT(one_of(typeSize, 1U, 2U, 4U, 8U), "Could not load data with type size ", typeSize);const size_t elPerXmm = x64::cpu_isa_traits_t<x64::sse41>::vlen / typeSize;Xbyak::Label lEnd;if (zeroFilling) {@@ -561,9 +549,7 @@ void JitKernelBase::store(const Xbyak::Address& dstAddr,const Xbyak::Xmm& v_src,const Xbyak::Reg64& rToStoreNum,const size_t typeSize) {- if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {- OPENVINO_THROW("Could not store data with type size ", typeSize);- }+ OPENVINO_ASSERT(one_of(typeSize, 1U, 2U, 4U, 8U), "Could not store data with type size ", typeSize);Xbyak::Label lEnd;const size_t elPerVec = x64::cpu_isa_traits_t<x64::sse41>::vlen / typeSize;@@ -589,9 +575,7 @@ void JitKernelBase::store(const Xbyak::Address& dstAddr,const Xbyak::Ymm& v_src,const Xbyak::Reg64& rToStoreNum,const size_t typeSize) {- if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {- OPENVINO_THROW("Could not store data with type size ", typeSize);- }+ OPENVINO_ASSERT(one_of(typeSize, 1U, 2U, 4U, 8U), "Could not store data with type size ", typeSize);Xbyak::Label lEnd;Xbyak::Xmm xmmSrc(v_src.getIdx());const size_t elPerXmm = x64::cpu_isa_traits_t<x64::sse41>::vlen / typeSize;diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.hppindex 0b4719aef74..814a2b5d403 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.hpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.hpp@@ -213,13 +213,12 @@ public:dnnl::impl::status_t create_kernel() override {const dnnl::impl::status_t code = jit_generator_t::create_kernel();- if (code != dnnl::impl::status::success) {- OPENVINO_THROW("Could not create kernel. Error code: ",- std::to_string(code),- ". ",- "Xbyak error code: ",- Xbyak::ConvertErrorToString(Xbyak::GetError()));- }+ OPENVINO_ASSERT(code == dnnl::impl::status::success,+ "Could not create kernel. Error code: ",+ std::to_string(code),+ ". ",+ "Xbyak error code: ",+ Xbyak::ConvertErrorToString(Xbyak::GetError()));m_func = (decltype(m_func))jit_ker();return code;}diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_uni_eltwise_generic.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_uni_eltwise_generic.cppindex 812ece5b2cb..c9bf381edbf 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_uni_eltwise_generic.cpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_uni_eltwise_generic.cpp@@ -65,9 +65,7 @@ void jit_uni_eltwise_generic<isa>::generate() {const auto& p = post_ops_.get();for (int i = 0; i < post_ops_.len(); ++i) {- if (!p->entry_[i].is_quantization()) {- OPENVINO_THROW("Eltwise jitter error. Unsupported post op detected");- }+ OPENVINO_ASSERT(p->entry_[i].is_quantization(), "Eltwise jitter error. Unsupported post op detected");quantization_injectors.push_back(std::make_shared<jit_uni_quantization_injector_f32<isa>>(this,p->entry_[i],vmm_d_weights,@@ -179,9 +177,7 @@ void jit_uni_eltwise_generic<isa>::generate() {is_valid_configuration = false;}- if (!is_valid_configuration) {- OPENVINO_THROW("Eltwise jitter has invalid configuration for Eltwise node");- }+ OPENVINO_ASSERT(is_valid_configuration, "Eltwise jitter has invalid configuration for Eltwise node");L(unroll_loop_label);{@@ -447,9 +443,7 @@ std::shared_ptr<jit_emitter> jit_uni_eltwise_generic<isa>::create_eltwise_emitteOV_CASE(Algorithm::EltwiseBitwiseOr, jit_bitwise_or_emitter),OV_CASE(Algorithm::EltwiseBitwiseXor, jit_bitwise_xor_emitter));- if (!ctx.emitter) {- OPENVINO_THROW("Unsupported operation type for Eltwise emitter");- }+ OPENVINO_ASSERT(ctx.emitter, "Unsupported operation type for Eltwise emitter");return ctx.emitter;}@@ -942,9 +936,7 @@ std::set<std::vector<element::Type>> eltwise_precision_helper::get_supported_preOV_CASE(Algorithm::EltwiseBitwiseOr, jit_bitwise_or_emitter),OV_CASE(Algorithm::EltwiseBitwiseXor, jit_bitwise_xor_emitter));- if (precisions.empty()) {- OPENVINO_THROW("Unsupported operation type for Eltwise emitter");- }+ OPENVINO_ASSERT(!precisions.empty(), "Unsupported operation type for Eltwise emitter");return precisions;}diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/non_max_suppression.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/non_max_suppression.cppindex fa5c9d7e290..63cd634015f 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/non_max_suppression.cpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/non_max_suppression.cpp@@ -14,6 +14,7 @@#include "emitters/plugin/x64/jit_load_store_emitters.hpp"#include "openvino/core/except.hpp"#include "openvino/core/type/element_type.hpp"+#include "utils/general_utils.h"using namespace dnnl::impl;using namespace dnnl::impl::cpu;@@ -362,11 +363,10 @@ void NonMaxSuppression<isa>::suppressed_by_score() {template <x64::cpu_isa_t isa>void NonMaxSuppression<isa>::iou(int ele_num) {auto load = [&](Xbyak::Reg64 reg_src, Vmm vmm_dst) {- if (ele_num != scalar_step && ele_num != vector_step) {- OPENVINO_THROW("NMS JIT implementation supports load emitter with only element count scalar_step or "- "vector_step! Get: ",- ele_num);- }+ OPENVINO_ASSERT(one_of(ele_num, scalar_step, vector_step),+ "NMS JIT implementation supports load emitter with only element count scalar_step or "+ "vector_step! Get: ",+ ele_num);const auto& load_emitter = ele_num == 1 ? load_scalar_emitter : load_vector_emitter;load_emitter->emit_code({static_cast<size_t>(reg_src.getIdx())},diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/registers_pool.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/registers_pool.hppindex beb5fd7b3f7..f716ecb9cf8 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/registers_pool.hpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/registers_pool.hpp@@ -100,9 +100,7 @@ public:private:void ensureValid() const {- if (!isInitialized()) {- OPENVINO_THROW("RegistersPool::Reg is either not initialized or released");- }+ OPENVINO_ASSERT(isInitialized(), "RegistersPool::Reg is either not initialized or released");}void initialize(const RegistersPool::Ptr& pool, int requestedIdx = anyIdx) {@@ -166,22 +164,16 @@ protected:PhysicalSet(int size) : isFreeIndexVector(size, true) {}void setAsUsed(size_t regIdx) {- if (regIdx >= isFreeIndexVector.size()) {- OPENVINO_THROW("regIdx is out of bounds in RegistersPool::PhysicalSet::setAsUsed()");- }- if (!isFreeIndexVector[regIdx]) {- OPENVINO_THROW("Inconsistency in RegistersPool::PhysicalSet::setAsUsed()");- }+ OPENVINO_ASSERT(regIdx < isFreeIndexVector.size(),+ "regIdx is out of bounds in RegistersPool::PhysicalSet::setAsUsed()");+ OPENVINO_ASSERT(isFreeIndexVector[regIdx], "Inconsistency in RegistersPool::PhysicalSet::setAsUsed()");isFreeIndexVector[regIdx] = false;}void setAsUnused(size_t regIdx) {- if (regIdx >= isFreeIndexVector.size()) {- OPENVINO_THROW("regIdx is out of bounds in RegistersPool::PhysicalSet::setAsUsed()");- }- if (isFreeIndexVector[regIdx]) {- OPENVINO_THROW("Inconsistency in RegistersPool::PhysicalSet::setAsUnused()");- }+ OPENVINO_ASSERT(regIdx < isFreeIndexVector.size(),+ "regIdx is out of bounds in RegistersPool::PhysicalSet::setAsUsed()");+ OPENVINO_ASSERT(!isFreeIndexVector[regIdx], "Inconsistency in RegistersPool::PhysicalSet::setAsUnused()");isFreeIndexVector[regIdx] = true;}@@ -189,12 +181,12 @@ protected:if (requestedIdx == static_cast<size_t>(anyIdx)) {return getFirstFreeIndex();}- if (requestedIdx >= isFreeIndexVector.size()) {- OPENVINO_THROW("requestedIdx is out of bounds in RegistersPool::PhysicalSet::getUnused()");- }- if (!isFreeIndexVector[requestedIdx]) {- OPENVINO_THROW("The register with index #", requestedIdx, " already used in the RegistersPool");- }+ OPENVINO_ASSERT(requestedIdx < isFreeIndexVector.size(),+ "requestedIdx is out of bounds in RegistersPool::PhysicalSet::getUnused()");+ OPENVINO_ASSERT(isFreeIndexVector[requestedIdx],+ "The register with index #",+ requestedIdx,+ " already used in the RegistersPool");return requestedIdx;}@@ -291,9 +283,7 @@ private:static void checkUniqueAndUpdate(bool isCtor = true) {static thread_local bool isCreated = false;if (isCtor) {- if (isCreated) {- OPENVINO_THROW("There should be only one instance of RegistersPool per thread");- }+ OPENVINO_ASSERT(!isCreated, "There should be only one instance of RegistersPool per thread");isCreated = true;} else {isCreated = false;diff --git a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp b/src/plugins/intel_cpu/src/nodes/llm_mlp.cppindex c2abbb31793..107a23f8555 100644--- a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp+++ b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp@@ -621,7 +621,7 @@ void LLMMLP::createPrimitive() {}#endifif (!m_executor) {- THROW_CPU_NODE_ERR("Executor creation fails with precision " + rtPrecision.to_string());+ CPU_NODE_THROW("Executor creation fails with precision " + rtPrecision.to_string());}}diff --git a/src/plugins/intel_cpu/src/nodes/log_softmax.cpp b/src/plugins/intel_cpu/src/nodes/log_softmax.cppindex a8812060f45..6ad9aab94eb 100644--- a/src/plugins/intel_cpu/src/nodes/log_softmax.cpp+++ b/src/plugins/intel_cpu/src/nodes/log_softmax.cpp@@ -48,13 +48,9 @@ LogSoftmax::LogSoftmax(const std::shared_ptr<ov::Node>& op, const GraphContext::}const auto logSoftMax = ov::as_type_ptr<const ov::op::v5::LogSoftmax>(op);- if (logSoftMax == nullptr) {- THROW_CPU_NODE_ERR("is not an instance of v5 LogSoftmax.");- }+ CPU_NODE_ASSERT(logSoftMax, "is not an instance of v5 LogSoftmax.");- if (inputShapes.size() != 1 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 1 && outputShapes.size() == 1, "has incorrect number of input/output edges!");auto dimsSize = getInputShapeAtPort(0).getDims().size();if (dimsSize == 0) {@@ -65,9 +61,8 @@ LogSoftmax::LogSoftmax(const std::shared_ptr<ov::Node>& op, const GraphContext::axis += dimsSize;}- if (dimsSize < static_cast<size_t>(static_cast<size_t>(1) + axis)) {- THROW_CPU_NODE_ERR("has incorrect input parameters dimensions and axis number!");- }+ CPU_NODE_ASSERT(dimsSize >= static_cast<size_t>(1) + axis,+ "has incorrect input parameters dimensions and axis number!");}void LogSoftmax::initSupportedPrimitiveDescriptors() {diff --git a/src/plugins/intel_cpu/src/nodes/lrn.cpp b/src/plugins/intel_cpu/src/nodes/lrn.cppindex b9dbc7e8774..1d1503d4220 100644--- a/src/plugins/intel_cpu/src/nodes/lrn.cpp+++ b/src/plugins/intel_cpu/src/nodes/lrn.cpp@@ -149,12 +149,8 @@ void Lrn::getSupportedDescriptors() {return;}- if (getParentEdges().size() != 2) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }+ CPU_NODE_ASSERT(getParentEdges().size() == 2, "has incorrect number of input edges");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges");ov::element::Type precision = getOriginalOutputPrecisionAtPort(0);if (precision != ov::element::f32 && precision != ov::element::bf16) {@@ -183,17 +179,11 @@ std::shared_ptr<MemoryDesc> Lrn::getSrcMemDesc(const dnnl::primitive_desc& prim_void Lrn::prepareParams() {auto srcMemPtr = getSrcMemoryAtPort(0);auto dstMemPtr = getDstMemoryAtPort(0);- if (!srcMemPtr || !srcMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("input memory is undefined");- }- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("destination memory is undefined");- }+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "input memory is undefined");+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "destination memory is undefined");const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("preferable primitive descriptor did not set");- }+ CPU_NODE_ASSERT(selected_pd, "preferable primitive descriptor did not set");auto inpDesc = getParentEdgeAt(0)->getMemory().getDescWithType<DnnlMemoryDesc>();@@ -227,9 +217,7 @@ void Lrn::prepareParams() {auto cache = context->getParamsCache();auto result = cache->getOrCreate(key, builder);execPtr = result.first;- if (!execPtr) {- THROW_CPU_NODE_ERR("Primitive descriptor was not found.");- }+ CPU_NODE_ASSERT(execPtr, "Primitive descriptor was not found.");auto scratchpadMem = getScratchPadMem(execPtr->getScratchPadDesc());@@ -266,11 +254,8 @@ void Lrn::createDescriptor(const std::vector<MemoryDescPtr>& inputDesc,}void Lrn::execute(const dnnl::stream& strm) {- if (execPtr) {- execPtr->exec(primArgs, strm);- } else {- THROW_CPU_NODE_ERR("doesn't have an initialized executor");- }+ CPU_NODE_ASSERT(execPtr, "doesn't have an initialized executor");+ execPtr->exec(primArgs, strm);}void Lrn::executeDynamicImpl(const dnnl::stream& strm) {diff --git a/src/plugins/intel_cpu/src/nodes/mathematics.cpp b/src/plugins/intel_cpu/src/nodes/mathematics.cppindex 9224a2086f2..fc5c204c0bd 100644--- a/src/plugins/intel_cpu/src/nodes/mathematics.cpp+++ b/src/plugins/intel_cpu/src/nodes/mathematics.cpp@@ -226,7 +226,7 @@ void Math::execute([[maybe_unused]] const dnnl::stream& strm) {});break;default:- THROW_CPU_NODE_ERR("Incorrect Reduce layer type");+ CPU_NODE_THROW("Incorrect Reduce layer type");}}diff --git a/src/plugins/intel_cpu/src/nodes/matmul.cpp b/src/plugins/intel_cpu/src/nodes/matmul.cppindex 7defdc1519d..5443c21fe38 100644--- a/src/plugins/intel_cpu/src/nodes/matmul.cpp+++ b/src/plugins/intel_cpu/src/nodes/matmul.cpp@@ -222,11 +222,11 @@ void MatMul::setPostOps(dnnl::primitive_attr& attr, const VectorDims& dims, [[macontinue;}- THROW_CPU_NODE_ERR("Fusing of ",- NameFromType(node->getType()),- " operation to ",- NameFromType(this->getType()),- " node is not implemented");+ CPU_NODE_THROW("Fusing of ",+ NameFromType(node->getType()),+ " operation to ",+ NameFromType(this->getType()),+ " node is not implemented");}attr.set_post_ops(ops);@@ -292,12 +292,10 @@ dnnl::memory::desc MatMul::getBiasDescFrom(const DnnlMemoryDescCPtr& outMemDesc)}void MatMul::getSupportedDescriptors() {- if (getParentEdges().size() != getOriginalInputsNumber()) {- THROW_CPU_NODE_ERR("has incorrect number of input edges for layer ", getName());- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges for layer ", getName());- }+ CPU_NODE_ASSERT(getParentEdges().size() == getOriginalInputsNumber(),+ "has incorrect number of input edges for layer ",+ getName());+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges for layer ", getName());withBiases = getOriginalInputsNumber() == 3;@@ -343,9 +341,8 @@ void MatMul::getSupportedDescriptors() {const auto& inputShape1 = getInputShapeAtPort(1);auto outputShape = getOutputShapeAtPort(0);- if (inputShape0.getRank() != inputShape1.getRank() || inputShape0.getRank() != outputShape.getRank()) {- THROW_CPU_NODE_ERR("has invalid dims count");- }+ CPU_NODE_ASSERT(inputShape0.getRank() == inputShape1.getRank() && inputShape0.getRank() == outputShape.getRank(),+ "has invalid dims count");const int nDims = inputShape0.getRank();const auto xAxis = nDims - 1;@@ -362,13 +359,13 @@ void MatMul::getSupportedDescriptors() {// coverity[copy_paste_error]if (!dimsEqualWeak(inDims0[xAxis0], inDims1[yAxis1]) || !dimsEqualWeak(inDims0[yAxis0], outDims[yAxis]) ||!dimsEqualWeak(inDims1[xAxis1], outDims[xAxis])) {- THROW_CPU_NODE_ERR("has incorrect spatial input and output dimensions");+ CPU_NODE_THROW("has incorrect spatial input and output dimensions");}for (int dim_idx = nDims - 3; dim_idx >= 0; dim_idx--) {if ((!dimsEqualWeak(inDims0[dim_idx], outDims[dim_idx]) && !dimsEqualWeak(inDims0[dim_idx], 1)) ||(!dimsEqualWeak(inDims1[dim_idx], outDims[dim_idx]) && !dimsEqualWeak(inDims1[dim_idx], 1))) {- THROW_CPU_NODE_ERR("has incorrect input batch dimensions");+ CPU_NODE_THROW("has incorrect input batch dimensions");}}@@ -395,10 +392,7 @@ void MatMul::getSupportedDescriptors() {}std::pair<Shape, Shape> MatMul::makeDummyInputShapes(const Shape& in0, const Shape& in1, const Shape& out) const {- if (in0.getRank() < 2 || in1.getRank() < 2) {- OPENVINO_THROW("Can't create dummy inputs with rank less 2");- }-+ CPU_NODE_ASSERT(in0.getRank() >= 2 && in1.getRank() >= 2, "Can't create dummy inputs with rank less 2");CPU_NODE_ASSERT((in0.getRank() == in1.getRank()) && (in1.getRank() == out.getRank()),"Can't create dummy inputs if argument shapes ranks are not equal");@@ -596,12 +590,9 @@ void MatMul::prepareParams() {auto dstMemPtr = getDstMemoryAtPort(0);auto src0MemPtr = getSrcMemoryAtPort(0);auto src1MemPtr = getSrcMemoryAtPort(1);- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined destination memory");- }- if (!src0MemPtr || !src0MemPtr->isDefined() || !src1MemPtr || !src1MemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined destination memory");+ CPU_NODE_ASSERT(src0MemPtr && src0MemPtr->isDefined() && src1MemPtr && src1MemPtr->isDefined(),+ "has undefined input memory");// check for a degenerate case. In this context the degenerate case is a matrix multiplication where the// collapsing dimension is zero, e.g., AB=C, where A has the shape [10, 0] and B has the shape [0, 20],@@ -618,9 +609,7 @@ void MatMul::prepareParams() {}const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("did not set preferable primitive descriptor");- }+ CPU_NODE_ASSERT(selected_pd, "did not set preferable primitive descriptor");DnnlMemoryDescPtr src0TransposedDesc;DnnlMemoryDescPtr src1TransposedDesc;@@ -651,9 +640,7 @@ void MatMul::prepareParams() {DnnlMemoryDescPtr dnnlBiasMemDesc = nullptr;if (withBiases) {auto biasMemory = getSrcMemoryAtPort(2);- if (!biasMemory || !biasMemory->isDefined()) {- THROW_CPU_NODE_ERR("has undefined bias memory");- }+ CPU_NODE_ASSERT(biasMemory && biasMemory->isDefined(), "has undefined bias memory");dnnlBiasMemDesc = biasMemory->getDescWithType<DnnlMemoryDesc>();}@@ -744,9 +731,7 @@ void MatMul::prepareParams() {auto result = cache->getOrCreate(key, builder);execPtr = result.first;- if (!execPtr) {- OPENVINO_THROW("Primitive descriptor was not found for node ", getName(), ".");- }+ OPENVINO_ASSERT(execPtr, "Primitive descriptor was not found for node ", getName(), ".");auto schratchpadMem = getScratchPadMem(execPtr->getScratchPadDesc());@@ -768,7 +753,7 @@ void MatMul::execute(const dnnl::stream& strm) {// this is a degenerate case, fill output with zeroesgetDstMemoryAtPort(0)->nullify();} else {- THROW_CPU_NODE_ERR("doesn't have an initialized executor");+ CPU_NODE_THROW("doesn't have an initialized executor");}}diff --git a/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp b/src/plugins/intel_cpu/src/nodes/matrix_nms.cppindex 976292f6b03..9e25fdfdf67 100644--- a/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp+++ b/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp@@ -72,13 +72,11 @@ MatrixNms::MatrixNms(const std::shared_ptr<ov::Node>& op, const GraphContext::CPm_outStaticShape = true;}- if (getOriginalInputsNumber() != 2) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getOriginalInputsNumber());- }+ CPU_NODE_ASSERT(getOriginalInputsNumber() == 2, "has incorrect number of input edges: ", getOriginalInputsNumber());- if (getOriginalOutputsNumber() != 3) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getOriginalOutputsNumber());- }+ CPU_NODE_ASSERT(getOriginalOutputsNumber() == 3,+ "has incorrect number of output edges: ",+ getOriginalOutputsNumber());const auto matrix_nms = ov::as_type_ptr<const ov::op::v8::MatrixNms>(op);@@ -117,16 +115,10 @@ MatrixNms::MatrixNms(const std::shared_ptr<ov::Node>& op, const GraphContext::CP}const auto& boxes_dims = getInputShapeAtPort(NMS_BOXES).getDims();- if (boxes_dims.size() != 3) {- THROW_CPU_NODE_ERR("has unsupported 'boxes' input rank: ", boxes_dims.size());- }- if (boxes_dims[2] != 4) {- THROW_CPU_NODE_ERR("has unsupported 'boxes' input 3rd dimension size: ", boxes_dims[2]);- }+ CPU_NODE_ASSERT(boxes_dims.size() == 3, "has unsupported 'boxes' input rank: ", boxes_dims.size());+ CPU_NODE_ASSERT(boxes_dims[2] == 4, "has unsupported 'boxes' input 3rd dimension size: ", boxes_dims[2]);const auto& scores_dims = getInputShapeAtPort(NMS_SCORES).getDims();- if (scores_dims.size() != 3) {- THROW_CPU_NODE_ERR("has unsupported 'scores' input rank: ", scores_dims.size());- }+ CPU_NODE_ASSERT(scores_dims.size() == 3, "has unsupported 'scores' input rank: ", scores_dims.size());}void MatrixNms::initSupportedPrimitiveDescriptors() {@@ -283,9 +275,8 @@ size_t MatrixNms::nmsMatrix(const float* boxesData,void MatrixNms::prepareParams() {const auto& boxes_dims = getParentEdgeAt(NMS_BOXES)->getMemory().getStaticDims();const auto& scores_dims = getParentEdgeAt(NMS_SCORES)->getMemory().getStaticDims();- if (boxes_dims[0] != scores_dims[0] || boxes_dims[1] != scores_dims[2]) {- THROW_CPU_NODE_ERR("has incompatible 'boxes' and 'scores' input dmensions");- }+ CPU_NODE_ASSERT(boxes_dims[0] == scores_dims[0] && boxes_dims[1] == scores_dims[2],+ "has incompatible 'boxes' and 'scores' input dmensions");m_numBatches = boxes_dims[0];m_numBoxes = boxes_dims[1];@@ -439,7 +430,7 @@ void MatrixNms::execute([[maybe_unused]] const dnnl::stream& strm) {// And on the other hand in case of api 2.0, keep them internal dynamic for better performance and functionality.if (!m_outStaticShape) {auto totalBox = std::accumulate(m_numPerBatch.begin(), m_numPerBatch.end(), int64_t{0});- OPENVINO_ASSERT(totalBox > 0, "Total number of boxes is less or equal than 0");+ CPU_NODE_ASSERT(totalBox > 0, "Total number of boxes is less or equal than 0");redefineOutputMemory({{static_cast<size_t>(totalBox), 6}, {static_cast<size_t>(totalBox), 1}, {m_numBatches}});}auto* selectedOutputs = selectedOutputsMemPtr->getDataAs<float>();@@ -481,9 +472,13 @@ void MatrixNms::checkPrecision(const ov::element::Type prec,const std::vector<ov::element::Type>& precList,const std::string& name,const std::string& type) {- if (std::find(precList.begin(), precList.end(), prec) == precList.end()) {- THROW_CPU_NODE_ERR("has unsupported '", name, "' ", type, " precision: ", prec);- }+ CPU_NODE_ASSERT(std::find(precList.begin(), precList.end(), prec) != precList.end(),+ "has unsupported '",+ name,+ "' ",+ type,+ " precision: ",+ prec);}} // namespace ov::intel_cpu::nodediff --git a/src/plugins/intel_cpu/src/nodes/memory.cpp b/src/plugins/intel_cpu/src/nodes/memory.cppindex ec1c35ec41d..118ff8cfbb9 100644--- a/src/plugins/intel_cpu/src/nodes/memory.cpp+++ b/src/plugins/intel_cpu/src/nodes/memory.cpp@@ -470,7 +470,7 @@ MemoryInputBase::MemoryInputBase(const std::string& id,} else if (mode::single_read_value == mode) {executeHook = &MemoryInputBase::bypassAssignState;} else {- THROW_CPU_NODE_ERR("Unexpected MemoryInput mode");+ CPU_NODE_THROW("Unexpected MemoryInput mode");}}diff --git a/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp b/src/plugins/intel_cpu/src/nodes/multiclass_nms.cppindex eda2588246a..46117c32b34 100644--- a/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp+++ b/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp@@ -69,18 +69,16 @@ MultiClassNms::MultiClassNms(const std::shared_ptr<ov::Node>& op, const GraphConm_outStaticShape = true;}- if (getOriginalInputsNumber() != 2 && getOriginalInputsNumber() != 3) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getOriginalInputsNumber());- }+ CPU_NODE_ASSERT(getOriginalInputsNumber() == 2 || getOriginalInputsNumber() == 3,+ "has incorrect number of input edges: ",+ getOriginalInputsNumber());- if (getOriginalOutputsNumber() != 3) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getOriginalOutputsNumber());- }+ CPU_NODE_ASSERT(getOriginalOutputsNumber() == 3,+ "has incorrect number of output edges: ",+ getOriginalOutputsNumber());auto nmsBase = ov::as_type_ptr<ov::op::util::MulticlassNmsBase>(op);- if (nmsBase == nullptr) {- THROW_CPU_NODE_ERR("is not an instance of MulticlassNmsBase.");- }+ CPU_NODE_ASSERT(nmsBase, "is not an instance of MulticlassNmsBase.");const auto& atrri = nmsBase->get_attrs();m_sortResultAcrossBatch = atrri.sort_result_across_batch;m_nmsTopK = atrri.nms_top_k;@@ -104,30 +102,29 @@ MultiClassNms::MultiClassNms(const std::shared_ptr<ov::Node>& op, const GraphConconst auto& scores_dims = getInputShapeAtPort(NMS_SCORES).getDims();auto boxes_ps = PartialShape(boxes_dims);auto scores_ps = PartialShape(scores_dims);- if (boxes_dims.size() != 3) {- THROW_CPU_NODE_ERR("has unsupported 'boxes' input rank: ", boxes_dims.size());- }- if (boxes_dims[2] != 4) {- THROW_CPU_NODE_ERR("has unsupported 'boxes' input 3rd dimension size: ", boxes_dims[2]);- }+ CPU_NODE_ASSERT(boxes_dims.size() == 3, "has unsupported 'boxes' input rank: ", boxes_dims.size());+ CPU_NODE_ASSERT(boxes_dims[2] == 4, "has unsupported 'boxes' input 3rd dimension size: ", boxes_dims[2]);if (scores_dims.size() == 3) {- if (!boxes_ps[0].compatible(scores_ps[0]) || !boxes_ps[1].compatible(scores_ps[2])) {- THROW_CPU_NODE_ERR("has incompatible 'boxes' and 'scores' shape ", boxes_ps, " v.s. ", scores_ps);- }+ CPU_NODE_ASSERT(boxes_ps[0].compatible(scores_ps[0]) && boxes_ps[1].compatible(scores_ps[2]),+ "has incompatible 'boxes' and 'scores' shape ",+ boxes_ps,+ " v.s. ",+ scores_ps);} else if (scores_dims.size() == 2) {- if (op->get_type_info() == ov::op::v8::MulticlassNms::get_type_info_static()) {- THROW_CPU_NODE_ERR("has unsupported 'scores' input rank: ", scores_dims.size());- }- if (!boxes_ps[0].compatible(scores_ps[0]) || !boxes_ps[1].compatible(scores_ps[1])) {- THROW_CPU_NODE_ERR("has incompatible 'boxes' and 'scores' shape ", boxes_ps, " v.s. ", scores_ps);- }- if (getOriginalInputsNumber() != 3) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ",- getOriginalInputsNumber(),- " when input 'scores' is 2D.");- }+ CPU_NODE_ASSERT(op->get_type_info() != ov::op::v8::MulticlassNms::get_type_info_static(),+ "has unsupported 'scores' input rank: ",+ scores_dims.size());+ CPU_NODE_ASSERT(boxes_ps[0].compatible(scores_ps[0]) && boxes_ps[1].compatible(scores_ps[1]),+ "has incompatible 'boxes' and 'scores' shape ",+ boxes_ps,+ " v.s. ",+ scores_ps);+ CPU_NODE_ASSERT(getOriginalInputsNumber() == 3,+ "has incorrect number of input edges: ",+ getOriginalInputsNumber(),+ " when input 'scores' is 2D.");} else {- THROW_CPU_NODE_ERR("has unsupported 'scores' input rank: ", scores_dims.size());+ CPU_NODE_THROW("has unsupported 'scores' input rank: ", scores_dims.size());}}@@ -187,32 +184,29 @@ void MultiClassNms::prepareParams() {if (shared) {if (boxes_dims[0] != scores_dims[0] || boxes_dims[1] != scores_dims[2]) {- THROW_CPU_NODE_ERR("has incompatible 'boxes' and 'scores' shape ",- PartialShape(boxes_dims),- " v.s. ",- PartialShape(scores_dims));+ CPU_NODE_THROW("has incompatible 'boxes' and 'scores' shape ",+ PartialShape(boxes_dims),+ " v.s. ",+ PartialShape(scores_dims));}} else if (scores_dims.size() == 2) {if (boxes_dims[0] != scores_dims[0] || boxes_dims[1] != scores_dims[1]) {- THROW_CPU_NODE_ERR("has incompatible 'boxes' and 'scores' shape ",- PartialShape(boxes_dims),- " v.s. ",- PartialShape(scores_dims));- }- if (!has_roinum) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ",- getOriginalInputsNumber(),- " when input 'scores' is 2D.");+ CPU_NODE_THROW("has incompatible 'boxes' and 'scores' shape ",+ PartialShape(boxes_dims),+ " v.s. ",+ PartialShape(scores_dims));}+ CPU_NODE_ASSERT(has_roinum,+ "has incorrect number of input edges: ",+ getOriginalInputsNumber(),+ " when input 'scores' is 2D.");} else {- THROW_CPU_NODE_ERR("has unsupported 'scores' input rank: ", scores_dims.size());+ CPU_NODE_THROW("has unsupported 'scores' input rank: ", scores_dims.size());}if (has_roinum) {const auto& roisnum_dims = getParentEdgeAt(NMS_ROISNUM)->getMemory().getStaticDims();- if (roisnum_dims.size() != 1) {- THROW_CPU_NODE_ERR("has unsupported 'roisnum' input rank: ", roisnum_dims.size());- }+ CPU_NODE_ASSERT(roisnum_dims.size() == 1, "has unsupported 'roisnum' input rank: ", roisnum_dims.size());m_numBatches = shared ? boxes_dims[0] : roisnum_dims[0];} else {m_numBatches = boxes_dims[0];@@ -682,9 +676,13 @@ void MultiClassNms::checkPrecision(const ov::element::Type prec,const std::vector<ov::element::Type>& precList,const std::string& name,const std::string& type) {- if (std::find(precList.begin(), precList.end(), prec) == precList.end()) {- THROW_CPU_NODE_ERR("has unsupported '", name, "' ", type, " precision: ", prec);- }+ CPU_NODE_ASSERT(std::find(precList.begin(), precList.end(), prec) != precList.end(),+ "has unsupported '",+ name,+ "' ",+ type,+ " precision: ",+ prec);}} // namespace ov::intel_cpu::nodediff --git a/src/plugins/intel_cpu/src/nodes/multinomial.cpp b/src/plugins/intel_cpu/src/nodes/multinomial.cppindex 82751aa2bd8..17f36e4cd3e 100644--- a/src/plugins/intel_cpu/src/nodes/multinomial.cpp+++ b/src/plugins/intel_cpu/src/nodes/multinomial.cpp@@ -69,10 +69,10 @@ bool Multinomial::isSupportedOperation(const std::shared_ptr<const ov::Node>& opvoid Multinomial::getSupportedDescriptors() {if (getParentEdges().size() != 2) {- THROW_CPU_NODE_ERR("has incorrect number of input edges.");+ CPU_NODE_THROW("has incorrect number of input edges.");}if (getChildEdges().size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of output edges.");+ CPU_NODE_THROW("has incorrect number of output edges.");}}@@ -109,15 +109,13 @@ void Multinomial::prepareParams() {const auto& num_samples_shape = getParentEdgeAt(NUM_SAMPLES_PORT)->getMemory().getStaticDims();if (probs_shape.size() != 2) {- THROW_CPU_NODE_ERR("has incompatible 'probs' shape ",- PartialShape(probs_shape),- ". Only 2D tensors are allowed.");+ CPU_NODE_THROW("has incompatible 'probs' shape ", PartialShape(probs_shape), ". Only 2D tensors are allowed.");}if (num_samples_shape.size() != 1) {- THROW_CPU_NODE_ERR("has incompatible 'num_samples' shape ",- PartialShape(num_samples_shape),- ". Only scalar and 1D single element tensors are allowed.");+ CPU_NODE_THROW("has incompatible 'num_samples' shape ",+ PartialShape(num_samples_shape),+ ". Only scalar and 1D single element tensors are allowed.");}if (m_num_samples_precision == ov::element::i32) {@@ -162,7 +160,7 @@ void Multinomial::execute([[maybe_unused]] const dnnl::stream& strm) {break;}default:- THROW_CPU_NODE_ERR("Multinomial CPU implementation does not support probs element type: ", m_probs_precision);+ CPU_NODE_THROW("Multinomial CPU implementation does not support probs element type: ", m_probs_precision);}}@@ -176,7 +174,7 @@ void Multinomial::execute_probs_type() {case ov::element::i32:return execute_convert_type<P, int32_t>();default:- THROW_CPU_NODE_ERR("Multinomial CPU implementation does not support output convert type: ", m_output_precision);+ CPU_NODE_THROW("Multinomial CPU implementation does not support output convert type: ", m_output_precision);}}diff --git a/src/plugins/intel_cpu/src/nodes/mvn.cpp b/src/plugins/intel_cpu/src/nodes/mvn.cppindex 951f673a6d4..a559a4d1632 100644--- a/src/plugins/intel_cpu/src/nodes/mvn.cpp+++ b/src/plugins/intel_cpu/src/nodes/mvn.cpp@@ -2190,9 +2190,8 @@ void MVN::MVNJitExecutor::exec(const uint8_t* src_data,uint8_t* dst_data,const void* post_ops_data_,const VectorDims& shape5d) {- if (!mvn_mean_kernel || (mvnAttrs.normalizeVariance_ && !mvn_variance_kernel) || !mvn_kernel) {- OPENVINO_THROW("MVN layer doesn't create kernel to execute on sse41 above platform.");- }+ OPENVINO_ASSERT(mvn_mean_kernel && (!mvnAttrs.normalizeVariance_ || mvn_variance_kernel) && mvn_kernel,+ "MVN layer doesn't create kernel to execute on sse41 above platform.");if (mvnAttrs.layout == MVNLayoutType::mvn_planar) {mvn_pln(src_data, dst_data, post_ops_data_, shape5d);} else if (mvnAttrs.layout == MVNLayoutType::mvn_by_channel) {@@ -2215,13 +2214,13 @@ void MVN::prepareParams() {auto dstMemPtr = getDstMemoryAtPort(0);auto srcMemPtr = getSrcMemoryAtPort(0);if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Destination memory is undefined.");+ CPU_NODE_THROW("Destination memory is undefined.");}if (!srcMemPtr || !srcMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Input memory is undefined.");+ CPU_NODE_THROW("Input memory is undefined.");}if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");+ CPU_NODE_THROW("Preferable primitive descriptor is not set.");}const VectorDims in_dims = srcMemPtr->getStaticDims();@@ -2322,7 +2321,7 @@ void MVN::transformTo5DCase(const VectorDims& shape) {break;}default: {- THROW_CPU_NODE_ERR("doesn't support planar layout with rank: ", shape.size());+ CPU_NODE_THROW("doesn't support planar layout with rank: ", shape.size());}}}@@ -2344,11 +2343,11 @@ void MVN::setPostOps(dnnl::primitive_attr& attr, [[maybe_unused]] bool initWeigheltwiseNode->appendPostOps(ops, shape5D, postOpsDataPtrs, channelAxis);continue;}- THROW_CPU_NODE_ERR("Fusing of ",- NameFromType(node->getType()),- " operation to ",- NameFromType(this->getType()),- " node is not implemented");+ CPU_NODE_THROW("Fusing of ",+ NameFromType(node->getType()),+ " operation to ",+ NameFromType(this->getType()),+ " node is not implemented");}attr.set_post_ops(ops);}@@ -2368,7 +2367,7 @@ void MVN::execute([[maybe_unused]] const dnnl::stream& strm) {} else if (aclExecPtr) {aclExecPtr->exec({srcMemPtr}, {dstMemPtr}, reinterpret_cast<void*>(postOpsDataPtrs.data()));} else {- THROW_CPU_NODE_ERR("Primitive wasn't created");+ CPU_NODE_THROW("Primitive wasn't created");}}diff --git a/src/plugins/intel_cpu/src/nodes/ngram.cpp b/src/plugins/intel_cpu/src/nodes/ngram.cppindex bae0ae2945d..dfb0d185571 100644--- a/src/plugins/intel_cpu/src/nodes/ngram.cpp+++ b/src/plugins/intel_cpu/src/nodes/ngram.cpp@@ -124,7 +124,7 @@ void Ngram::execute([[maybe_unused]] const dnnl::stream& strm) {} else if (idcesPrecision == ov::element::i64) {batchLenghts = computeBatchLenghts<std::int64_t>();} else {- THROW_CPU_NODE_ERR("Unsupported indices precision: ", idcesPrecision);+ CPU_NODE_THROW("Unsupported indices precision: ", idcesPrecision);}/* The following procedure applied to each batch:diff --git a/src/plugins/intel_cpu/src/nodes/node_config.h b/src/plugins/intel_cpu/src/nodes/node_config.hindex a65a75b8410..c9c0b31ca42 100644--- a/src/plugins/intel_cpu/src/nodes/node_config.h+++ b/src/plugins/intel_cpu/src/nodes/node_config.h@@ -47,9 +47,7 @@ protected:class PortDescGeneric : public PortDescBase_<PortDescGeneric> {public:explicit PortDescGeneric(MemoryDescPtr memDesc) : _memDesc(std::move(memDesc)) {- if (nullptr == _memDesc) {- OPENVINO_THROW("ParameterMismatch: PortDescGeneric constructor got nullptr");- }+ OPENVINO_ASSERT(_memDesc, "ParameterMismatch: PortDescGeneric constructor got nullptr");}[[nodiscard]] bool isCompatible(const PortDescGeneric& rhs) const {return _memDesc->isCompatible(*rhs._memDesc);@@ -67,9 +65,7 @@ public:using CmpMask = BlockedMemoryDesc::CmpMask;PortDescBlocked(BlockedMemoryDescPtr memDesc, CmpMask cmpMask) : _memDesc(std::move(memDesc)), _cmpMask(cmpMask) {- if (nullptr == _memDesc) {- OPENVINO_THROW("ParameterMismatch: PortDescBlocked constructor got nullptr");- }+ OPENVINO_ASSERT(_memDesc, "ParameterMismatch: PortDescBlocked constructor got nullptr");}[[nodiscard]] bool isCompatible(const PortDescBlocked& rhs) const {return _memDesc->isCompatible(*rhs._memDesc, _cmpMask) && (((~_cmpMask) | rhs._cmpMask).all());diff --git a/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp b/src/plugins/intel_cpu/src/nodes/non_max_suppression.cppindex 0777be1efc9..8654bd2da34 100644--- a/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp+++ b/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp@@ -86,12 +86,12 @@ NonMaxSuppression::NonMaxSuppression(const std::shared_ptr<ov::Node>& op, constm_out_static_shape = true;}- if (getOriginalInputsNumber() < 2 || getOriginalInputsNumber() > NMS_SOFT_NMS_SIGMA + 1) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getOriginalInputsNumber());- }- if (getOriginalOutputsNumber() != 3) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getOriginalOutputsNumber());- }+ CPU_NODE_ASSERT(getOriginalInputsNumber() >= 2 && getOriginalInputsNumber() <= NMS_SOFT_NMS_SIGMA + 1,+ "has incorrect number of input edges: ",+ getOriginalInputsNumber());+ CPU_NODE_ASSERT(getOriginalOutputsNumber() == 3,+ "has incorrect number of output edges: ",+ getOriginalOutputsNumber());if (const auto* nms9 = as_type<const op::v9::NonMaxSuppression>(op.get())) {boxEncodingType = static_cast<NMSBoxEncodeType>(nms9->get_box_encoding());@@ -108,30 +108,23 @@ NonMaxSuppression::NonMaxSuppression(const std::shared_ptr<ov::Node>& op, constm_coord_num = 5LU;} else {const auto& typeInfo = op->get_type_info();- THROW_CPU_NODE_ERR("doesn't support NMS: ", typeInfo.name, " v", typeInfo.version_id);+ CPU_NODE_THROW("doesn't support NMS: ", typeInfo.name, " v", typeInfo.version_id);}const auto& boxes_dims = getInputShapeAtPort(NMS_BOXES).getDims();- if (boxes_dims.size() != 3) {- THROW_CPU_NODE_ERR("has unsupported 'boxes' input rank: ", boxes_dims.size());- }- if (boxes_dims[2] != m_coord_num) {- THROW_CPU_NODE_ERR("has unsupported 'boxes' input 3rd dimension size: ", boxes_dims[2]);- }+ CPU_NODE_ASSERT(boxes_dims.size() == 3, "has unsupported 'boxes' input rank: ", boxes_dims.size());+ CPU_NODE_ASSERT(boxes_dims[2] == m_coord_num, "has unsupported 'boxes' input 3rd dimension size: ", boxes_dims[2]);const auto& scores_dims = getInputShapeAtPort(NMS_SCORES).getDims();- if (scores_dims.size() != 3) {- THROW_CPU_NODE_ERR("has unsupported 'scores' input rank: ", scores_dims.size());- }+ CPU_NODE_ASSERT(scores_dims.size() == 3, "has unsupported 'scores' input rank: ", scores_dims.size());const auto& valid_outputs_shape = getOutputShapeAtPort(NMS_VALID_OUTPUTS);- if (valid_outputs_shape.getRank() != 1) {- THROW_CPU_NODE_ERR("has unsupported 'valid_outputs' output rank: ", valid_outputs_shape.getRank());- }- if (valid_outputs_shape.getDims()[0] != 1) {- THROW_CPU_NODE_ERR("has unsupported 'valid_outputs' output 1st dimension size: ",- valid_outputs_shape.getDims()[1]);- }+ CPU_NODE_ASSERT(valid_outputs_shape.getRank() == 1,+ "has unsupported 'valid_outputs' output rank: ",+ valid_outputs_shape.getRank());+ CPU_NODE_ASSERT(valid_outputs_shape.getDims()[0] == 1,+ "has unsupported 'valid_outputs' output 1st dimension size: ",+ valid_outputs_shape.getDims()[1]);for (size_t i = 0LU; i < op->get_output_size(); i++) {m_defined_outputs[i] = !op->get_output_target_inputs(i).empty();@@ -216,12 +209,8 @@ void NonMaxSuppression::prepareParams() {m_batches_num = boxesDims[0];m_boxes_num = boxesDims[1];m_classes_num = scoresDims[1];- if (m_batches_num != scoresDims[0]) {- THROW_CPU_NODE_ERR("Batches number is different in 'boxes' and 'scores' inputs");- }- if (m_boxes_num != scoresDims[2]) {- THROW_CPU_NODE_ERR("Boxes number is different in 'boxes' and 'scores' inputs");- }+ CPU_NODE_ASSERT(m_batches_num == scoresDims[0], "Batches number is different in 'boxes' and 'scores' inputs");+ CPU_NODE_ASSERT(m_boxes_num == scoresDims[2], "Boxes number is different in 'boxes' and 'scores' inputs");m_output_boxes_per_class = std::min(m_max_output_boxes_per_class, m_boxes_num);const auto max_number_of_boxes = m_output_boxes_per_class * m_batches_num * m_classes_num;@@ -872,80 +861,75 @@ void NonMaxSuppression::nmsRotated(const float* boxes,const VectorDims& boxes_strides,const VectorDims& scores_strides,std::vector<FilteredBox>& filtered_boxes) {- if (m_jit_kernel) {- THROW_CPU_NODE_ERR("does not have implementation of the JIT kernel for Rotated boxes.");- } else {- parallel_for2d(m_batches_num, m_classes_num, [&](int64_t batch_idx, int64_t class_idx) {- const float* boxes_ptr = boxes + batch_idx * boxes_strides[0];- const float* scores_ptr = scores + batch_idx * scores_strides[0] + class_idx * scores_strides[1];-- std::vector<std::pair<float, size_t>> sorted_indices; // score, box_idx- sorted_indices.reserve(m_boxes_num);- for (size_t box_idx = 0LU; box_idx < m_boxes_num; box_idx++, scores_ptr++) {- if (*scores_ptr > m_score_threshold) {- sorted_indices.emplace_back(*scores_ptr, box_idx);- }+ CPU_NODE_ASSERT(!m_jit_kernel, "does not have implementation of the JIT kernel for Rotated boxes.");+ parallel_for2d(m_batches_num, m_classes_num, [&](int64_t batch_idx, int64_t class_idx) {+ const float* boxes_ptr = boxes + batch_idx * boxes_strides[0];+ const float* scores_ptr = scores + batch_idx * scores_strides[0] + class_idx * scores_strides[1];++ std::vector<std::pair<float, size_t>> sorted_indices; // score, box_idx+ sorted_indices.reserve(m_boxes_num);+ for (size_t box_idx = 0LU; box_idx < m_boxes_num; box_idx++, scores_ptr++) {+ if (*scores_ptr > m_score_threshold) {+ sorted_indices.emplace_back(*scores_ptr, box_idx);}+ }++ size_t io_selection_size = 0LU;+ const size_t sorted_boxes_size = sorted_indices.size();- size_t io_selection_size = 0LU;- const size_t sorted_boxes_size = sorted_indices.size();-- if (sorted_boxes_size > 0LU) {- parallel_sort(sorted_indices.begin(),- sorted_indices.end(),- [](const std::pair<float, size_t>& l, const std::pair<float, size_t>& r) {- return (l.first > r.first || ((l.first == r.first) && (l.second < r.second)));- });- auto* sorted_indices_ptr = sorted_indices.data();- auto* filtered_boxes_ptr = filtered_boxes.data() +- batch_idx * m_classes_num * m_output_boxes_per_class +- class_idx * m_output_boxes_per_class;- *filtered_boxes_ptr =- FilteredBox(sorted_indices[0].first, batch_idx, class_idx, sorted_indices[0].second);- io_selection_size++;- if (sorted_boxes_size > 1LU) {- sorted_indices_ptr++;- NMSCandidateStatus candidate_status = NMSCandidateStatus::SELECTED;-- for (size_t candidate_idx = 1LU;- (candidate_idx < sorted_boxes_size) && (io_selection_size < m_output_boxes_per_class);- candidate_idx++, sorted_indices_ptr++) {- candidate_status = NMSCandidateStatus::SELECTED;- const auto* box_0 = boxes_ptr + (*sorted_indices_ptr).second * m_coord_num;- const auto area_0 = box_0[2] * box_0[3]; // W x H-- if (area_0 > 0.F) {- NonMaxSuppression::Point2D vertices_0[4];- getRotatedVertices(box_0, vertices_0, m_clockwise);- auto* trg_boxes = reinterpret_cast<int32_t*>(&((*filtered_boxes_ptr).box_index));- for (size_t selected_idx = 0LU; selected_idx < io_selection_size;- selected_idx++, trg_boxes -= 4) {- auto iou = rotatedIntersectionOverUnion(vertices_0,- area_0,- boxes_ptr + m_coord_num * (*trg_boxes));- if (iou > m_iou_threshold) {- candidate_status = NMSCandidateStatus::SUPPRESSED;- break;- }+ if (sorted_boxes_size > 0LU) {+ parallel_sort(sorted_indices.begin(),+ sorted_indices.end(),+ [](const std::pair<float, size_t>& l, const std::pair<float, size_t>& r) {+ return (l.first > r.first || ((l.first == r.first) && (l.second < r.second)));+ });+ auto* sorted_indices_ptr = sorted_indices.data();+ auto* filtered_boxes_ptr = filtered_boxes.data() + batch_idx * m_classes_num * m_output_boxes_per_class ++ class_idx * m_output_boxes_per_class;+ *filtered_boxes_ptr = FilteredBox(sorted_indices[0].first, batch_idx, class_idx, sorted_indices[0].second);+ io_selection_size++;+ if (sorted_boxes_size > 1LU) {+ sorted_indices_ptr++;+ NMSCandidateStatus candidate_status = NMSCandidateStatus::SELECTED;++ for (size_t candidate_idx = 1LU;+ (candidate_idx < sorted_boxes_size) && (io_selection_size < m_output_boxes_per_class);+ candidate_idx++, sorted_indices_ptr++) {+ candidate_status = NMSCandidateStatus::SELECTED;+ const auto* box_0 = boxes_ptr + (*sorted_indices_ptr).second * m_coord_num;+ const auto area_0 = box_0[2] * box_0[3]; // W x H++ if (area_0 > 0.F) {+ NonMaxSuppression::Point2D vertices_0[4];+ getRotatedVertices(box_0, vertices_0, m_clockwise);+ auto* trg_boxes = reinterpret_cast<int32_t*>(&((*filtered_boxes_ptr).box_index));+ for (size_t selected_idx = 0LU; selected_idx < io_selection_size;+ selected_idx++, trg_boxes -= 4) {+ auto iou = rotatedIntersectionOverUnion(vertices_0,+ area_0,+ boxes_ptr + m_coord_num * (*trg_boxes));+ if (iou > m_iou_threshold) {+ candidate_status = NMSCandidateStatus::SUPPRESSED;+ break;}- } else if (0.F > m_iou_threshold) {- candidate_status = NMSCandidateStatus::SUPPRESSED;}+ } else if (0.F > m_iou_threshold) {+ candidate_status = NMSCandidateStatus::SUPPRESSED;+ }- if (candidate_status == NMSCandidateStatus::SELECTED) {- *(++filtered_boxes_ptr) = FilteredBox((*sorted_indices_ptr).first,- batch_idx,- class_idx,- (*sorted_indices_ptr).second);- io_selection_size++;- }+ if (candidate_status == NMSCandidateStatus::SELECTED) {+ *(++filtered_boxes_ptr) = FilteredBox((*sorted_indices_ptr).first,+ batch_idx,+ class_idx,+ (*sorted_indices_ptr).second);+ io_selection_size++;}}}+ }- m_num_filtered_boxes[batch_idx][class_idx] = io_selection_size;- });- }+ m_num_filtered_boxes[batch_idx][class_idx] = io_selection_size;+ });}/////////////// End of Rotated boxes ///////////////@@ -986,23 +970,27 @@ float NonMaxSuppression::intersectionOverUnion(const float* boxesI, const float*}void NonMaxSuppression::check1DInput(const Shape& shape, const std::string& name, [[maybe_unused]] const size_t port) {- if (shape.getRank() != 0 && shape.getRank() != 1) {- THROW_CPU_NODE_ERR("has unsupported '", name, "' input rank: ", shape.getRank());- }+ CPU_NODE_ASSERT(shape.getRank() == 0 || shape.getRank() == 1,+ "has unsupported '",+ name,+ "' input rank: ",+ shape.getRank());if (shape.getRank() == 1) {- if (shape.getDims()[0] != 1) {- THROW_CPU_NODE_ERR("has unsupported '", name, "' input 1st dimension size: ", dim2str(shape.getDims()[0]));- }+ CPU_NODE_ASSERT(shape.getDims()[0] == 1,+ "has unsupported '",+ name,+ "' input 1st dimension size: ",+ dim2str(shape.getDims()[0]));}}void NonMaxSuppression::checkOutput(const Shape& shape, const std::string& name, [[maybe_unused]] const size_t port) {- if (shape.getRank() != 2) {- THROW_CPU_NODE_ERR("has unsupported '", name, "' output rank: ", shape.getRank());- }- if (shape.getDims()[1] != 3) {- THROW_CPU_NODE_ERR("has unsupported '", name, "' output 2nd dimension size: ", dim2str(shape.getDims()[1]));- }+ CPU_NODE_ASSERT(shape.getRank() == 2, "has unsupported '", name, "' output rank: ", shape.getRank());+ CPU_NODE_ASSERT(shape.getDims()[1] == 3,+ "has unsupported '",+ name,+ "' output 2nd dimension size: ",+ dim2str(shape.getDims()[1]));}bool NonMaxSuppression::neverExecute() const {diff --git a/src/plugins/intel_cpu/src/nodes/non_zero.cpp b/src/plugins/intel_cpu/src/nodes/non_zero.cppindex 483e54db8cf..daf6b2a184b 100644--- a/src/plugins/intel_cpu/src/nodes/non_zero.cpp+++ b/src/plugins/intel_cpu/src/nodes/non_zero.cpp@@ -57,18 +57,12 @@ NonZero::NonZero(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr&if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (op->get_output_element_type(0) != ov::element::i32) {- THROW_CPU_NODE_ERR("doesn't support demanded output precision");- }+ CPU_NODE_ASSERT(op->get_output_element_type(0) == ov::element::i32, "doesn't support demanded output precision");}void NonZero::getSupportedDescriptors() {- if (getParentEdges().size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getParentEdges().size());- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getChildEdges().size());- }+ CPU_NODE_ASSERT(getParentEdges().size() == 1, "has incorrect number of input edges: ", getParentEdges().size());+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges: ", getChildEdges().size());}void NonZero::initSupportedPrimitiveDescriptors() {@@ -77,17 +71,18 @@ void NonZero::initSupportedPrimitiveDescriptors() {}const auto& inPrc = getOriginalInputPrecisionAtPort(0);- if (!one_of(inPrc,- ov::element::f32,- ov::element::f16,- ov::element::bf16,- ov::element::f32,- ov::element::i32,- ov::element::u32,- ov::element::i8,- ov::element::u8)) {- THROW_CPU_NODE_ERR("doesn't support ", inPrc.get_type_name(), " precision on 0 port");- }+ CPU_NODE_ASSERT(one_of(inPrc,+ ov::element::f32,+ ov::element::f16,+ ov::element::bf16,+ ov::element::f32,+ ov::element::i32,+ ov::element::u32,+ ov::element::i8,+ ov::element::u8),+ "doesn't support ",+ inPrc.get_type_name(),+ " precision on 0 port");addSupportedPrimDesc({{LayoutType::ncsp}}, {{LayoutType::ncsp, ov::element::i32}}, impl_desc_type::ref);}diff --git a/src/plugins/intel_cpu/src/nodes/normalize.cpp b/src/plugins/intel_cpu/src/nodes/normalize.cppindex 85321330203..95982dad421 100644--- a/src/plugins/intel_cpu/src/nodes/normalize.cpp+++ b/src/plugins/intel_cpu/src/nodes/normalize.cpp@@ -833,13 +833,9 @@ NormalizeL2::NormalizeL2(const std::shared_ptr<ov::Node>& op, const GraphContextOPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (inputShapes.size() != 2 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges");- }-- if (getInputShapeAtPort(DATA).getRank() > 4 || getInputShapeAtPort(DATA).getRank() < 2) {- THROW_CPU_NODE_ERR("has invalid input shape. Normalize supports from 2D to 4D blobs.");- }+ CPU_NODE_ASSERT(inputShapes.size() == 2 && outputShapes.size() == 1, "has incorrect number of input/output edges");+ CPU_NODE_ASSERT(getInputShapeAtPort(DATA).getRank() <= 4 && getInputShapeAtPort(DATA).getRank() >= 2,+ "has invalid input shape. Normalize supports from 2D to 4D blobs.");auto norm = ov::as_type_ptr<const ov::op::v0::NormalizeL2>(op);attrs.eps = norm->get_eps();@@ -874,22 +870,19 @@ void NormalizeL2::initSupportedPrimitiveDescriptors() {inputPrecision = outputPrecision = ov::element::f32;}- if (!one_of(inputPrecision,- ov::element::f32,- ov::element::bf16,- ov::element::f16,- ov::element::i8,- ov::element::u8)) {- THROW_CPU_NODE_ERR("has unsupported input precision: ", inputPrecision);- }- if (!one_of(outputPrecision,- ov::element::f32,- ov::element::bf16,- ov::element::f16,- ov::element::i8,- ov::element::u8)) {- THROW_CPU_NODE_ERR("has unsupported output precision: ", outputPrecision);- }+ CPU_NODE_ASSERT(+ one_of(inputPrecision, ov::element::f32, ov::element::bf16, ov::element::f16, ov::element::i8, ov::element::u8),+ "has unsupported input precision: ",+ inputPrecision);++ CPU_NODE_ASSERT(one_of(outputPrecision,+ ov::element::f32,+ ov::element::bf16,+ ov::element::f16,+ ov::element::i8,+ ov::element::u8),+ "has unsupported output precision: ",+ outputPrecision);attrs.input_prec = inputPrecision;attrs.output_prec = outputPrecision;@@ -960,11 +953,11 @@ void NormalizeL2::setPostOps(dnnl::primitive_attr& kernel_attrs,continue;}- THROW_CPU_NODE_ERR("Fusing of ",- NameFromType(node->getType()),- " operation to ",- NameFromType(this->getType()),- " node is not implemented");+ CPU_NODE_THROW("Fusing of ",+ NameFromType(node->getType()),+ " operation to ",+ NameFromType(this->getType()),+ " node is not implemented");}kernel_attrs.set_post_ops(ops);@@ -973,15 +966,9 @@ void NormalizeL2::setPostOps(dnnl::primitive_attr& kernel_attrs,void NormalizeL2::createPrimitive() {auto dstMemPtr = getDstMemoryAtPort(DATA);auto srcMemPtr = getSrcMemoryAtPort(DATA);- if (!dstMemPtr) {- THROW_CPU_NODE_ERR("can't get destination memory");- }- if (!srcMemPtr) {- THROW_CPU_NODE_ERR("can't get input memory");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has nullable preferable primitive descriptor");- }+ CPU_NODE_ASSERT(dstMemPtr, "can't get destination memory");+ CPU_NODE_ASSERT(srcMemPtr, "can't get input memory");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "has nullable preferable primitive descriptor");if (!attrs.cornerCase) {if (srcMemPtr->getDesc().hasLayoutType(LayoutType::ncsp)) {@@ -993,7 +980,7 @@ void NormalizeL2::createPrimitive() {} else if (srcMemPtr->getDesc().hasLayoutType(LayoutType::nspc)) {attrs.layout = LayoutType::nspc;} else {- THROW_CPU_NODE_ERR("has selected layout which is not supported");+ CPU_NODE_THROW("has selected layout which is not supported");}}@@ -1027,9 +1014,7 @@ void NormalizeL2::prepareParams() {auto cache = context->getParamsCache();auto result = cache->getOrCreate(key, builder);- if (!result.first) {- THROW_CPU_NODE_ERR("Primitive descriptor was not found.");- }+ CPU_NODE_ASSERT(result.first, "Primitive descriptor was not found.");execPtr = result.first;}@@ -1039,9 +1024,7 @@ void NormalizeL2::executeDynamicImpl(const dnnl::stream& strm) {}void NormalizeL2::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("doesn't have a compiled executor.");- }+ CPU_NODE_ASSERT(execPtr, "doesn't have a compiled executor.");const auto* src_ptr = getSrcDataAtPortAs<const uint8_t>(DATA);auto* dst_ptr = getDstDataAtPortAs<uint8_t>(DATA);@@ -1081,10 +1064,9 @@ public:const dnnl::primitive_attr& kernel_attrs,const VectorDims& dims): attrs(attrs_) {- if (attrs.layout != LayoutType::ncsp && attrs.layout != LayoutType::nspc &&- attrs.layout != LayoutType::nCsp8c && attrs.layout != LayoutType::nCsp16c) {- OPENVINO_THROW("Normalaize2L executor has selected layout which is not supported");- }+ OPENVINO_ASSERT(+ one_of(attrs.layout, LayoutType::ncsp, LayoutType::nspc, LayoutType::nCsp8c, LayoutType::nCsp16c),+ "Normalaize2L executor has selected layout which is not supported");jcp.src_dt = DnnlExtensionUtils::ElementTypeToDataType(attrs.input_prec);jcp.dst_dt = DnnlExtensionUtils::ElementTypeToDataType(attrs.output_prec);@@ -1424,9 +1406,8 @@ public:: dims(std::move(dims)),kernel_attrs(kernel_attrs),attrs(attrs) {- if (attrs.layout != LayoutType::ncsp) {- OPENVINO_THROW("Reference Executor of 'NormalizeL2' supports only ncsp layout!");- }+ OPENVINO_ASSERT(attrs.layout == LayoutType::ncsp,+ "Reference Executor of 'NormalizeL2' supports only ncsp layout!");const auto& p = (*kernel_attrs.get()).post_ops_;for (int i = 0; i < p.len(); i++) {diff --git a/src/plugins/intel_cpu/src/nodes/one_hot.cpp b/src/plugins/intel_cpu/src/nodes/one_hot.cppindex 61e9a507b89..7d5b03f64e4 100644--- a/src/plugins/intel_cpu/src/nodes/one_hot.cpp+++ b/src/plugins/intel_cpu/src/nodes/one_hot.cpp@@ -79,14 +79,12 @@ OneHot::OneHot(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& coif (axis < 0) {axis += output_dims_size;}- if (axis < 0 || axis >= output_dims_size) {- THROW_CPU_NODE_ERR("has unsupported 'axis' attribute: ", oneHot->get_axis());- }+ CPU_NODE_ASSERT(axis >= 0 && axis < output_dims_size, "has unsupported 'axis' attribute: ", oneHot->get_axis());- if (((1 + srcDims.size()) != dstDims.size()) &&- (!depthNode || srcDims.size() != 1 || dstDims.size() != 1 || dstDims[0] != depth || srcDims[0] != 1)) {- THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions!");- }+ CPU_NODE_ASSERT(+ ((1 + srcDims.size()) == dstDims.size()) ||+ (depthNode && srcDims.size() == 1 && dstDims.size() == 1 && dstDims[0] == depth && srcDims[0] == 1),+ "has incorrect number of input/output dimensions!");}bool OneHot::needShapeInfer() const {@@ -106,9 +104,8 @@ void OneHot::initSupportedPrimitiveDescriptors() {// check a precision of the input tensorauto input_precision = getOriginalInputPrecisionAtPort(INDICES_ID);- if (input_precision != ov::element::i32) {- THROW_CPU_NODE_ERR("has incorrect input precision for the input. Only I32 is supported!");- }+ CPU_NODE_ASSERT(input_precision == ov::element::i32,+ "has incorrect input precision for the input. Only I32 is supported!");output_precision = getOriginalOutputPrecisionAtPort(0);addSupportedPrimDesc({{LayoutType::ncsp, input_precision},diff --git a/src/plugins/intel_cpu/src/nodes/pad.cpp b/src/plugins/intel_cpu/src/nodes/pad.cppindex 60d8bf3efef..336ed890e99 100644--- a/src/plugins/intel_cpu/src/nodes/pad.cpp+++ b/src/plugins/intel_cpu/src/nodes/pad.cpp@@ -71,23 +71,15 @@ Pad::Pad(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)if (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (inputShapes.size() != 3 && inputShapes.size() != 4) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("Incorrect number of output edges");- }+ CPU_NODE_ASSERT(inputShapes.size() == 3 || inputShapes.size() == 4, "has incorrect number of input edges");+ CPU_NODE_ASSERT(outputShapes.size() == 1, "Incorrect number of output edges");const size_t srcDimsRank = inputShapes[DATA_ID].getRank();const size_t dstDimsRank = outputShapes[DATA_ID].getRank();- if (srcDimsRank != dstDimsRank) {- THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions!");- }+ CPU_NODE_ASSERT(srcDimsRank == dstDimsRank, "has incorrect number of input/output dimensions!");const auto* pad = ov::as_type<const op::util::PadBase>(op.get());- if (!pad) {- THROW_CPU_NODE_ERR("couldn't be casted to op of opset1");- }+ CPU_NODE_ASSERT(pad, "couldn't be casted to op of opset1");shapeHasDataDependency = !ov::is_type<op::v0::Constant>(op->get_input_node_shared_ptr(PADS_BEGIN_ID)) ||!ov::is_type<op::v0::Constant>(op->get_input_node_shared_ptr(PADS_END_ID));@@ -103,9 +95,7 @@ Pad::Pad(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)for (const auto& value : pad_data) {parameter.push_back(value);}- if (parameter.size() != srcDimsRank) {- THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions!");- }+ CPU_NODE_ASSERT(parameter.size() == srcDimsRank, "has incorrect number of input/output dimensions!");}};@@ -118,9 +108,7 @@ Pad::Pad(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)attrs.padMode = CONSTANT;if (isPadValueSpecified && op->get_input_node_shared_ptr(PAD_VALUE_ID)->get_type_info() ==ov::op::v0::Constant::get_type_info_static()) {- if (!ov::is_scalar(pad->get_input_shape(PAD_VALUE_ID))) {- THROW_CPU_NODE_ERR("has non scalar 'pad_value' input");- }+ CPU_NODE_ASSERT(ov::is_scalar(pad->get_input_shape(PAD_VALUE_ID)), "has non scalar 'pad_value' input");attrs.padValue = ov::as_type_ptr<const op::v0::Constant>(pad->get_input_node_shared_ptr(PAD_VALUE_ID))->cast_vector<float>()[0];attrs.constPadValue = true;@@ -132,7 +120,7 @@ Pad::Pad(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)} else if (pad_mode == op::PadMode::SYMMETRIC) {attrs.padMode = SYMMETRIC;} else {- THROW_CPU_NODE_ERR("has unsupported pad_mode: " + ov::as_string(pad_mode));+ CPU_NODE_THROW("has unsupported pad_mode: " + ov::as_string(pad_mode));}}@@ -264,12 +252,8 @@ void Pad::PadExecutor::paramsInitialization(const PadAttrs& attrs,params.attrs = attrs;const auto& srcMemPtr = srcMemory[DATA_ID];const auto& dstMemPtr = dstMemory[DATA_ID];- if (!dstMemPtr || !dstMemPtr->isDefined()) {- OPENVINO_THROW("Pad executor has undefined source memory.");- }- if (!srcMemPtr || !srcMemPtr->isDefined()) {- OPENVINO_THROW("Pad executor has undefined destination memory.");- }+ OPENVINO_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "Pad executor has undefined source memory.");+ OPENVINO_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "Pad executor has undefined destination memory.");const auto srcBlockMemDesc = srcMemPtr->getDescWithType<BlockedMemoryDesc>();const auto dstBlockMemDesc = dstMemPtr->getDescWithType<BlockedMemoryDesc>();const auto& srcDims = srcBlockMemDesc->getBlockDims();@@ -443,9 +427,7 @@ void Pad::PadExecutor::exec(const MemoryPtr& srcMemPtr, const MemoryPtr& dstMemP}void Pad::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("has not compiled executor.");- }+ CPU_NODE_ASSERT(execPtr, "has not compiled executor.");execPtr->exec(getSrcMemoryAtPort(0), getDstMemoryAtPort(0));}diff --git a/src/plugins/intel_cpu/src/nodes/paged_attn.cpp b/src/plugins/intel_cpu/src/nodes/paged_attn.cppindex 0e1cfcd8800..3c9f411b90f 100644--- a/src/plugins/intel_cpu/src/nodes/paged_attn.cpp+++ b/src/plugins/intel_cpu/src/nodes/paged_attn.cpp@@ -214,7 +214,7 @@ void PagedAttention::createPrimitive() {auto cache = context->getParamsCache();auto result = cache->getOrCreate(key, builder);if (!result.first) {- THROW_CPU_NODE_ERR("AttentionExecutor creation fails with precision " + rtPrecision.to_string());+ CPU_NODE_THROW("AttentionExecutor creation fails with precision " + rtPrecision.to_string());}m_executor = result.first;}diff --git a/src/plugins/intel_cpu/src/nodes/pooling.cpp b/src/plugins/intel_cpu/src/nodes/pooling.cppindex 0490f38fadc..09fcde461fb 100644--- a/src/plugins/intel_cpu/src/nodes/pooling.cpp+++ b/src/plugins/intel_cpu/src/nodes/pooling.cpp@@ -128,9 +128,7 @@ dnnl::pooling_forward::primitive_desc createDescriptorHelper(const dnnl::engine&const std::vector<ptrdiff_t>& effective_pad_end,const std::vector<ptrdiff_t>& effective_dilation,const dnnl::primitive_attr& attr) {- if (alg == dnnl::algorithm::undef) {- OPENVINO_THROW("Unsupported pooling type");- }+ OPENVINO_ASSERT(alg != dnnl::algorithm::undef, "Unsupported pooling type");auto convert = [](std::vector<ptrdiff_t> orig_dims) {return memory::dims(orig_dims.begin(), orig_dims.end());@@ -303,12 +301,8 @@ void Pooling::getSupportedDescriptors() {return;}- if (getParentEdges().size() != 1) {- THROW_CPU_NODE_ERR("Incorrect number of input edges");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("Incorrect number of output edges");- }+ CPU_NODE_ASSERT(getParentEdges().size() == 1, "Incorrect number of input edges");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "Incorrect number of output edges");ov::element::Type inputPrecision = getOriginalInputPrecisionAtPort(0);ov::element::Type outputPrecision = getOriginalOutputPrecisionAtPort(0);@@ -390,9 +384,8 @@ void Pooling::getSupportedDescriptors() {auto inputDataType = DnnlExtensionUtils::ElementTypeToDataType(inputPrecision);auto outputDataType = DnnlExtensionUtils::ElementTypeToDataType(outputPrecision);- if ((inputRank < 3) || (inputRank > 5)) {- THROW_CPU_NODE_ERR("Unsupported mode. Only 3D, 4D and 5D blobs are supported as input.");- }+ CPU_NODE_ASSERT((inputRank >= 3) && (inputRank <= 5),+ "Unsupported mode. Only 3D, 4D and 5D blobs are supported as input.");initEffectiveAttributes(inShape, MemoryDescUtils::makeDummyShape(childShape));@@ -464,9 +457,7 @@ void Pooling::getSupportedDescriptors() {void Pooling::prepareParams() {auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("did not set preferable primitive descriptor");- }+ CPU_NODE_ASSERT(selected_pd, "did not set preferable primitive descriptor");AttrPtr attr;if (isDynamicNode()) {@@ -486,12 +477,8 @@ void Pooling::prepareParams() {if (useACL) {auto dstMemPtr = getDstMemoryAtPort(0);auto srcMemPtr = getSrcMemoryAtPort(0);- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Destination memory is undefined.");- }- if (!srcMemPtr || !srcMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Input memory is undefined.");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "Destination memory is undefined.");+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "Input memory is undefined.");std::vector<MemoryDescPtr> srcMemoryDescs;for (size_t i = 0; i < getOriginalInputsNumber(); i++) {@@ -556,9 +543,7 @@ void Pooling::prepareParams() {dnnlExecPtr = result.first;- if (!dnnlExecPtr) {- THROW_CPU_NODE_ERR("Primitive descriptor was not found.");- }+ CPU_NODE_ASSERT(dnnlExecPtr, "Primitive descriptor was not found.");auto scratchpadMem = getScratchPadMem(dnnlExecPtr->getScratchPadDesc());primArgs[DNNL_ARG_SCRATCHPAD] = scratchpadMem->getPrimitive();@@ -589,7 +574,7 @@ void Pooling::execute(const dnnl::stream& strm) {execPtr->exec(srcMemory, dstMemory, postOpsArgs);} else {- THROW_CPU_NODE_ERR("doesn't have an initialized executor");+ CPU_NODE_THROW("doesn't have an initialized executor");}}@@ -816,11 +801,11 @@ void Pooling::setPostOps(dnnl::primitive_attr& attr) {continue;}- THROW_CPU_NODE_ERR("Fusing of ",- NameFromType(node->getType()),- " operation to ",- NameFromType(this->getType()),- " node is not implemented");+ CPU_NODE_THROW("Fusing of ",+ NameFromType(node->getType()),+ " operation to ",+ NameFromType(this->getType()),+ " node is not implemented");}attr.set_post_ops(ops);diff --git a/src/plugins/intel_cpu/src/nodes/priorbox.cpp b/src/plugins/intel_cpu/src/nodes/priorbox.cppindex ffa5593e3a8..c22234bb8e6 100644--- a/src/plugins/intel_cpu/src/nodes/priorbox.cpp+++ b/src/plugins/intel_cpu/src/nodes/priorbox.cpp@@ -77,9 +77,8 @@ PriorBox::PriorBox(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtrfor (float aspect_ratio_item : attrs.aspect_ratio) {exist = false;- if (std::fabs(aspect_ratio_item) < std::numeric_limits<float>::epsilon()) {- THROW_CPU_NODE_ERR("has aspect_ratio param can't be equal to zero");- }+ CPU_NODE_ASSERT(std::fabs(aspect_ratio_item) >= std::numeric_limits<float>::epsilon(),+ "has aspect_ratio param can't be equal to zero");for (float _aspect_ratio : aspect_ratio) {if (std::fabs(aspect_ratio_item - _aspect_ratio) < 1e-6) {@@ -102,16 +101,14 @@ PriorBox::PriorBox(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtrif (attrs.variance.size() == 1 || attrs.variance.size() == 4) {for (float i : attrs.variance) {- if (i < 0) {- THROW_CPU_NODE_ERR("variance must be > 0.");- }+ CPU_NODE_ASSERT(i >= 0, "variance must be > 0.");variance.push_back(i);}} else if (attrs.variance.empty()) {variance.push_back(0.1F);} else {- THROW_CPU_NODE_ERR("has wrong number of variance values. Not less than 1 and more than 4 variance values.");+ CPU_NODE_THROW("has wrong number of variance values. Not less than 1 and more than 4 variance values.");}}diff --git a/src/plugins/intel_cpu/src/nodes/proposal.cpp b/src/plugins/intel_cpu/src/nodes/proposal.cppindex 9e014725c5d..b40a9157c6a 100644--- a/src/plugins/intel_cpu/src/nodes/proposal.cpp+++ b/src/plugins/intel_cpu/src/nodes/proposal.cpp@@ -192,14 +192,14 @@ void Proposal::execute([[maybe_unused]] const dnnl::stream& strm) {const float imgHeight = imgInfoData[0];const float imgWidth = imgInfoData[1];if (!std::isnormal(imgHeight) || !std::isnormal(imgWidth) || (imgHeight < 0.F) || (imgWidth < 0.F)) {- THROW_CPU_NODE_ERR("image info input must have positive image height and width.");+ CPU_NODE_THROW("image info input must have positive image height and width.");}// scale factor for height & widthconst float scaleHeight = imgInfoData[2];const float scaleWidth = imgInfoSize == 4 ? imgInfoData[3] : scaleHeight;if (!std::isfinite(scaleHeight) || !std::isfinite(scaleWidth) || (scaleHeight < 0.F) || (scaleWidth < 0.F)) {- THROW_CPU_NODE_ERR("image info input must have non negative scales.");+ CPU_NODE_THROW("image info input must have non negative scales.");}ov::Extensions::Cpu::XARCH::proposal_exec(probabilitiesData,@@ -212,7 +212,7 @@ void Proposal::execute([[maybe_unused]] const dnnl::stream& strm) {outProbData,conf);} catch (const ov::Exception& e) {- THROW_CPU_NODE_ERR(e.what());+ CPU_NODE_THROW(e.what());}}diff --git a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cppindex f74beb20189..61fb7f4b527 100644--- a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp+++ b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp@@ -85,20 +85,15 @@ PSROIPooling::PSROIPooling(const std::shared_ptr<ov::Node>& op, const GraphConteconst auto defPsroi = ov::as_type_ptr<const ov::op::v1::DeformablePSROIPooling>(op);noTrans = op->get_input_size() == 2;- if (op->get_input_shape(0).size() != 4) {- THROW_CPU_NODE_ERR("has first input with incorrect rank: " + std::to_string(op->get_input_shape(0).size()));- }- if (op->get_input_shape(1).size() != 2) {- THROW_CPU_NODE_ERR("has second input with incorrect rank: " + std::to_string(op->get_input_shape(1).size()));- }- if (!noTrans && op->get_input_shape(2).size() != 4) {- THROW_CPU_NODE_ERR("has third input with incorrect rank: " + std::to_string(op->get_input_shape(2).size()));- }+ CPU_NODE_ASSERT(op->get_input_shape(0).size() == 4,+ "has first input with incorrect rank: " + std::to_string(op->get_input_shape(0).size()));+ CPU_NODE_ASSERT(op->get_input_shape(1).size() == 2,+ "has second input with incorrect rank: " + std::to_string(op->get_input_shape(1).size()));+ CPU_NODE_ASSERT(noTrans || op->get_input_shape(2).size() == 4,+ "has third input with incorrect rank: " + std::to_string(op->get_input_shape(2).size()));if (psroi) {- if (psroi->get_input_size() != 2) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(psroi->get_input_size() == 2, "has incorrect number of input/output edges!");mode = psroi->get_mode();if (mode == "average") {@@ -117,9 +112,8 @@ PSROIPooling::PSROIPooling(const std::shared_ptr<ov::Node>& op, const GraphContepooledWidth = groupSize;} else if (defPsroi) {- if (defPsroi->get_input_size() != 2 && defPsroi->get_input_size() != 3) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(defPsroi->get_input_size() == 2 || defPsroi->get_input_size() == 3,+ "has incorrect number of input/output edges!");algorithm = Algorithm::PSROIPoolingBilinearDeformable;@@ -228,20 +222,18 @@ void PSROIPooling::unpackParams(const BlockedMemoryDesc& srcDesc,size_t expectedOutBlockDimsSize = (outIsBlk ? 5 : 4);const auto& inBlkDims = srcDesc.getBlockDims();const auto& outBlkDims = dstDesc.getBlockDims();- if (inBlkDims.size() != expectedInBlockDimsSize) {- THROW_CPU_NODE_ERR("has unexpected size of blocking dims in input (given ",- inBlkDims.size(),- ", expected ",- expectedInBlockDimsSize,- ")");- }- if (outBlkDims.size() != expectedOutBlockDimsSize) {- THROW_CPU_NODE_ERR("has unexpected size of blocking dims in output (given ",- outBlkDims.size(),- ", expected ",- expectedOutBlockDimsSize,- ")");- }+ CPU_NODE_ASSERT(inBlkDims.size() == expectedInBlockDimsSize,+ "has unexpected size of blocking dims in input (given ",+ inBlkDims.size(),+ ", expected ",+ expectedInBlockDimsSize,+ ")");+ CPU_NODE_ASSERT(outBlkDims.size() == expectedOutBlockDimsSize,+ "has unexpected size of blocking dims in output (given ",+ outBlkDims.size(),+ ", expected ",+ expectedOutBlockDimsSize,+ ")");inBlockSize = (inpIsBlk ? srcDesc.getBlockDims()[4] : 1);outBlockSize = (outIsBlk ? dstDesc.getBlockDims()[4] : 1);@@ -656,11 +648,10 @@ void PSROIPooling::execute([[maybe_unused]] const dnnl::stream& strm) {auto inputPrec = getParentEdgeAt(0)->getMemory().getDesc().getPrecision();auto outputPrec = getChildEdgeAt(0)->getMemory().getDesc().getPrecision();- if ((inputPrec != ov::element::bf16 || outputPrec != ov::element::bf16) &&- (inputPrec != ov::element::f32 || outputPrec != ov::element::f32)) {- THROW_CPU_NODE_ERR("has different precisions on input: " + inputPrec.get_type_name() +- " and output: " + outputPrec.get_type_name());- }+ CPU_NODE_ASSERT((inputPrec == ov::element::bf16 && outputPrec == ov::element::bf16) ||+ (inputPrec == ov::element::f32 && outputPrec == ov::element::f32),+ "has different precisions on input: " + inputPrec.get_type_name() ++ " and output: " + outputPrec.get_type_name());PSROIPoolingContext ctx = {*this,diff --git a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp b/src/plugins/intel_cpu/src/nodes/qkv_proj.cppindex 4d28283d31f..c6ea64f4225 100644--- a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp+++ b/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp@@ -345,7 +345,7 @@ void QKVProjection::createPrimitive() {}#endifif (!m_executor) {- THROW_CPU_NODE_ERR("Executor creation fails with precision " + rtPrecision.to_string());+ CPU_NODE_THROW("Executor creation fails with precision " + rtPrecision.to_string());}}diff --git a/src/plugins/intel_cpu/src/nodes/random_uniform.cpp b/src/plugins/intel_cpu/src/nodes/random_uniform.cppindex 69193ce1d43..ac774d1579c 100644--- a/src/plugins/intel_cpu/src/nodes/random_uniform.cpp+++ b/src/plugins/intel_cpu/src/nodes/random_uniform.cpp@@ -97,7 +97,7 @@ RandomUniform::RandomUniform(const std::shared_ptr<ov::Node>& op, const GraphConm_algo = MERSENNE_TWISTER;break;default:- THROW_CPU_NODE_ERR("Alignment of RandomUniform ", alignment, " is not supported by the CPU plugin.");+ CPU_NODE_THROW("Alignment of RandomUniform ", alignment, " is not supported by the CPU plugin.");}for (size_t i = 0LU; i < op->get_input_size(); i++) {@@ -113,10 +113,10 @@ RandomUniform::RandomUniform(const std::shared_ptr<ov::Node>& op, const GraphConvoid RandomUniform::getSupportedDescriptors() {if (getParentEdges().size() != 3) {- THROW_CPU_NODE_ERR("has incorrect number of input edges.");+ CPU_NODE_THROW("has incorrect number of input edges.");}if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges.");+ CPU_NODE_THROW("has incorrect number of output edges.");}}@@ -204,7 +204,7 @@ void RandomUniform::execute([[maybe_unused]] const dnnl::stream& strm) {} else if (m_algo == STL) {computeStl(data, m_output_elements_count);} else {- THROW_CPU_NODE_ERR("does not support the selected algorithm.");+ CPU_NODE_THROW("does not support the selected algorithm.");}}@@ -295,7 +295,7 @@ void RandomUniform::evalRange() {EL_CASE(i64)EL_CASE(i32)default:- THROW_CPU_NODE_ERR("has unsupported output precision: ", m_output_prc);+ CPU_NODE_THROW("has unsupported output precision: ", m_output_prc);}#undef EL_CASE@@ -315,7 +315,7 @@ void RandomUniform::initEdgeValues(OutputType& dst, const void* src, const elemeEL_CASE(i64)EL_CASE(i32)default:- THROW_CPU_NODE_ERR("has unsupported output precision: ", output_type);+ CPU_NODE_THROW("has unsupported output precision: ", output_type);}#undef EL_CASE@@ -618,7 +618,7 @@ std::pair<uint64_t, uint64_t> RandomUniform::computePhilox(void* out,EXEC_CASE(i32)EXEC_CASE(i64)default:- THROW_CPU_NODE_ERR("Unsupported type of RandomUniform: ", m_output_prc.to_string());+ CPU_NODE_THROW("Unsupported type of RandomUniform: ", m_output_prc.to_string());}#undef EXEC_CASE@@ -865,7 +865,7 @@ void RandomUniform::computeMersenneTwister(void* out, size_t output_elements_couEXEC_CASE(i32)EXEC_CASE(i64)default:- THROW_CPU_NODE_ERR("Unsupported type of RandomUniform: ", m_output_prc.to_string());+ CPU_NODE_THROW("Unsupported type of RandomUniform: ", m_output_prc.to_string());}});}@@ -905,7 +905,7 @@ void RandomUniform::computeStl(void* out, size_t work_amount) {work_amount);} break;default:- THROW_CPU_NODE_ERR("has unsupported output type: ", m_output_prc);+ CPU_NODE_THROW("has unsupported output type: ", m_output_prc);}}diff --git a/src/plugins/intel_cpu/src/nodes/range.cpp b/src/plugins/intel_cpu/src/nodes/range.cppindex 4c243e447e5..e67ec788978 100644--- a/src/plugins/intel_cpu/src/nodes/range.cpp+++ b/src/plugins/intel_cpu/src/nodes/range.cpp@@ -49,29 +49,20 @@ Range::Range(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contOPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (getOriginalInputsNumber() != 3 || getOriginalOutputsNumber() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(getOriginalInputsNumber() == 3 && getOriginalOutputsNumber() == 1,+ "has incorrect number of input/output edges!");auto start_dims = op->get_input_shape(RANGE_START);- if (ov::shape_size(start_dims) != 1) {- THROW_CPU_NODE_ERR("has start scalar with more than 1 value");- }+ CPU_NODE_ASSERT(ov::shape_size(start_dims) == 1, "has start scalar with more than 1 value");auto limit_dims = op->get_input_shape(RANGE_LIMIT);- if (ov::shape_size(limit_dims) != 1) {- THROW_CPU_NODE_ERR("has limit scalar with more than 1 value");- }+ CPU_NODE_ASSERT(ov::shape_size(limit_dims) == 1, "has limit scalar with more than 1 value");auto delta_dims = op->get_input_shape(RANGE_DELTA);- if (ov::shape_size(delta_dims) != 1) {- THROW_CPU_NODE_ERR("has delta scalar with more than 1 value");- }+ CPU_NODE_ASSERT(ov::shape_size(delta_dims) == 1, "has delta scalar with more than 1 value");size_t dstRank = op->get_output_partial_shape(0).size();- if (dstRank > 1) {- THROW_CPU_NODE_ERR("has unsupported rank for output: ", dstRank);- }+ CPU_NODE_ASSERT(dstRank <= 1, "has unsupported rank for output: ", dstRank);}void Range::initSupportedPrimitiveDescriptors() {@@ -122,11 +113,9 @@ void Range::execute([[maybe_unused]] const dnnl::stream& strm) {retcode = rangeKernel<int32_t>();break;default:- THROW_CPU_NODE_ERR("Incorrect output precision. Only FP32 and I32 are supported!");- }- if (retcode == PARAMETER_MISMATCH) {- THROW_CPU_NODE_ERR("Range indexes exceeds data tensor dimension");+ CPU_NODE_THROW("Incorrect output precision. Only FP32 and I32 are supported!");}+ CPU_NODE_ASSERT(retcode != PARAMETER_MISMATCH, "Range indexes exceeds data tensor dimension");}template <typename data_t>diff --git a/src/plugins/intel_cpu/src/nodes/rdft.cpp b/src/plugins/intel_cpu/src/nodes/rdft.cppindex 43c134376a9..e84348b91e4 100644--- a/src/plugins/intel_cpu/src/nodes/rdft.cpp+++ b/src/plugins/intel_cpu/src/nodes/rdft.cpp@@ -98,14 +98,10 @@ RDFT::RDFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contex}const size_t numInputs = getOriginalInputsNumber();- if (numInputs != 2 && numInputs != 3) {- THROW_CPU_NODE_ERR("has invalid number of input/output edges: ", numInputs);- }+ CPU_NODE_ASSERT(numInputs == 2 || numInputs == 3, "has invalid number of input/output edges: ", numInputs);const auto axesRank = inputShapes[AXES_INDEX].getRank();- if (axesRank != 1) {- THROW_CPU_NODE_ERR("has invalid 'axes' input tensor with rank: ", axesRank);- }+ CPU_NODE_ASSERT(axesRank == 1, "has invalid 'axes' input tensor with rank: ", axesRank);inverse = ov::is_type<ov::op::v9::IRDFT>(op);@@ -119,9 +115,7 @@ RDFT::RDFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contexif (numInputs > 2) {const auto signalSizeRank = inputShapes[SIGNAL_SIZE_INDEX].getRank();- if (signalSizeRank != 1) {- THROW_CPU_NODE_ERR("has invalid 'signalSize' input tensor with rank: ", signalSizeRank);- }+ CPU_NODE_ASSERT(signalSizeRank == 1, "has invalid 'signalSize' input tensor with rank: ", signalSizeRank);auto* signalSizesNode = ov::as_type<ov::op::v0::Constant>(op->get_input_node_ptr(2));if (!signalSizesNode) {return;@@ -142,20 +136,18 @@ void RDFT::initSupportedPrimitiveDescriptors() {}const auto& dataPrecision = getOriginalInputPrecisionAtPort(DATA_INDEX);- if (!dataPrecision.is_real()) {- THROW_CPU_NODE_ERR("has unsupported 'data' input precision: ", dataPrecision.get_type_name());- }+ CPU_NODE_ASSERT(dataPrecision.is_real(), "has unsupported 'data' input precision: ", dataPrecision.get_type_name());const auto& axesPrecision = getOriginalInputPrecisionAtPort(AXES_INDEX);- if (axesPrecision != ov::element::i32 && axesPrecision != ov::element::i64) {- THROW_CPU_NODE_ERR("has unsupported 'axes' input precision: ", axesPrecision.get_type_name());- }+ CPU_NODE_ASSERT(axesPrecision == ov::element::i32 || axesPrecision == ov::element::i64,+ "has unsupported 'axes' input precision: ",+ axesPrecision.get_type_name());if (inputShapes.size() > SIGNAL_SIZE_INDEX) {const auto& signalSizePrecision = getOriginalInputPrecisionAtPort(SIGNAL_SIZE_INDEX);- if (signalSizePrecision != ov::element::i32 && signalSizePrecision != ov::element::i64) {- THROW_CPU_NODE_ERR("has unsupported 'signalSize' input precision: ", signalSizePrecision.get_type_name());- }+ CPU_NODE_ASSERT(signalSizePrecision == ov::element::i32 || signalSizePrecision == ov::element::i64,+ "has unsupported 'signalSize' input precision: ",+ signalSizePrecision.get_type_name());}std::vector<PortConfigurator> configurators(@@ -315,8 +307,8 @@ static void adjustInputSize(VectorDims& inputShape,size_t signalSize = signalSizes[i];if (signalSize <= inputSize) {inputShape[axis] = signalSize;- } else if (!isInverse) {- OPENVINO_THROW("Signal size greater than input size is not supported yet");+ } else {+ OPENVINO_ASSERT(isInverse, "Signal size greater than input size is not supported yet");}}if (isInverse) {diff --git a/src/plugins/intel_cpu/src/nodes/reduce.cpp b/src/plugins/intel_cpu/src/nodes/reduce.cppindex 4d72cd75fd0..ea65a9fbc8c 100644--- a/src/plugins/intel_cpu/src/nodes/reduce.cpp+++ b/src/plugins/intel_cpu/src/nodes/reduce.cpp@@ -2072,17 +2072,13 @@ Reduce::Reduce(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& cokeep_dims = reduce->get_keep_dims();auto reduceConst =ov::as_type_ptr<const ov::op::v0::Constant>(reduce->get_input_node_shared_ptr(REDUCE_INDEXES));- if (!reduceConst) {- THROW_CPU_NODE_ERR("second tensor is not constant!");- }+ CPU_NODE_ASSERT(reduceConst, "second tensor is not constant!");raw_axes = reduceConst->cast_vector<int>();} else if (const auto reduce = ov::as_type_ptr<ov::op::util::LogicalReductionKeepDims>(op)) {keep_dims = reduce->get_keep_dims();auto reduceConst =ov::as_type_ptr<const ov::op::v0::Constant>(reduce->get_input_node_shared_ptr(REDUCE_INDEXES));- if (!reduceConst) {- THROW_CPU_NODE_ERR("second tensor is not constant!");- }+ CPU_NODE_ASSERT(reduceConst, "second tensor is not constant!");raw_axes = reduceConst->cast_vector<int>();}set_use_aux_kernel = false;@@ -2097,29 +2093,23 @@ Reduce::Reduce(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co}void Reduce::getSupportedDescriptors() {- if (getParentEdges().size() != 2) {- THROW_CPU_NODE_ERR("gets incorrect number of input edges!");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("gets incorrect number of output edges!");- }+ CPU_NODE_ASSERT(getParentEdges().size() == 2, "gets incorrect number of input edges!");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "gets incorrect number of output edges!");- if (getInputShapeAtPort(REDUCE_INDEXES).getRank() != 1) {- THROW_CPU_NODE_ERR("gets incorrect index vector dimension! Index vector should be 1 dimension.");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(REDUCE_INDEXES).getRank() == 1,+ "gets incorrect index vector dimension! Index vector should be 1 dimension.");if (keep_dims) {- if (getInputShapeAtPort(REDUCE_DATA).getRank() != getOutputShapeAtPort(0).getRank()) {- THROW_CPU_NODE_ERR("gets incorrect number of input/output dimensions!");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(REDUCE_DATA).getRank() == getOutputShapeAtPort(0).getRank(),+ "gets incorrect number of input/output dimensions!");} else {// In fact, after the Reduce operation, the shape must be a scalar if the previous one was 1d.// But for now, 0d tensor (scalar) is emulated as 1d tensor. Skip checking in such cases.bool is_emulated_0d_as_1d =getInputShapeAtPort(REDUCE_DATA).getRank() == 1 && getOutputShapeAtPort(0).getRank() == 1;- if (getInputShapeAtPort(REDUCE_DATA).getRank() <= getOutputShapeAtPort(0).getRank() && !is_emulated_0d_as_1d) {- THROW_CPU_NODE_ERR("gets incorrect number of input/output dimensions!");- }+ CPU_NODE_ASSERT(+ !(getInputShapeAtPort(REDUCE_DATA).getRank() <= getOutputShapeAtPort(0).getRank() && !is_emulated_0d_as_1d),+ "gets incorrect number of input/output dimensions!");}}@@ -2372,9 +2362,7 @@ void Reduce::prepareParams() {ReduceKey key = {reduce_post_jcp, attr.get_post_ops()};auto cache = context->getParamsCache();auto result = cache->getOrCreate(key, builder);- if (!result.first) {- THROW_CPU_NODE_ERR("has not found jit_uni_reduce_post_kernel_f32.");- }+ CPU_NODE_ASSERT(result.first, "has not found jit_uni_reduce_post_kernel_f32.");reduce_post_kernel = result.first;jit_mode = jit_mode && reduce_post_kernel;@@ -2391,15 +2379,9 @@ void Reduce::createPrimitive() {}auto dstMemPtr = getDstMemoryAtPort(0);auto srcMemPtr = getSrcMemoryAtPort(REDUCE_DATA);- if (!dstMemPtr) {- THROW_CPU_NODE_ERR("has null destination memory.");- }- if (!srcMemPtr) {- THROW_CPU_NODE_ERR("has null input memory.");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has nullable preferable primitive descriptor");- }+ CPU_NODE_ASSERT(dstMemPtr, "has null destination memory.");+ CPU_NODE_ASSERT(srcMemPtr, "has null input memory.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor() != nullptr, "has nullable preferable primitive descriptor");if (srcMemPtr->getDesc().hasLayoutType(LayoutType::ncsp)) {layout = ReduceLayoutType::reduce_ncsp;@@ -2537,7 +2519,7 @@ void Reduce::execute([[maybe_unused]] const dnnl::stream& strm) {auto* out_ptr = reinterpret_cast<float*>(dst_data);reduce_ref(in_ptr, out_ptr);} else {- THROW_CPU_NODE_ERR("supports only plain layout on machine w/o sse42.");+ CPU_NODE_THROW("supports only plain layout on machine w/o sse42.");}}}@@ -3417,7 +3399,7 @@ inline void Reduce::init_dst_data(uint8_t* out_ptr, size_t dst_size) {}break;default:- THROW_CPU_NODE_ERR("gets unsupported reduce mode.");+ CPU_NODE_THROW("gets unsupported reduce mode.");}}@@ -3483,9 +3465,8 @@ inline void Reduce::calc_process_dst_dims(std::vector<int>& reduce_axes, const Vif (axis < 0) {axis += src_dims.size();}- if (static_cast<size_t>(axis) > src_dims.size()) {- THROW_CPU_NODE_ERR("exceeds data tensor dimension on index to reduce");- }+ CPU_NODE_ASSERT(static_cast<size_t>(axis) <= src_dims.size(),+ "exceeds data tensor dimension on index to reduce");axes.insert(static_cast<size_t>(axis));}for (size_t i = 0; i < src_dims.size(); i++) {@@ -3508,15 +3489,13 @@ inline void Reduce::calc_process_dst_dims(std::vector<int>& reduce_axes, const V}}if (jit_mode && jit_beyond_5D) {- if (std::accumulate(out_dims.begin(), out_dims.end(), static_cast<size_t>(1), std::multiplies<>()) !=- std::accumulate(dst_dims.begin(), dst_dims.end(), static_cast<size_t>(1), std::multiplies<>())) {- THROW_CPU_NODE_ERR("gets incorrect number of output dimensions!");- }+ CPU_NODE_ASSERT(+ std::accumulate(out_dims.begin(), out_dims.end(), static_cast<size_t>(1), std::multiplies<>()) ==+ std::accumulate(dst_dims.begin(), dst_dims.end(), static_cast<size_t>(1), std::multiplies<>()),+ "gets incorrect number of output dimensions!");} else {for (size_t i = 0; i < std::min(out_dims.size(), dst_dims.size()); i++) {- if (out_dims[i] != dst_dims[i]) {- THROW_CPU_NODE_ERR("gets incorrect number of output dimensions!");- }+ CPU_NODE_ASSERT(out_dims[i] == dst_dims[i], "gets incorrect number of output dimensions!");}}}@@ -3661,7 +3640,7 @@ inline void Reduce::reduce_ref(const float* in_ptr, float* out_ptr) {});break;default:- THROW_CPU_NODE_ERR("gets unsupported reduce mode.");+ CPU_NODE_THROW("gets unsupported reduce mode.");}}@@ -3757,7 +3736,7 @@ inline void Reduce::reduce_ref_map(float* out_ptr, size_t work_amount_dst, size_});break;default:- THROW_CPU_NODE_ERR("gets unsupported reduce mode.");+ CPU_NODE_THROW("gets unsupported reduce mode.");}}@@ -3778,11 +3757,11 @@ void Reduce::setPostOps(dnnl::primitive_attr& attr, const VectorDims& postOpDimseltwiseNode->appendPostOps(ops, postOpDims, postOpsDataPtrs, getFusingAxis());continue;}- THROW_CPU_NODE_ERR("Fusing of ",- NameFromType(node->getType()),- " operation to ",- NameFromType(this->getType()),- " node is not implemented");+ CPU_NODE_THROW("Fusing of ",+ NameFromType(node->getType()),+ " operation to ",+ NameFromType(this->getType()),+ " node is not implemented");}attr.set_post_ops(ops);diff --git a/src/plugins/intel_cpu/src/nodes/reference.cpp b/src/plugins/intel_cpu/src/nodes/reference.cppindex f946d705d7d..5207e47322b 100644--- a/src/plugins/intel_cpu/src/nodes/reference.cpp+++ b/src/plugins/intel_cpu/src/nodes/reference.cpp@@ -72,7 +72,7 @@ void Reference::execute([[maybe_unused]] const dnnl::stream& strm) {auto inputs = prepareInputs();auto outputs = prepareOutputs();if (!ovCoreNode->evaluate(outputs, inputs)) {- THROW_CPU_NODE_ERR("evaluation failed for core operation: ", std::string(ovCoreNode->get_type_name()));+ CPU_NODE_THROW("evaluation failed for core operation: ", std::string(ovCoreNode->get_type_name()));}}@@ -102,10 +102,10 @@ void Reference::executeDynamicImpl(const dnnl::stream& strm) {}}} else {- THROW_CPU_NODE_ERR("got unexpected shape infer result status during the inference.");+ CPU_NODE_THROW("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()));+ CPU_NODE_THROW("evaluation failed for core operation: ", std::string(ovCoreNode->get_type_name()));}if (ShapeInferStatus::skip == result.status) {std::vector<VectorDims> newOutputDims;@@ -118,9 +118,8 @@ void Reference::executeDynamicImpl(const dnnl::stream& strm) {auto memory = getDstMemoryAtPort(i);auto& tensor = outputs[i];if (memory->getSize() != tensor.get_byte_size()) {- THROW_CPU_NODE_ERR(- "output tensor data size mismatch occurred during the inference on output port number ",- i);+ CPU_NODE_THROW("output tensor data size mismatch occurred during the inference on output port number ",+ i);}if (tensor.get_element_type() == element::string) {auto* srcPtr = tensor.data<StringMemory::OvString>();diff --git a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp b/src/plugins/intel_cpu/src/nodes/region_yolo.cppindex cf26014d092..c581b47eb3d 100644--- a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp+++ b/src/plugins/intel_cpu/src/nodes/region_yolo.cpp@@ -295,9 +295,8 @@ RegionYolo::RegionYolo(const std::shared_ptr<ov::Node>& op, const GraphContext::OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (op->get_input_size() != 1 || op->get_output_size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(op->get_input_size() == 1 && op->get_output_size() == 1,+ "has incorrect number of input/output edges!");const auto regionYolo = ov::as_type_ptr<const ov::op::v0::RegionYolo>(op);classes = regionYolo->get_num_classes();@@ -417,7 +416,7 @@ inline void RegionYolo::calculate_logistic(size_t start_index, int count, uint8_bf16_dst_data[i + start_index] = logistic_scalar(bf16_dst_data[i + start_index]);}} else {- THROW_CPU_NODE_ERR("Unsupported precision configuration outPrc=", output_prec.get_type_name());+ CPU_NODE_ASSERT("Unsupported precision configuration outPrc=", output_prec.get_type_name());}}}@@ -446,12 +445,11 @@ void RegionYolo::execute([[maybe_unused]] const dnnl::stream& strm) {output_size = B * IH * IW * mask_size * (classes + coords + 1);}- if (output_size != getDstMemoryAtPort(0)->getShape().getElementsCount()) {- THROW_CPU_NODE_ERR("Incorrect layer configuration or output dimensions. ",- output_size,- " != ",- getDstMemoryAtPort(0)->getShape().getElementsCount());- }+ CPU_NODE_ASSERT(output_size == getDstMemoryAtPort(0)->getShape().getElementsCount(),+ "Incorrect layer configuration or output dimensions. ",+ output_size,+ " != ",+ getDstMemoryAtPort(0)->getShape().getElementsCount());size_t inputs_size = IH * IW * num_ * (classes + coords + 1);size_t total_size = 2 * IH * IW;diff --git a/src/plugins/intel_cpu/src/nodes/reorder.cpp b/src/plugins/intel_cpu/src/nodes/reorder.cppindex 0bb6df18b55..d08023c49d4 100644--- a/src/plugins/intel_cpu/src/nodes/reorder.cpp+++ b/src/plugins/intel_cpu/src/nodes/reorder.cpp@@ -55,7 +55,7 @@ bool Reorder::isExecutable() const {Reorder::Reorder(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context): Node(op, context, PassThroughShapeInferFactory()) {- THROW_CPU_NODE_ERR("could not create CPU node from Core node.");+ CPU_NODE_THROW("could not create CPU node from Core node.");}Reorder::Reorder(const MemoryDesc& input,@@ -74,12 +74,8 @@ Reorder::Reorder(const MemoryDesc& input,}void Reorder::getSupportedDescriptors() {- if (getParentEdges().size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input edges.");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges.");- }+ CPU_NODE_ASSERT(getParentEdges().size() == 1, "has incorrect number of input edges.");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges.");}void Reorder::initSupportedPrimitiveDescriptors() {@@ -109,7 +105,7 @@ void Reorder::initSupportedPrimitiveDescriptors() {config.inConfs[0].setMemDesc(parent->getSelectedPrimitiveDescriptor()->getConfig().outConfs[0].getMemDesc());config.outConfs[0].setMemDesc(child->getSelectedPrimitiveDescriptor()->getConfig().inConfs[0].getMemDesc());} else {- THROW_CPU_NODE_ERR("could not initialize supported PDs.");+ CPU_NODE_THROW("could not initialize supported PDs.");}supportedPrimitiveDescriptors.emplace_back(config, impl_desc_type::reorder);@@ -122,7 +118,7 @@ void Reorder::initSupportedPrimitiveDescriptors() {if (isDynamic && (config.inConfs[0].getMemDesc()->getShape().getRank() !=config.outConfs[0].getMemDesc()->getShape().getRank())) {- THROW_CPU_NODE_ERR("doesn't support case when input and output shapes have different rank and dynamic.");+ CPU_NODE_THROW("doesn't support case when input and output shapes have different rank and dynamic.");}if (!isOptimized) {const auto& inShape = getInputShapeAtPort(0);@@ -214,15 +210,9 @@ void Reorder::prepareParams() {auto srcMemPtr = getSrcMemoryAtPort(0);auto dstMemPtr = getDstMemoryAtPort(0);- 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.");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined destination memory object.");+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "has undefined input memory object.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "does not have preferable primitive descriptor.");auto isSupportedDesc = [](const MemoryDesc& desc) {if (!desc.isDefined()) {@@ -276,15 +266,9 @@ void Reorder::prepareParams() {}}if (!canUseNcsp2Nspc && !canUseNspc2Ncsp) {- 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.");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined destination memory object.");+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "has undefined input memory object.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "does not have preferable primitive descriptor.");createReorderPrimitive(srcMemPtr->getDescWithType<DnnlMemoryDesc>(),dstMemPtr->getDescWithType<DnnlMemoryDesc>());@@ -293,9 +277,7 @@ void Reorder::prepareParams() {void Reorder::createReorderPrimitive(const DnnlMemoryDescPtr& srcDesc, const DnnlMemoryDescPtr& dstDesc) {auto* selectedPD = getSelectedPrimitiveDescriptor();- if (!selectedPD) {- THROW_CPU_NODE_ERR("does not have preferable primitive descriptor.");- }+ CPU_NODE_ASSERT(selectedPD, "does not have preferable primitive descriptor.");const auto engine = getEngine();auto src_desc = srcDesc->getDnnlDesc();@@ -463,7 +445,7 @@ void Reorder::execute(const dnnl::stream& strm) {if (prim) {prim.execute(strm, primArgs);} else {- THROW_CPU_NODE_ERR("doesn't have an initialized primitive.");+ CPU_NODE_THROW("doesn't have an initialized primitive.");}}}@@ -485,9 +467,8 @@ std::string Reorder::getReorderArgs(const MemoryDesc& parentDesc, const MemoryDe}void Reorder::reorderData(const IMemory& input, const IMemory& output, const MultiCachePtr& cache) {- if (!input.getDesc().isDefined() || !output.getDesc().isDefined()) {- OPENVINO_THROW("Can't reorder data with dynamic shapes");- }+ OPENVINO_ASSERT(input.getDesc().isDefined() && output.getDesc().isDefined(),+ "Can't reorder data with dynamic shapes");if (input.getShape().hasZeroDims() || output.getShape().hasZeroDims()) {return;@@ -551,12 +532,11 @@ void Reorder::reorderData(const IMemory& input, const IMemory& output, const MulsrcMemory = tmpMem.getPrimitive();reorder = getReorderPrim(cache, dstMemory.get_engine(), srcMemory.get_desc(), dstMemory.get_desc());}- if (!reorder) {- OPENVINO_THROW("No reorder available for the following tensor descriptors: ",- input.getDesc().serializeFormat(),- " and ",- output.getDesc().serializeFormat());- }+ OPENVINO_ASSERT(reorder,+ "No reorder available for the following tensor descriptors: ",+ input.getDesc().serializeFormat(),+ " and ",+ output.getDesc().serializeFormat());}if (reorder) {dnnl::stream loc_stream(engine, dnnl::stream::flags::in_order);diff --git a/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp b/src/plugins/intel_cpu/src/nodes/reorg_yolo.cppindex 44decafc647..c788438d385 100644--- a/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp+++ b/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp@@ -42,15 +42,12 @@ ReorgYolo::ReorgYolo(const std::shared_ptr<ov::Node>& op, const GraphContext::CPOPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (getOriginalInputsNumber() != 1 || getOriginalOutputsNumber() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(getOriginalInputsNumber() == 1 && getOriginalOutputsNumber() == 1,+ "has incorrect number of input/output edges!");const auto reorgYolo = ov::as_type_ptr<const ov::op::v0::ReorgYolo>(op);const auto strides = reorgYolo->get_strides();- if (strides.empty()) {- THROW_CPU_NODE_ERR("has empty strides");- }+ CPU_NODE_ASSERT(!strides.empty(), "has empty strides");stride = strides[0];}diff --git a/src/plugins/intel_cpu/src/nodes/reshape.cpp b/src/plugins/intel_cpu/src/nodes/reshape.cppindex 6b827f61ded..a8f1cc2e61c 100644--- a/src/plugins/intel_cpu/src/nodes/reshape.cpp+++ b/src/plugins/intel_cpu/src/nodes/reshape.cpp@@ -56,7 +56,7 @@ Reshape::Reshape(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr&auto checkSecondInput = [this](const std::shared_ptr<ov::Node>& op,[[maybe_unused]] const std::string& opType) {if (op->get_input_partial_shape(1).is_dynamic()) {- THROW_CPU_NODE_ERR("has non static second input");+ CPU_NODE_THROW("has non static second input");}};@@ -64,13 +64,13 @@ Reshape::Reshape(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr&checkSecondInput(op, "Reshape");} else if (ov::as_type_ptr<const ov::op::v0::Squeeze>(op)) {if (op->get_input_size() == 1) {- THROW_CPU_NODE_ERR("has inputs num equal 1");+ CPU_NODE_THROW("has inputs num equal 1");}checkSecondInput(op, "Squeeze");} else if (ov::as_type_ptr<const ov::op::v0::Unsqueeze>(op)) {checkSecondInput(op, "Unsqueeze");} else {- THROW_CPU_NODE_ERR("Unsupported operation type via reshape node");+ CPU_NODE_THROW("Unsupported operation type via reshape node");}}}@@ -94,10 +94,10 @@ bool Reshape::needShapeInfer() const {void Reshape::getSupportedDescriptors() {if (getParentEdges().size() != 1 && getParentEdges().size() != 2) {- THROW_CPU_NODE_ERR("Incorrect number of input edges");+ CPU_NODE_THROW("Incorrect number of input edges");}if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("Incorrect number of output edges");+ CPU_NODE_THROW("Incorrect number of output edges");}}diff --git a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cppindex 29015447e7e..a4dcd849437 100644--- a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp+++ b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp@@ -50,39 +50,27 @@ ReverseSequence::ReverseSequence(const std::shared_ptr<ov::Node>& op, const Grap}const auto revSeq = ov::as_type_ptr<const ov::op::v0::ReverseSequence>(op);- if (revSeq == nullptr) {- THROW_CPU_NODE_ERR("is not an instance of v0 ReverseSequence.");- }+ CPU_NODE_ASSERT(revSeq, "is not an instance of v0 ReverseSequence.");- if (inputShapes.size() != 2 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 2 && outputShapes.size() == 1, "has incorrect number of input/output edges!");const auto dataRank = getInputShapeAtPort(REVERSESEQUENCE_DATA).getRank();- if (dataRank < 2) {- THROW_CPU_NODE_ERR("'data' rank should be greater than or equal to 2");- }+ CPU_NODE_ASSERT(dataRank >= 2, "'data' rank should be greater than or equal to 2");- if (getInputShapeAtPort(REVERSESEQUENCE_LENGTHS).getRank() != 1) {- THROW_CPU_NODE_ERR("'seq_lengths' should be 1D tensor");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(REVERSESEQUENCE_LENGTHS).getRank() == 1, "'seq_lengths' should be 1D tensor");- if (dataRank != getOutputShapeAtPort(0).getRank()) {- THROW_CPU_NODE_ERR("has input/output rank mismatch");- }+ CPU_NODE_ASSERT(dataRank == getOutputShapeAtPort(0).getRank(), "has input/output rank mismatch");seq_axis = revSeq->get_sequence_axis();- if (seq_axis < 0 || seq_axis >= static_cast<int>(dataRank)) {- THROW_CPU_NODE_ERR("has incorrect 'seq_axis' parameters dimensions and axis number!");- }+ CPU_NODE_ASSERT(seq_axis >= 0 && seq_axis < static_cast<int>(dataRank),+ "has incorrect 'seq_axis' parameters dimensions and axis number!");batch_axis = revSeq->get_batch_axis();- if (batch_axis < 0 || batch_axis >= static_cast<int>(dataRank)) {- THROW_CPU_NODE_ERR("has incorrect 'batch_axis' parameters dimensions and axis number!");- }+ CPU_NODE_ASSERT(batch_axis >= 0 && batch_axis < static_cast<int>(dataRank),+ "has incorrect 'batch_axis' parameters dimensions and axis number!");}void ReverseSequence::initSupportedPrimitiveDescriptors() {@@ -105,18 +93,10 @@ void ReverseSequence::prepareParams() {const auto& seqLengthsMemPtr = getSrcMemoryAtPort(REVERSESEQUENCE_LENGTHS);const auto& dstMemPtr = getDstMemoryAtPort(0);- if (!dataMemPtr || !dataMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'data'");- }- if (!seqLengthsMemPtr || !seqLengthsMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'seq_lengths'");- }- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined output memory");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor");- }+ CPU_NODE_ASSERT(dataMemPtr && dataMemPtr->isDefined(), "has undefined input memory of 'data'");+ CPU_NODE_ASSERT(seqLengthsMemPtr && seqLengthsMemPtr->isDefined(), "has undefined input memory of 'seq_lengths'");+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined output memory");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor() != nullptr, "has unidentified preferable primitive descriptor");const VectorDims& dataDims = dataMemPtr->getStaticDims();const VectorDims& seqLengthsDims = seqLengthsMemPtr->getStaticDims();@@ -137,15 +117,10 @@ ReverseSequence::ReverseSequenceExecutor::ReverseSequenceExecutor(const VectorDi: batchAxis{batchAxis},seqAxis{seqAxis} {for (size_t i = 0; i < dataDims.size(); ++i) {- if (dataDims[i] != dstDims[i]) {- OPENVINO_THROW("Input/output tensors dimensions mismatch");- }- }-- if (seqLengthsDims[0] != dataDims[batchAxis]) {- OPENVINO_THROW("'seq_lengths' dimension mismatch");+ OPENVINO_ASSERT(dataDims[i] == dstDims[i], "Input/output tensors dimensions mismatch");}+ OPENVINO_ASSERT(seqLengthsDims[0] == dataDims[batchAxis], "'seq_lengths' dimension mismatch");srcStrides.resize(dataDims.size());srcStrides[srcStrides.size() - 1] = 1;for (int i = srcStrides.size() - 2; i >= 0; --i) {@@ -165,9 +140,8 @@ void ReverseSequence::ReverseSequenceExecutor::exec(const MemoryPtr& dataMemPtr,auto* seqLengthsData = seqLengthsMemPtr->getDataAs<T>();for (size_t i = 0; i < srcDims[batchAxis]; ++i) {- if (static_cast<int32_t>(seqLengthsData[i]) > static_cast<int>(srcDims[seqAxis])) {- OPENVINO_THROW("Incorrect input 'seq_lengths' values!");- }+ OPENVINO_ASSERT(static_cast<int32_t>(seqLengthsData[i]) <= static_cast<int>(srcDims[seqAxis]),+ "Incorrect input 'seq_lengths' values!");}parallel_nt(0, [&](const int ithr, const int nthr) {@@ -203,14 +177,13 @@ void ReverseSequence::ReverseSequenceExecutor::exec(const MemoryPtr& dataMemPtr,}void ReverseSequence::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("has no compiled executor");- }+ CPU_NODE_ASSERT(execPtr, "has no compiled executor");const auto precision = getParentEdgeAt(REVERSESEQUENCE_LENGTHS)->getMemory().getDesc().getPrecision();- if (!one_of(precision, ov::element::f32, ov::element::i32)) {- THROW_CPU_NODE_ERR("does not support ", precision, " precision");- }+ CPU_NODE_ASSERT(one_of(precision, ov::element::f32, ov::element::i32),+ "does not support ",+ precision,+ " precision");if (precision == ov::element::f32) {execPtr->exec<float>(getSrcMemoryAtPort(REVERSESEQUENCE_DATA),diff --git a/src/plugins/intel_cpu/src/nodes/rms_norm.cpp b/src/plugins/intel_cpu/src/nodes/rms_norm.cppindex 05d6acf09c6..8bf934387ed 100644--- a/src/plugins/intel_cpu/src/nodes/rms_norm.cpp+++ b/src/plugins/intel_cpu/src/nodes/rms_norm.cpp@@ -175,9 +175,7 @@ void RMSNorm::createPrimitive() {auto cache = context->getParamsCache();auto result = cache->getOrCreate(key, builder);- if (!result.first) {- OPENVINO_THROW("RMSNorm Executor creation fails with precision " + precision.to_string());- }+ OPENVINO_ASSERT(result.first, "RMSNorm Executor creation fails with precision " + precision.to_string());m_executor = result.first;}diff --git a/src/plugins/intel_cpu/src/nodes/rnn.cpp b/src/plugins/intel_cpu/src/nodes/rnn.cppindex 2419e56a331..cf5a39147d8 100644--- a/src/plugins/intel_cpu/src/nodes/rnn.cpp+++ b/src/plugins/intel_cpu/src/nodes/rnn.cpp@@ -434,9 +434,8 @@ public:Result infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,const std::unordered_map<size_t, MemoryPtr>& data_dependency) override {auto result = m_shape_infer->infer(input_shapes, data_dependency);- if (ShapeInferStatus::success != result.status) {- OPENVINO_THROW("Unexpected: Unexpected shape inference result status");- }+ OPENVINO_ASSERT(ShapeInferStatus::success == result.status,+ "Unexpected: Unexpected shape inference result status");auto& originOutputShapes = result.dims;@@ -539,9 +538,7 @@ RNN::RNN(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)}auto rnnCellBase = ov::as_type_ptr<ov::op::util::RNNCellBase>(op);- if (!rnnCellBase) {- THROW_CPU_NODE_ERR("does not have original layer for RNNCell.");- }+ CPU_NODE_ASSERT(rnnCellBase, "does not have original layer for RNNCell.");cell_type = ie2dnnl(op);if (!rnnCellBase->get_activations().empty()) {@@ -652,14 +649,14 @@ void RNN::getSupportedDescriptors() {void RNN::initCell() {if (getInputShapeAtPort(0).getRank() != 2LU || getInputShapeAtPort(1).getRank() != 2LU) {- THROW_CPU_NODE_ERR("has incorrect input ranks. Data rank: ",- getInputShapeAtPort(0).getRank(),- "; Hidden state rank: ",- getInputShapeAtPort(1).getRank());- }- if (is_augru && getInputShapeAtPort(5).getRank() != 2LU) {- THROW_CPU_NODE_ERR("has incorrect input ranks. Attention rank: ", getInputShapeAtPort(2).getRank());+ CPU_NODE_THROW("has incorrect input ranks. Data rank: ",+ getInputShapeAtPort(0).getRank(),+ "; Hidden state rank: ",+ getInputShapeAtPort(1).getRank());}+ CPU_NODE_ASSERT(!(is_augru && getInputShapeAtPort(5).getRank() != 2LU),+ "has incorrect input ranks. Attention rank: ",+ getInputShapeAtPort(2).getRank());T = {1, 1};if (cell_type == algorithm::vanilla_lstm) {@@ -677,29 +674,29 @@ void RNN::initCell() {if ((getInputShapeAtPort(0).isStatic() && getInputShapeAtPort(0) != shapeD) ||(getInputShapeAtPort(1).isStatic() && getInputShapeAtPort(1) != shapeS) ||(getOutputShapeAtPort(0).isStatic() && getOutputShapeAtPort(0) != shapeS)) {- THROW_CPU_NODE_ERR("has incorrect input/output shapes. Data shape: ",- getInputShapeAtPort(0).toString(),- "; Hidden state input: ",- getInputShapeAtPort(1).toString(),- "; Hidden state output: ",- getOutputShapeAtPort(0).toString());+ CPU_NODE_THROW("has incorrect input/output shapes. Data shape: ",+ getInputShapeAtPort(0).toString(),+ "; Hidden state input: ",+ getInputShapeAtPort(1).toString(),+ "; Hidden state output: ",+ getOutputShapeAtPort(0).toString());}if (S == 2) {if ((getInputShapeAtPort(2).isStatic() && getInputShapeAtPort(2) != shapeS) ||(getOutputShapeAtPort(1).isStatic() && getOutputShapeAtPort(1) != shapeS)) {- THROW_CPU_NODE_ERR("has incorrect input/output shapes. Cell state input: ",- getInputShapeAtPort(2).toString(),- "; Cell state output: ",- getOutputShapeAtPort(1).toString());+ CPU_NODE_THROW("has incorrect input/output shapes. Cell state input: ",+ getInputShapeAtPort(2).toString(),+ "; Cell state output: ",+ getOutputShapeAtPort(1).toString());}}if (is_augru) {const Shape shapeA{B, 1};- if (getInputShapeAtPort(5).isStatic() && getInputShapeAtPort(5) != shapeA) {- THROW_CPU_NODE_ERR("has incorrect input shapes. Attention shape: ", getInputShapeAtPort(5).toString());- }+ CPU_NODE_ASSERT(!(getInputShapeAtPort(5).isStatic() && getInputShapeAtPort(5) != shapeA),+ "has incorrect input shapes. Attention shape: ",+ getInputShapeAtPort(5).toString());}}}@@ -792,18 +789,18 @@ void RNN::initSequence() {const auto& outDataShape = getOutputShapeAtPort(0);if (inDataShape.getRank() != 3LU || outDataShape.getRank() != 4LU) {- THROW_CPU_NODE_ERR("has incorrect input/output shapes. Input data shape: ",- inDataShape.toString(),- " Output shape: ",- outDataShape.toString());+ CPU_NODE_THROW("has incorrect input/output shapes. Input data shape: ",+ inDataShape.toString(),+ " Output shape: ",+ outDataShape.toString());}- if (!one_of(getOriginalInputsNumber(), 6U, 7U)) {- THROW_CPU_NODE_ERR("has incorrect number of input ports: ", getOriginalInputsNumber());- }- if (!one_of(getOriginalOutputsNumber(), 2U, 3U)) {- THROW_CPU_NODE_ERR("has incorrect number of output ports: ", getOriginalOutputsNumber());- }+ CPU_NODE_ASSERT(one_of(getOriginalInputsNumber(), 6U, 7U),+ "has incorrect number of input ports: ",+ getOriginalInputsNumber());+ CPU_NODE_ASSERT(one_of(getOriginalOutputsNumber(), 2U, 3U),+ "has incorrect number of output ports: ",+ getOriginalOutputsNumber());T = {inDataShape.getMinDims()[1], inDataShape.getMaxDims()[1]};if (cell_type == algorithm::vanilla_lstm) {@@ -923,13 +920,9 @@ void RNN::fillSequenceDesc() {template <element::Type_t ET>void RNN::fillWeights() {using DataType = typename element_type_traits<ET>::value_type;- if (getParentEdgeAt(wIdx)->getParent()->getType() != Type::Input) {- THROW_CPU_NODE_ERR("expects Constant for port ", wIdx);- }+ CPU_NODE_ASSERT(getParentEdgeAt(wIdx)->getParent()->getType() == Type::Input, "expects Constant for port ", wIdx);auto w_const_blob = static_cast<Input*>(getParentEdgeAt(wIdx)->getParent().get())->getMemoryPtr();- if (getParentEdgeAt(rIdx)->getParent()->getType() != Type::Input) {- THROW_CPU_NODE_ERR("expects Constant for port ", rIdx);- }+ CPU_NODE_ASSERT(getParentEdgeAt(rIdx)->getParent()->getType() == Type::Input, "expects Constant for port ", rIdx);auto r_const_blob = static_cast<Input*>(getParentEdgeAt(rIdx)->getParent().get())->getMemoryPtr();const auto& weightPrec = DnnlExtensionUtils::DataTypeToElementType(inDataTypes[wIdx]);@@ -943,9 +936,7 @@ void RNN::fillWeights() {auto create_w = [&]() {MemoryPtr w_data_mem = std::make_shared<Memory>(getEngine(), w_data_desc);auto w_ptr = reinterpret_cast<DataType*>(w_data_mem->getData());- if (w_ptr == nullptr) {- THROW_CPU_NODE_ERR("has unallocated internal blob.");- }+ CPU_NODE_ASSERT(w_ptr, "has unallocated internal blob.");std::vector<DataType> ie_w_vec;DataType* ie_w_ptr = nullptr;@@ -981,9 +972,7 @@ void RNN::fillWeights() {auto create_r = [&]() {MemoryPtr w_state_mem = std::make_shared<Memory>(getEngine(), w_state_desc);auto r_ptr = reinterpret_cast<DataType*>(w_state_mem->getData());- if (r_ptr == nullptr) {- THROW_CPU_NODE_ERR("has unallocated internal blob.");- }+ CPU_NODE_ASSERT(r_ptr, "has unallocated internal blob.");std::vector<DataType> ie_r_vec;DataType* ie_r_ptr = nullptr;@@ -1032,14 +1021,12 @@ template <element::Type_t ET>void RNN::fillBiases() {using DataType = typename element_type_traits<ET>::value_type;- if (getParentEdgeAt(bIdx)->getParent()->getType() != Type::Input) {- THROW_CPU_NODE_ERR("expects Constant for port ", bIdx);- }+ CPU_NODE_ASSERT(getParentEdgeAt(bIdx)->getParent()->getType() == Type::Input, "expects Constant for port ", bIdx);auto b_const_blob = static_cast<Input*>(getParentEdgeAt(bIdx)->getParent().get())->getMemoryPtr();if (inDataTypes[bIdx] != memory::data_type::f32) {- THROW_CPU_NODE_ERR("doesn't support bias data type: ",- DnnlExtensionUtils::DataTypeToElementType(inDataTypes[bIdx]));+ CPU_NODE_THROW("doesn't support bias data type: ",+ DnnlExtensionUtils::DataTypeToElementType(inDataTypes[bIdx]));}VectorDims dims_b = {L, D, Gb, SC};@@ -1051,9 +1038,7 @@ void RNN::fillBiases() {auto create = [&]() {MemoryPtr w_bias_data_mem = std::make_shared<Memory>(getEngine(), w_bias_data_desc);auto b_ptr = reinterpret_cast<DataType*>(w_bias_data_mem->getData());- if (b_ptr == nullptr) {- THROW_CPU_NODE_ERR("has unallocated internal blob.");- }+ CPU_NODE_ASSERT(b_ptr, "has unallocated internal blob.");std::vector<DataType> ie_b_vec;DataType* ie_b_ptr = nullptr;@@ -1093,9 +1078,7 @@ void RNN::fillBiases() {}void RNN::prepareMemory(const DnnlMemoryDescPtr& new_desc, size_t idx) {- if (idx >= 3LU) {- THROW_CPU_NODE_ERR("got invalid weights index: ", idx);- }+ CPU_NODE_ASSERT(idx < 3LU, "got invalid weights index: ", idx);auto create = [&]() {Memory memory{getEngine(), m_initial_weights[idx]->getDescPtr(), m_initial_weights[idx]->getData()};@@ -1146,29 +1129,19 @@ void RNN::copyWeightsData() {const uint64_t gate_map_rnn_size = sizeof(gate_map_rnn) / sizeof(uint64_t);if (cell_type == dnnl::algorithm::vanilla_lstm) {m_gate_map = gate_map_lstm;- if (G > gate_map_lstm_size) {- THROW_CPU_NODE_ERR(". G isn't equal to the size of gate_map.");- }+ CPU_NODE_ASSERT(G <= gate_map_lstm_size, ". G isn't equal to the size of gate_map.");} else if (cell_type == dnnl::algorithm::vanilla_gru || cell_type == dnnl::algorithm::vanilla_augru) {m_gate_map = gate_map_gru;- if (G > gate_map_gru_size) {- THROW_CPU_NODE_ERR(". G isn't equal to the size of gate_map");- }+ CPU_NODE_ASSERT(G <= gate_map_gru_size, ". G isn't equal to the size of gate_map");} else if (cell_type == dnnl::algorithm::lbr_gru || cell_type == dnnl::algorithm::lbr_augru) {m_gate_map = gate_map_gru;- if (G > gate_map_gru_size) {- THROW_CPU_NODE_ERR(". G isn't equal to the size of gate_map.");- }+ CPU_NODE_ASSERT(G <= gate_map_gru_size, ". G isn't equal to the size of gate_map.");} else if (cell_type == dnnl::algorithm::vanilla_rnn) {m_gate_map = gate_map_rnn;- if (G > gate_map_rnn_size) {- THROW_CPU_NODE_ERR(". G isn't equal to the size of gate_map.");- }+ CPU_NODE_ASSERT(G <= gate_map_rnn_size, ". G isn't equal to the size of gate_map.");} else {m_gate_map = gate_map_gru;- if (G > gate_map_gru_size) {- THROW_CPU_NODE_ERR(". G isn't equal to the size of gate_map.");- }+ CPU_NODE_ASSERT(G <= gate_map_gru_size, ". G isn't equal to the size of gate_map.");}switch (inDataTypes[xIdx]) {@@ -1184,7 +1157,7 @@ void RNN::copyWeightsData() {fillWeights<element::i8>();break;default:- THROW_CPU_NODE_ERR("has unsupported data type: ", DnnlExtensionUtils::DataTypeToElementType(inDataTypes[xIdx]));+ CPU_NODE_THROW("has unsupported data type: ", DnnlExtensionUtils::DataTypeToElementType(inDataTypes[xIdx]));}fillBiases<element::f32>();@@ -1377,13 +1350,11 @@ Node::AttrPtr RNN::initPrimitiveAttr() {void RNN::prepareParams() {for (size_t i = 0; i < wIdx; i++) {auto memPtr = getSrcMemoryAtPort(i);- if (!memPtr || !memPtr->isDefined()) {- THROW_CPU_NODE_ERR("has uninitialized memory at port ", i);- }+ CPU_NODE_ASSERT(memPtr && memPtr->isDefined(), "has uninitialized memory at port ", i);}if ((is_cell && DC != getParentEdgeAt(0)->getMemory().getDesc().getShape().getStaticDims()[1]) ||(!is_cell && DC != getParentEdgeAt(0)->getMemory().getDesc().getShape().getStaticDims()[2])) {- THROW_CPU_NODE_ERR("has incorrect input size value in the first input.");+ CPU_NODE_THROW("has incorrect input size value in the first input.");}auto dataMemPtr = getSrcMemoryAtPort(0);@@ -1431,9 +1402,7 @@ void RNN::prepareParams() {auto prevExecPtr = execPtr;execPtr = result.first;- if (!execPtr) {- THROW_CPU_NODE_ERR("does not have primitive descriptor.");- }+ CPU_NODE_ASSERT(execPtr, "does not have primitive descriptor.");#ifdef CPU_DEBUG_CAPSconst auto* pd = execPtr->getPrimitiveDesc();@@ -1475,9 +1444,7 @@ std::shared_ptr<MemoryDesc> RNN::getDstMemDesc([[maybe_unused]] const dnnl::prim}void RNN::execute(const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("does not have initialized primitive to execute.");- }+ CPU_NODE_ASSERT(execPtr, "does not have initialized primitive to execute.");const auto src_data_mem = getSrcMemoryAtPort(0);const auto dst_data_mem = getDstMemoryAtPort(0);diff --git a/src/plugins/intel_cpu/src/nodes/roi_align.cpp b/src/plugins/intel_cpu/src/nodes/roi_align.cppindex 4da48c79d3c..916cd2b2176 100644--- a/src/plugins/intel_cpu/src/nodes/roi_align.cpp+++ b/src/plugins/intel_cpu/src/nodes/roi_align.cpp@@ -640,9 +640,8 @@ private:// gather bf16 data from reg_src with vmm_idx(data_size) to vmm_src with f32 precision// bf16 is needed from avx512_corevoid gather_bf16_to_f32_zmm(Vmm vmm_src, const reg64_t reg_src, const Vmm vmm_idx) {- if (!std::is_same<Vmm, Xbyak::Zmm>::value) {- OPENVINO_THROW("bf16 is only supported from avx512_core platform for ROIAlign node.");- }+ OPENVINO_ASSERT((std::is_same<Vmm, Xbyak::Zmm>::value),+ "bf16 is only supported from avx512_core platform for ROIAlign node.");sub(rsp, v_len);uni_vmovdqu(ptr[rsp], vmm_idx);for (int i = 0; i < v_step; i++) {@@ -759,42 +758,40 @@ ROIAlign::ROIAlign(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr}void ROIAlign::getSupportedDescriptors() {- if (getParentEdges().size() != 3) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getParentEdges().size());- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getChildEdges().size());- }+ CPU_NODE_ASSERT(getParentEdges().size() == 3, "has incorrect number of input edges: ", getParentEdges().size());+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges: ", getChildEdges().size());- if (getInputShapeAtPort(0).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support 0th input with rank: ", getInputShapeAtPort(0).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(0).getRank() == 4,+ "doesn't support 0th input with rank: ",+ getInputShapeAtPort(0).getRank());- if (getInputShapeAtPort(1).getRank() != 2) {- THROW_CPU_NODE_ERR("doesn't support 1st input with rank: ", getInputShapeAtPort(1).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(1).getRank() == 2,+ "doesn't support 1st input with rank: ",+ getInputShapeAtPort(1).getRank());- if (getInputShapeAtPort(2).getRank() != 1) {- THROW_CPU_NODE_ERR("doesn't support 2nd input with rank: ", getInputShapeAtPort(2).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(2).getRank() == 1,+ "doesn't support 2nd input with rank: ",+ getInputShapeAtPort(2).getRank());- if (getOutputShapeAtPort(0).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support output with rank: ", getOutputShapeAtPort(0).getRank());- }+ CPU_NODE_ASSERT(getOutputShapeAtPort(0).getRank() == 4,+ "doesn't support output with rank: ",+ getOutputShapeAtPort(0).getRank());const auto& proposalsDims = getInputShapeAtPort(1).getDims();- if (proposalsDims[1] != 4) {- THROW_CPU_NODE_ERR("has invalid shape on 1st input: [", proposalsDims[0], ",", proposalsDims[1], "]");- }+ CPU_NODE_ASSERT(proposalsDims[1] == 4,+ "has invalid shape on 1st input: [",+ proposalsDims[0],+ ",",+ proposalsDims[1],+ "]");const auto& indexesDims = getInputShapeAtPort(2).getDims();- if (!dimsEqualWeak(proposalsDims[0], indexesDims[0])) {- THROW_CPU_NODE_ERR("has different sizes of inputs for proposals (",- proposalsDims[0],- ") and indexes (",- indexesDims[0],- ")");- }+ CPU_NODE_ASSERT(dimsEqualWeak(proposalsDims[0], indexesDims[0]),+ "has different sizes of inputs for proposals (",+ proposalsDims[0],+ ") and indexes (",+ indexesDims[0],+ ")");}void ROIAlign::createJitKernel(const ov::element::Type& dataPrec, const ROIAlignLayoutType& selectLayout) {@@ -874,12 +871,8 @@ void ROIAlign::initSupportedPrimitiveDescriptors() {void ROIAlign::createPrimitive() {auto srcMemPtr = getSrcMemoryAtPort(0);auto dstMemPtr = getDstMemoryAtPort(0);- if (!srcMemPtr) {- THROW_CPU_NODE_ERR("has null input memory");- }- if (!dstMemPtr) {- THROW_CPU_NODE_ERR("has null destination memory");- }+ CPU_NODE_ASSERT(srcMemPtr, "has null input memory");+ CPU_NODE_ASSERT(dstMemPtr, "has null destination memory");if (!roi_align_kernel) {ROIAlignLayoutType selectedLayout = ROIAlignLayoutType::nspc;@@ -912,9 +905,9 @@ struct ROIAlign::ROIAlignExecute {void ROIAlign::execute([[maybe_unused]] const dnnl::stream& strm) {auto inputPrec = getParentEdgeAt(0)->getMemory().getDataType();auto outputPrec = getChildEdgeAt(0)->getMemory().getDataType();- if (!((inputPrec == dnnl_bf16 && outputPrec == dnnl_bf16) || (inputPrec == dnnl_f32 && outputPrec == dnnl_f32))) {- THROW_CPU_NODE_ERR("doesn't support demanded precisions");- }+ CPU_NODE_ASSERT(+ ((inputPrec == dnnl_bf16 && outputPrec == dnnl_bf16) || (inputPrec == dnnl_f32 && outputPrec == dnnl_f32)),+ "doesn't support demanded precisions");ROIAlignContext ctx = {*this};@@ -1003,11 +996,11 @@ void ROIAlign::executeSpecified() {int roiOff = n * 4;const float* srcRoiPtr = &srcRoi[roiOff];int roiBatchInd = srcRoiIdx[n];- if (roiBatchInd < -1) { // -1 means switched off region- THROW_CPU_NODE_ERR("Batch index cannot be less, than -1");- } else if (static_cast<size_t>(roiBatchInd) >= inputDimVector[0]) {- THROW_CPU_NODE_ERR("Demanded batch (id = ", roiBatchInd, ") doesn't exist");- }+ CPU_NODE_ASSERT(roiBatchInd >= -1, "Batch index cannot be less, than -1");+ CPU_NODE_ASSERT(static_cast<size_t>(roiBatchInd) < inputDimVector[0],+ "Demanded batch (id = ",+ roiBatchInd,+ ") doesn't exist");float x1 = (srcRoiPtr[0] + offset_src) * spatialScale + offset_dst;float y1 = (srcRoiPtr[1] + offset_src) * spatialScale + offset_dst;@@ -1132,9 +1125,7 @@ void ROIAlign::executeSpecified() {}});- if (realRois == 0) {- THROW_CPU_NODE_ERR("realRois must be greater than 0");- }+ CPU_NODE_ASSERT(realRois > 0, "realRois must be greater than 0");if (roi_align_kernel) {if (!isPlainFmt) {diff --git a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cppindex cb9ebf1af77..5069098a959 100644--- a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp+++ b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp@@ -113,7 +113,7 @@ void ROIAlignRotated::execute([[maybe_unused]] const dnnl::stream& strm) {CASE(f32);CASE(f64);default:- THROW_CPU_NODE_ERR("Unhandled data type ", type, " in execute()");+ CPU_NODE_THROW("Unhandled data type ", type, " in execute()");}#undef CASE}diff --git a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/roi_pooling.cppindex 59c3f45b89e..d96af34781d 100644--- a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp+++ b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp@@ -442,29 +442,23 @@ ROIPooling::ROIPooling(const std::shared_ptr<ov::Node>& op, const GraphContext::}void ROIPooling::getSupportedDescriptors() {- if (getParentEdges().size() != 2) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getParentEdges().size());- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getChildEdges().size());- }+ CPU_NODE_ASSERT(getParentEdges().size() == 2, "has incorrect number of input edges: ", getParentEdges().size());+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges: ", getChildEdges().size());- if (getInputShapeAtPort(0).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support 0th input with rank: ", getInputShapeAtPort(0).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(0).getRank() == 4,+ "doesn't support 0th input with rank: ",+ getInputShapeAtPort(0).getRank());- if (getInputShapeAtPort(1).getRank() != 2) {- THROW_CPU_NODE_ERR("doesn't support 1st input with rank: ", getInputShapeAtPort(1).getRank());- }+ CPU_NODE_ASSERT(getInputShapeAtPort(1).getRank() == 2,+ "doesn't support 1st input with rank: ",+ getInputShapeAtPort(1).getRank());- if (getOutputShapeAtPort(0).getRank() != 4) {- THROW_CPU_NODE_ERR("doesn't support output with rank: ", getOutputShapeAtPort(0).getRank());- }+ CPU_NODE_ASSERT(getOutputShapeAtPort(0).getRank() == 4,+ "doesn't support output with rank: ",+ getOutputShapeAtPort(0).getRank());const auto& dims = getInputShapeAtPort(1).getDims();- if (dims[1] != 5) {- THROW_CPU_NODE_ERR("has invalid shape on 1st input: [", dims[0], ",", dims[1], "]");- }+ CPU_NODE_ASSERT(dims[1] == 5, "has invalid shape on 1st input: [", dims[0], ",", dims[1], "]");}void ROIPooling::initSupportedPrimitiveDescriptors() {@@ -505,9 +499,7 @@ void ROIPooling::initSupportedPrimitiveDescriptors() {void ROIPooling::createPrimitive() {auto* selectedPD = getSelectedPrimitiveDescriptor();- if (!selectedPD) {- THROW_CPU_NODE_ERR("doesn't have primitive descriptors.");- }+ CPU_NODE_ASSERT(selectedPD, "doesn't have primitive descriptors.");refParams.c_block = mayiuse(cpu::x64::avx512_core) ? 16 : 8;;@@ -533,7 +525,7 @@ void ROIPooling::execute([[maybe_unused]] const dnnl::stream& strm) {const auto& dstMemory = getChildEdgeAt(0)->getMemory();execPtr->exec(srcMemory0, srcMemory1, dstMemory);} else {- THROW_CPU_NODE_ERR("Primitive wasn't created");+ CPU_NODE_THROW("Primitive wasn't created");}}@@ -545,18 +537,10 @@ void ROIPooling::prepareParams() {const auto& srcMemPtr0 = getSrcMemoryAtPort(0);const auto& srcMemPtr1 = getSrcMemoryAtPort(0);const auto& dstMemPtr = getDstMemoryAtPort(0);- if (!srcMemPtr0 || !srcMemPtr0->isDefined()) {- THROW_CPU_NODE_ERR("Input memory is undefined.");- }- if (!srcMemPtr1 || !srcMemPtr1->isDefined()) {- THROW_CPU_NODE_ERR("Input memory is undefined.");- }- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("Destination is undefined.");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(srcMemPtr0 && srcMemPtr0->isDefined(), "Input memory is undefined.");+ CPU_NODE_ASSERT(srcMemPtr1 && srcMemPtr1->isDefined(), "Input memory is undefined.");+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "Destination is undefined.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "Preferable primitive descriptor is not set.");const auto& inDims = getParentEdgeAt(0)->getMemory().getStaticDims();const auto& outDims = getChildEdgeAt(0)->getMemory().getStaticDims();@@ -600,10 +584,7 @@ public:}void exec(const IMemory& srcData, const IMemory& srcRoi, const IMemory& dst) override {- if (!roi_pooling_kernel) {- OPENVINO_THROW("Could not execute. Kernel for RoiPooling node was not compiled.");- }-+ OPENVINO_ASSERT(roi_pooling_kernel, "Could not execute. Kernel for RoiPooling node was not compiled.");auto src_strides = srcData.getDescWithType<BlockedMemoryDesc>()->getStrides();auto src_roi_step = srcRoi.getDescWithType<BlockedMemoryDesc>()->getStrides()[0];auto dst_strides = dst.getDescWithType<BlockedMemoryDesc>()->getStrides();diff --git a/src/plugins/intel_cpu/src/nodes/roll.cpp b/src/plugins/intel_cpu/src/nodes/roll.cppindex a4f3fc38538..67b02489767 100644--- a/src/plugins/intel_cpu/src/nodes/roll.cpp+++ b/src/plugins/intel_cpu/src/nodes/roll.cpp@@ -55,47 +55,38 @@ Roll::Roll(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contex: Node(op, context, NgraphShapeInferFactory(op)) {std::string errorMessage;if (isSupportedOperation(op, errorMessage)) {- if (inputShapes.size() != 3 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 3 && outputShapes.size() == 1,+ "has incorrect number of input/output edges!");const auto& dataPrecision = getOriginalInputPrecisionAtPort(DATA_INDEX);if (std::find(supportedPrecisionSizes.begin(), supportedPrecisionSizes.end(), dataPrecision.size()) ==supportedPrecisionSizes.end()) {- THROW_CPU_NODE_ERR("as unsupported precision: ", dataPrecision.get_type_name());+ CPU_NODE_THROW("as unsupported precision: ", dataPrecision.get_type_name());}const auto dataRank = getInputShapeAtPort(DATA_INDEX).getRank();- if (dataRank < 1) {- THROW_CPU_NODE_ERR("doesn't support 'data' input tensor with rank: ", dataRank);- }+ CPU_NODE_ASSERT(dataRank >= 1, "doesn't support 'data' input tensor with rank: ", dataRank);- if (dataRank != getOutputShapeAtPort(0).getRank()) {- THROW_CPU_NODE_ERR("has input/output rank mismatch");- }+ CPU_NODE_ASSERT(dataRank == getOutputShapeAtPort(0).getRank(), "has input/output rank mismatch");/* Axes */const auto& axesTensorPrec = getOriginalInputPrecisionAtPort(AXES_INDEX);if (axesTensorPrec != ov::element::i32 && axesTensorPrec != ov::element::i64) {- THROW_CPU_NODE_ERR("has unsupported 'axes' input precision: ", axesTensorPrec.get_type_name());+ CPU_NODE_THROW("has unsupported 'axes' input precision: ", axesTensorPrec.get_type_name());}const auto axesTensorRank = getInputShapeAtPort(AXES_INDEX).getRank();- if (axesTensorRank > 1) {- THROW_CPU_NODE_ERR("doesn't support 'axes' input tensor with rank: ", axesTensorRank);- }+ CPU_NODE_ASSERT(axesTensorRank <= 1, "doesn't support 'axes' input tensor with rank: ", axesTensorRank);/* Shift */const auto& shiftTensorPrec = getOriginalInputPrecisionAtPort(SHIFT_INDEX);if (shiftTensorPrec != ov::element::i32 && shiftTensorPrec != ov::element::i64) {- THROW_CPU_NODE_ERR("has unsupported 'shift' input precision: ", shiftTensorPrec.get_type_name());+ CPU_NODE_THROW("has unsupported 'shift' input precision: ", shiftTensorPrec.get_type_name());}const auto shiftTensorRank = getInputShapeAtPort(SHIFT_INDEX).getRank();- if (shiftTensorRank > 1) {- THROW_CPU_NODE_ERR("doesn't support 'shift' input tensor with rank: ", shiftTensorRank);- }+ CPU_NODE_ASSERT(shiftTensorRank <= 1, "doesn't support 'shift' input tensor with rank: ", shiftTensorRank);} else {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}@@ -122,21 +113,11 @@ void Roll::prepareParams() {const auto& axesMemPtr = getSrcMemoryAtPort(AXES_INDEX);const auto& dstMemPtr = getDstMemoryAtPort(0);- if (!dataMemPtr || !dataMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'data'");- }- if (!shiftMemPtr || !shiftMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'shift'");- }- if (!axesMemPtr || !axesMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory of 'axes'");- }- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined output memory");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor");- }+ CPU_NODE_ASSERT(dataMemPtr && dataMemPtr->isDefined(), "has undefined input memory of 'data'");+ CPU_NODE_ASSERT(shiftMemPtr && shiftMemPtr->isDefined(), "has undefined input memory of 'shift'");+ CPU_NODE_ASSERT(axesMemPtr && axesMemPtr->isDefined(), "has undefined input memory of 'axes'");+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined output memory");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "has unidentified preferable primitive descriptor");const VectorDims& dataDims = dataMemPtr->getStaticDims();const VectorDims& shiftDims = shiftMemPtr->getStaticDims();@@ -151,9 +132,7 @@ void Roll::executeDynamicImpl(const dnnl::stream& strm) {}void Roll::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("has no compiled executor");- }+ CPU_NODE_ASSERT(execPtr, "has no compiled executor");const auto dataPrecision = getParentEdgeAt(DATA_INDEX)->getMemory().getDesc().getPrecision();const auto& dataTypeSize = dataPrecision.size();@@ -180,7 +159,7 @@ void Roll::execute([[maybe_unused]] const dnnl::stream& strm) {break;}default:- THROW_CPU_NODE_ERR("as unsupported 'data' input precision: ", dataPrecision.get_type_name());+ CPU_NODE_THROW("as unsupported 'data' input precision: ", dataPrecision.get_type_name());}}@@ -193,14 +172,10 @@ Roll::RollExecutor::RollExecutor(const VectorDims& dataDims,numOfIterations{std::accumulate(dataDims.cbegin(), dataDims.cend(), 1UL, std::multiplies<>()) / blockSize},axesLength{axesDims[0]} {for (size_t i = 0; i < dataDims.size(); ++i) {- if (dataDims[i] != dstDims[i]) {- OPENVINO_THROW("Input/output tensors dimensions mismatch");- }+ OPENVINO_ASSERT(dataDims[i] == dstDims[i], "Input/output tensors dimensions mismatch");}- if (shiftDims[0] != axesDims[0]) {- OPENVINO_THROW("'shift' and 'axes' dimensions mismatch");- }+ OPENVINO_ASSERT(shiftDims[0] == axesDims[0], "'shift' and 'axes' dimensions mismatch");}template <typename T>diff --git a/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp b/src/plugins/intel_cpu/src/nodes/scaled_attn.cppindex ec2b0126de7..414242180cd 100644--- a/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp+++ b/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp@@ -324,9 +324,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_ONEDNN, T> {auto cache = this->context->getParamsCache();auto qk_result = cache->getOrCreate(qk_key, builder);- if (!qk_result.first) {- OPENVINO_THROW("ScaledDotProductAttention 1st token qk gemm creation fails");- }+ OPENVINO_ASSERT(qk_result.first, "ScaledDotProductAttention 1st token qk gemm creation fails");qk_gemm_ptr = qk_result.first;if (has_out_transpose) {@@ -349,9 +347,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_ONEDNN, T> {in_type};auto wv_result = cache->getOrCreate(wv_key, builder);- if (!wv_result.first) {- OPENVINO_THROW("ScaledDotProductAttention 1st token wv gemm creation fails");- }+ OPENVINO_ASSERT(wv_result.first, "ScaledDotProductAttention 1st token wv gemm creation fails");wv_gemm_ptr = wv_result.first;@@ -760,9 +756,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_MLAS, float> {auto bhb_loop = [&](size_t b, size_t h, size_t m_blk) {auto thread_id = parallel_get_thread_num();- if (thread_id < 0) {- OPENVINO_THROW("The calling thread isn't initialized!");- }+ OPENVINO_ASSERT(thread_id >= 0, "The calling thread isn't initialized!");auto& qk_buf = qk_buffers[thread_id];auto m_start = m_blk * m_block_size;@@ -1239,9 +1233,7 @@ void ScaledDotProductAttention::initSupportedPrimitiveDescriptors() {void ScaledDotProductAttention::createPrimitive() {if (m_config.config.fuse_concat) {auto* desc = getSelectedPrimitiveDescriptor();- if (desc == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor");- }+ CPU_NODE_ASSERT(desc, "has unidentified preferable primitive descriptor");}auto rtPrecision = getRuntimePrecision();const auto keyDims = getInputShapeAtPort(1).getDims();@@ -1258,16 +1250,13 @@ void ScaledDotProductAttention::createPrimitive() {m_key_quant_param.isByChannel = false;}m_value_quant_param.groupSize = cpuConfig.valueCacheGroupSize ? cpuConfig.valueCacheGroupSize : valueS;- if (keyS % m_key_quant_param.groupSize != 0) {- OPENVINO_THROW("ScaledDotProductAttention AttentionExecutor creation fails key state " + std::to_string(keyS) +- " cannot be divided by group size " + std::to_string(m_key_quant_param.groupSize));- }+ OPENVINO_ASSERT(keyS % m_key_quant_param.groupSize == 0,+ "ScaledDotProductAttention AttentionExecutor creation fails key state " + std::to_string(keyS) ++ " cannot be divided by group size " + std::to_string(m_key_quant_param.groupSize));- if (valueS % m_value_quant_param.groupSize != 0) {- OPENVINO_THROW("ScaledDotProductAttention AttentionExecutor creation fails value state " +- std::to_string(keyS) + " cannot be divided by group size " +- std::to_string(m_key_quant_param.groupSize));- }+ OPENVINO_ASSERT(valueS % m_value_quant_param.groupSize == 0,+ "ScaledDotProductAttention AttentionExecutor creation fails value state " + std::to_string(keyS) ++ " cannot be divided by group size " + std::to_string(m_key_quant_param.groupSize));ScaledDotProductAttentionKey key = {rtPrecision};auto builder = [&]([[maybe_unused]] const ScaledDotProductAttentionKey& key) -> std::shared_ptr<Executor> {@@ -1340,9 +1329,7 @@ void ScaledDotProductAttention::createPrimitive() {auto cache = context->getParamsCache();auto result = cache->getOrCreate(key, builder);- if (!result.first) {- THROW_CPU_NODE_ERR("AttentionExecutor creation fails with precision " + rtPrecision.to_string());- }+ CPU_NODE_ASSERT(result.first, "AttentionExecutor creation fails with precision " + rtPrecision.to_string());m_executor = result.first;}@@ -1434,12 +1421,12 @@ void ScaledDotProductAttention::assignState(const std::shared_ptr<VariableStateK} else if (inputNumber - 1 == static_cast<size_t>(idx)) {m_v_state = state;} else {- THROW_CPU_NODE_ERR("Unexpected idx ",- idx,- " for a state in a node with type: ",- getTypeStr(),- " and name ",- getName());+ CPU_NODE_THROW("Unexpected idx ",+ idx,+ " for a state in a node with type: ",+ getTypeStr(),+ " and name ",+ getName());}}@@ -1836,9 +1823,9 @@ void ScaledDotProductAttention::updateBeamTable(const MemoryPtr& mem_beam_idx, sno_reorder = false;}}- if (!no_reorder && m_key_quant_param.isByChannel) {- OPENVINO_THROW(this->getName(), " SDPA only support bychannel quantization with greedy search!");- }+ OPENVINO_ASSERT(no_reorder || !m_key_quant_param.isByChannel,+ this->getName(),+ " SDPA only support bychannel quantization with greedy search!");// reorderif (!no_reorder) {auto* table = beam_idx.ptr<int32_t>();diff --git a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp b/src/plugins/intel_cpu/src/nodes/scatter_update.cppindex bcc7c6cb036..5ff7e1f51e2 100644--- a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp+++ b/src/plugins/intel_cpu/src/nodes/scatter_update.cpp@@ -127,11 +127,9 @@ ScatterUpdate::ScatterUpdate(const std::shared_ptr<ov::Node>& op, const GraphConaxisRelaxed = false;isUpdateScalar = ov::is_scalar(op->get_input_partial_shape(2));} else {- THROW_CPU_NODE_ERR("is not supported");- }- if (is_not_supported_input) {- THROW_CPU_NODE_ERR("do not support scalar input");+ CPU_NODE_THROW("is not supported");}+ CPU_NODE_ASSERT(!is_not_supported_input, "do not support scalar input");reduction_type = ScatterUpdate::Reduction::NONE;if (const auto node_element = ov::as_type_ptr<const ov::op::v12::ScatterElementsUpdate>(op)) {@@ -156,8 +154,8 @@ ScatterUpdate::ScatterUpdate(const std::shared_ptr<ov::Node>& op, const GraphConreduction_type = ScatterUpdate::Reduction::NONE;break;default:- THROW_CPU_NODE_ERR("ScatterElementsUpdate CPU does not support reduction mode: ",- ov::as_string(node_element->get_reduction()));+ CPU_NODE_THROW("ScatterElementsUpdate CPU does not support reduction mode: ",+ ov::as_string(node_element->get_reduction()));}use_init_val = node_element->get_use_init_val();} else if (const auto node_element = ov::as_type_ptr<const ov::op::v15::ScatterNDUpdate>(op)) {@@ -182,19 +180,16 @@ ScatterUpdate::ScatterUpdate(const std::shared_ptr<ov::Node>& op, const GraphConreduction_type = ScatterUpdate::Reduction::NONE;break;default:- THROW_CPU_NODE_ERR("ScatterNDUpdate CPU does not support reduction mode: ",- ov::as_string(node_element->get_reduction()));+ CPU_NODE_THROW("ScatterNDUpdate CPU does not support reduction mode: ",+ ov::as_string(node_element->get_reduction()));}}}void ScatterUpdate::getSupportedDescriptors() {- if ((getParentEdges().size() != 3) && (getParentEdges().size() != 4)) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }+ CPU_NODE_ASSERT((getParentEdges().size() == 3) || (getParentEdges().size() == 4),+ "has incorrect number of input edges");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges");}void ScatterUpdate::initSupportedPrimitiveDescriptors() {@@ -213,36 +208,30 @@ void ScatterUpdate::initSupportedPrimitiveDescriptors() {size_t dstRank = dstDataDim.size();// common check- if (srcRank != dstRank) {- THROW_CPU_NODE_ERR("should have same rank for input and output tensor");- } else {- for (size_t r = 0; r < srcRank; r++) {- if (!dimsEqualWeak(srcDataDim[r], dstDataDim[r])) {- THROW_CPU_NODE_ERR("should have same shape for input and output tensor. The input shape is ",- srcDataDim[r],- ", while output shape is ",- dstDataDim[r],- " for ",- r,- "th dimension");- }- }+ CPU_NODE_ASSERT(srcRank == dstRank, "should have same rank for input and output tensor");+ for (size_t r = 0; r < srcRank; r++) {+ CPU_NODE_ASSERT(dimsEqualWeak(srcDataDim[r], dstDataDim[r]),+ "should have same shape for input and output tensor. The input shape is ",+ srcDataDim[r],+ ", while output shape is ",+ dstDataDim[r],+ " for ",+ r,+ "th dimension");}// specific checkswitch (scatterUpdateMode) {case ScatterUpdateMode::ScatterUpdate: {- if (updateRank != (srcRank + indicesRank - 1)) {- THROW_CPU_NODE_ERR("do not have matched tensor rank relationship for input, indices and update");- }+ CPU_NODE_ASSERT(updateRank == (srcRank + indicesRank - 1),+ "do not have matched tensor rank relationship for input, indices and update");break;}case ScatterUpdateMode::ScatterNDUpdate: {if (indicesDim[indicesRank - 1] != Shape::UNDEFINED_DIM) {size_t k = indicesDim[indicesRank - 1];- if (k > srcRank) {- THROW_CPU_NODE_ERR("do not have an correct indices' last dimension value, ",- "which should be smaller than or equal to input tensor rank");- }+ CPU_NODE_ASSERT(k <= srcRank,+ "do not have an correct indices' last dimension value, ",+ "which should be smaller than or equal to input tensor rank");size_t tupleRank = indicesRank - 1;VectorDims expectUpdateShape(tupleRank + srcRank - k, 0);@@ -259,30 +248,26 @@ void ScatterUpdate::initSupportedPrimitiveDescriptors() {expectUpdateShape[updateAxisIter] = srcDataDim[rd];updateAxisIter++;}- if (expectUpdateShape.size() != updateRank) {- THROW_CPU_NODE_ERR("do not have matched tensor rank relationship for input, indices and update");- }+ CPU_NODE_ASSERT(expectUpdateShape.size() == updateRank,+ "do not have matched tensor rank relationship for input, indices and update");for (size_t ru = 0; ru < updateRank; ru++) {- if (!dimsEqualWeak(updateDim[ru], expectUpdateShape[ru])) {- THROW_CPU_NODE_ERR("do not have matched tensor shape relationship for input, indices and update");- }+ CPU_NODE_ASSERT(dimsEqualWeak(updateDim[ru], expectUpdateShape[ru]),+ "do not have matched tensor shape relationship for input, indices and update");}}break;}case ScatterUpdateMode::ScatterElementsUpdate: {- if (srcRank != indicesRank || srcRank != updateRank) {- THROW_CPU_NODE_ERR("do not have the same tensor rank for input, indices and update");- }+ CPU_NODE_ASSERT(srcRank == indicesRank && srcRank == updateRank,+ "do not have the same tensor rank for input, indices and update");for (size_t ri = 0; ri < indicesRank; ri++) {- if (!dimsEqualWeak(indicesDim[ri], updateDim[ri])) {- THROW_CPU_NODE_ERR("do not have the same tensor shape for indices and update");- }+ CPU_NODE_ASSERT(dimsEqualWeak(indicesDim[ri], updateDim[ri]),+ "do not have the same tensor shape for indices and update");}break;}default: {- THROW_CPU_NODE_ERR("is not supported");+ CPU_NODE_THROW("is not supported");}}@@ -914,9 +899,8 @@ void ScatterUpdate::execute([[maybe_unused]] const dnnl::stream& strm) {axis = *axisPtr64;}- if (axis >= static_cast<int>(srcRank) || axis < (static_cast<int>(srcRank) * -1)) {- THROW_CPU_NODE_ERR("should have axis value in range [-r, r - 1], where r is the rank of input data");- }+ CPU_NODE_ASSERT(axis < static_cast<int>(srcRank) && axis >= (static_cast<int>(srcRank) * -1),+ "should have axis value in range [-r, r - 1], where r is the rank of input data");axis = axis < 0 ? (axis + srcRank) : axis;size_t srcDimAxis = srcDataDim[axis];@@ -927,10 +911,9 @@ void ScatterUpdate::execute([[maybe_unused]] const dnnl::stream& strm) {splitter(indicesBlockND[0], nthr, ithr, start, end);for (size_t i = start; i < end; i++) {int64_t idxValue = getIndicesValue(indicesPtr, i);- if (idxValue >= static_cast<int64_t>(srcDimAxis) ||- (idxValue < 0 && scatterUpdateMode != ScatterUpdateMode::ScatterElementsUpdate)) {- THROW_CPU_NODE_ERR("have indices value that points to non-existing output tensor element");- }+ CPU_NODE_ASSERT(idxValue < static_cast<int64_t>(srcDimAxis) &&+ (idxValue >= 0 || scatterUpdateMode == ScatterUpdateMode::ScatterElementsUpdate),+ "have indices value that points to non-existing output tensor element");}});@@ -952,16 +935,14 @@ void ScatterUpdate::execute([[maybe_unused]] const dnnl::stream& strm) {}}}- if (updateRank > expectUpdateShape.size()) {- THROW_CPU_NODE_ERR("cannot update shape. New rank: ",- updateRank,- ", expected: ",- expectUpdateShape.size());- }+ CPU_NODE_ASSERT(updateRank <= expectUpdateShape.size(),+ "cannot update shape. New rank: ",+ updateRank,+ ", expected: ",+ expectUpdateShape.size());for (size_t ru = 0; ru < updateRank; ru++) {- if (updateDim[ru] != expectUpdateShape[ru]) {- THROW_CPU_NODE_ERR("do not have matched tensor shape relationship for input, indices and update");- }+ CPU_NODE_ASSERT(updateDim[ru] == expectUpdateShape[ru],+ "do not have matched tensor shape relationship for input, indices and update");}}}@@ -996,7 +977,7 @@ void ScatterUpdate::execute([[maybe_unused]] const dnnl::stream& strm) {break;}default: {- THROW_CPU_NODE_ERR("is not supported");+ CPU_NODE_THROW("is not supported");}}}diff --git a/src/plugins/intel_cpu/src/nodes/shapeof.cpp b/src/plugins/intel_cpu/src/nodes/shapeof.cppindex cfd0c165a93..2ff8a5a5d73 100644--- a/src/plugins/intel_cpu/src/nodes/shapeof.cpp+++ b/src/plugins/intel_cpu/src/nodes/shapeof.cpp@@ -41,21 +41,15 @@ ShapeOf::ShapeOf(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr&: Node(op, context, ShapeOfShapeInferFactory()) {std::string errorMessage;if (isSupportedOperation(op, errorMessage)) {- if (op->get_input_partial_shape(0).size() == 0) {- THROW_CPU_NODE_ERR("gets unsupported input 0D tensor (scalar)");- }+ CPU_NODE_ASSERT(op->get_input_partial_shape(0).size() != 0, "gets unsupported input 0D tensor (scalar)");} else {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}}void ShapeOf::getSupportedDescriptors() {- if (getParentEdges().size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getParentEdges().size());- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has incorrect number of output edges: ", getChildEdges().size());- }+ CPU_NODE_ASSERT(getParentEdges().size() == 1, "has incorrect number of input edges: ", getParentEdges().size());+ CPU_NODE_ASSERT(!getChildEdges().empty(), "has incorrect number of output edges: ", getChildEdges().size());}void ShapeOf::initSupportedPrimitiveDescriptors() {@@ -94,9 +88,8 @@ void ShapeOf::execute([[maybe_unused]] const dnnl::stream& strm) {auto outPtr = getDstMemoryAtPort(0);auto&& inDims = inPtr->getStaticDims();size_t dimsCount = inDims.size();- if (outPtr->getStaticDims().size() != 1 || dimsCount != outPtr->getStaticDims()[0]) {- THROW_CPU_NODE_ERR("has inconsistent input shape and output size");- }+ CPU_NODE_ASSERT(outPtr->getStaticDims().size() == 1 && dimsCount == outPtr->getStaticDims()[0],+ "has inconsistent input shape and output size");auto* dst = outPtr->getDataAs<int>();diff --git a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cppindex b73fce08abf..758b1b03cad 100644--- a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp+++ b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp@@ -85,7 +85,7 @@ ShuffleChannels::ShuffleChannels(const std::shared_ptr<ov::Node>& op, const Grap}if (inputShapes.size() != 1 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges.");+ CPU_NODE_THROW("has incorrect number of input/output edges.");}auto shuffleChannels = ov::as_type_ptr<const ov::op::v0::ShuffleChannels>(op);@@ -105,7 +105,7 @@ void ShuffleChannels::initSupportedPrimitiveDescriptors() {ov::element::Type precision = getOriginalInputPrecisionAtPort(0);const std::set<size_t> supported_precision_sizes = {1, 2, 4, 8, 16};if (supported_precision_sizes.find(precision.size()) == supported_precision_sizes.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", precision.get_type_name());+ CPU_NODE_THROW("has unsupported precision: ", precision.get_type_name());}auto impl_type = []() {@@ -137,15 +137,9 @@ void ShuffleChannels::initSupportedPrimitiveDescriptors() {void ShuffleChannels::createPrimitive() {auto dstMemPtr = getDstMemoryAtPort(0);auto srcMemPtr = getSrcMemoryAtPort(0);- if (!dstMemPtr) {- THROW_CPU_NODE_ERR("has null destination memory");- }- if (!srcMemPtr) {- THROW_CPU_NODE_ERR("has null input memory");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor");- }+ CPU_NODE_ASSERT(dstMemPtr, "has null destination memory");+ CPU_NODE_ASSERT(srcMemPtr, "has null input memory");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "has unidentified preferable primitive descriptor");const auto& memoryDesc = srcMemPtr->getDesc();attrs.spatialRank = attrs.dataRank - attrs.axis - 1;@@ -178,17 +172,15 @@ void ShuffleChannels::prepareParams() {auto cache = context->getParamsCache();auto result = cache->getOrCreate(attrs, builder);- if (!result.first) {- THROW_CPU_NODE_ERR("executor was not found for node.");- }+ CPU_NODE_ASSERT(result.first, "executor was not found for node.");execPtr = result.first;}ShuffleChannels::ShuffleChannelsExecutor::ShuffleChannelsExecutor(const ShuffleChannelsAttributes& attrs) {- if (!one_of(attrs.layoutType, LayoutType::nCsp16c, LayoutType::nCsp8c, LayoutType::nspc, LayoutType::ncsp)) {- OPENVINO_THROW("ShuffleChannels executor supports only 'nCsp16c', 'nCsp8c', 'nspc' or 'ncsp' layouts.");- }+ OPENVINO_ASSERT(+ one_of(attrs.layoutType, LayoutType::nCsp16c, LayoutType::nCsp8c, LayoutType::nspc, LayoutType::ncsp),+ "ShuffleChannels executor supports only 'nCsp16c', 'nCsp8c', 'nspc' or 'ncsp' layouts.");const bool isBlocked = one_of(attrs.layoutType, LayoutType::nCsp16c, LayoutType::nCsp8c);const bool isChannelsLast = attrs.layoutType == LayoutType::nspc;@@ -298,9 +290,7 @@ ShuffleChannels::ShuffleChannelsExecutor::ShuffleChannelsExecutor(const ShuffleC}void ShuffleChannels::ShuffleChannelsExecutor::exec(const uint8_t* srcData, uint8_t* dstData, int MB) {- if (!permuteKernel) {- OPENVINO_THROW("Could not execute. Kernel for Transpose node was not compiled.");- }+ OPENVINO_ASSERT(permuteKernel, "Could not execute. Kernel for Transpose node was not compiled.");if (MB > 0) {permuteKernel->execute(srcData, dstData, MB);@@ -314,9 +304,7 @@ void ShuffleChannels::executeDynamicImpl(const dnnl::stream& strm) {}void ShuffleChannels::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("doesn't have a compiled executor.");- }+ CPU_NODE_ASSERT(execPtr, "doesn't have a compiled executor.");int MB = (attrs.axis != 0) ? getSrcMemoryAtPort(0)->getStaticDims()[0] : -1;diff --git a/src/plugins/intel_cpu/src/nodes/softmax.cpp b/src/plugins/intel_cpu/src/nodes/softmax.cppindex fed8693514e..506521f4f9b 100644--- a/src/plugins/intel_cpu/src/nodes/softmax.cpp+++ b/src/plugins/intel_cpu/src/nodes/softmax.cpp@@ -106,12 +106,8 @@ void SoftMax::getSupportedDescriptors() {}auto inputDataType = DnnlExtensionUtils::ElementTypeToDataType(precision);- if (getParentEdges().size() != 1) {- THROW_CPU_NODE_ERR("Incorrect number of input edges");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("Incorrect number of output edges");- }+ CPU_NODE_ASSERT(getParentEdges().size() == 1, "Incorrect number of input edges");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "Incorrect number of output edges");const auto& inShape = getInputShapeAtPort(0);if (inShape.getRank() == 3) {@@ -143,9 +139,7 @@ Node::AttrPtr SoftMax::initPrimitiveAttr() {void SoftMax::initOptimalPrimitiveDescriptor() {auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(selected_pd, "Preferable primitive descriptor is not set.");auto config = selected_pd->getConfig();if (isDynamicNode()) {auto outMemDesc = config.outConfs[0].getMemDesc();@@ -155,7 +149,7 @@ void SoftMax::initOptimalPrimitiveDescriptor() {if (config.inConfs.size() != 1 || config.outConfs.size() != 1 ||(config.inConfs[0].getMemDesc()->isDefined() && config.outConfs[0].getMemDesc()->isDefined() &&!config.outConfs[0].getPortDesc()->isCompatible(*config.inConfs[0].getPortDesc()))) {- THROW_CPU_NODE_ERR("has incorrect selected config!");+ CPU_NODE_THROW("has incorrect selected config!");}config.inConfs[0].setMemDesc(getConsistentInputDesc(config, 0)->getMemDesc());@@ -190,9 +184,7 @@ void SoftMax::prepareParams() {auto inpDesc = getParentEdgeAt(0)->getMemory().getDescWithType<DnnlMemoryDesc>();const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(selected_pd, "Preferable primitive descriptor is not set.");auto attr = initPrimitiveAttr();@@ -235,9 +227,7 @@ void SoftMax::prepareParams() {auto result = cache->getOrCreate(key, builder);execPtr = result.first;- if (!execPtr) {- THROW_CPU_NODE_ERR("Primitive descriptor was not found.");- }+ CPU_NODE_ASSERT(execPtr, "Primitive descriptor was not found.");auto scratchpadMem = getScratchPadMem(execPtr->getScratchPadDesc());@@ -254,7 +244,7 @@ void SoftMax::execute(const dnnl::stream& strm) {if (execPtr) {execPtr->exec(primArgs, strm);} else {- THROW_CPU_NODE_ERR("doesn't have an initialized executor");+ CPU_NODE_THROW("doesn't have an initialized executor");}}diff --git a/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp b/src/plugins/intel_cpu/src/nodes/space_to_batch.cppindex 3502d8ede12..2550699057d 100644--- a/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp+++ b/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp@@ -49,18 +49,13 @@ SpaceToBatch::SpaceToBatch(const std::shared_ptr<ov::Node>& op, const GraphConteOPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (inputShapes.size() != 4 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input or output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 4 && outputShapes.size() == 1,+ "has incorrect number of input or output edges!");const size_t srcRank = getInputShapeAtPort(0).getRank();const size_t dstRank = getOutputShapeAtPort(0).getRank();- if (srcRank < 4 || srcRank > 5) {- THROW_CPU_NODE_ERR("has unsupported 'data' input rank: ", srcRank);- }- if (srcRank != dstRank) {- THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions");- }+ CPU_NODE_ASSERT(srcRank >= 4 && srcRank <= 5, "has unsupported 'data' input rank: ", srcRank);+ CPU_NODE_ASSERT(srcRank == dstRank, "has incorrect number of input/output dimensions");}void SpaceToBatch::initSupportedPrimitiveDescriptors() {@@ -71,9 +66,9 @@ void SpaceToBatch::initSupportedPrimitiveDescriptors() {const auto& inDims = getInputShapeAtPort(0).getDims();const auto precision = getOriginalInputPrecisionAtPort(0);const std::set<size_t> supported_precision_sizes = {1, 2, 4, 8};- if (supported_precision_sizes.find(precision.size()) == supported_precision_sizes.end()) {- THROW_CPU_NODE_ERR("has unsupported precision: ", precision.get_type_name());- }+ CPU_NODE_ASSERT(supported_precision_sizes.find(precision.size()) != supported_precision_sizes.end(),+ "has unsupported precision: ",+ precision.get_type_name());addSupportedPrimDesc({{LayoutType::nspc, precision},{LayoutType::ncsp, ov::element::i32},@@ -283,8 +278,8 @@ void SpaceToBatch::execute([[maybe_unused]] const dnnl::stream& strm) {SpaceToBatchKernel<element_type_traits<ov::element::i32>::value_type>();break;default:- THROW_CPU_NODE_ERR("does not support precision '" +- std::string(getParentEdgeAt(0)->getMemory().getDesc().getPrecision().get_type_name()) + "'");+ CPU_NODE_THROW("does not support precision '" ++ std::string(getParentEdgeAt(0)->getMemory().getDesc().getPrecision().get_type_name()) + "'");}}diff --git a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp b/src/plugins/intel_cpu/src/nodes/space_to_depth.cppindex 7bb84d6a87b..67ffa9003cf 100644--- a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp+++ b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp@@ -92,14 +92,10 @@ SpaceToDepth::SpaceToDepth(const std::shared_ptr<ov::Node>& op, const GraphConteif (!isSupportedOperation(op, errorMessage)) {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (inputShapes.size() != 1 || outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 1 && outputShapes.size() == 1, "has incorrect number of input/output edges!");auto spaceToDepth = ov::as_type_ptr<const ov::op::v0::SpaceToDepth>(op);- if (!spaceToDepth) {- THROW_CPU_NODE_ERR("supports only v0");- }+ CPU_NODE_ASSERT(spaceToDepth, "supports only v0");const auto modeNgraph = spaceToDepth->get_mode();if (modeNgraph == ov::op::v0::SpaceToDepth::SpaceToDepthMode::BLOCKS_FIRST) {@@ -107,25 +103,17 @@ SpaceToDepth::SpaceToDepth(const std::shared_ptr<ov::Node>& op, const GraphConte} else if (modeNgraph == ov::op::v0::SpaceToDepth::SpaceToDepthMode::DEPTH_FIRST) {attrs.mode = Mode::DEPTH_FIRST;} else {- THROW_CPU_NODE_ERR("doesn't support mode: ", ov::as_string(modeNgraph));+ CPU_NODE_THROW("doesn't support mode: ", ov::as_string(modeNgraph));}attrs.blockSize = spaceToDepth->get_block_size();- if (attrs.blockSize == 0) {- THROW_CPU_NODE_ERR("has incorrect block_size parameter is zero!");- }+ CPU_NODE_ASSERT(attrs.blockSize != 0, "has incorrect block_size parameter is zero!");const size_t srcRank = getInputShapeAtPort(0).getRank();const size_t dstRank = getOutputShapeAtPort(0).getRank();- if (srcRank < 3) {- THROW_CPU_NODE_ERR("has incorrect number of input dimensions");- }- if (srcRank > 5) {- THROW_CPU_NODE_ERR("doesn't support dimensions with rank greater than 5");- }- if (srcRank != dstRank) {- THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions");- }+ CPU_NODE_ASSERT(srcRank >= 3, "has incorrect number of input dimensions");+ CPU_NODE_ASSERT(srcRank <= 5, "doesn't support dimensions with rank greater than 5");+ CPU_NODE_ASSERT(srcRank == dstRank, "has incorrect number of input/output dimensions");attrs.nSpatialDims = srcRank - 2;attrs.blockStep = static_cast<size_t>(std::pow(attrs.blockSize, attrs.nSpatialDims));}@@ -189,15 +177,9 @@ void SpaceToDepth::initSupportedPrimitiveDescriptors() {void SpaceToDepth::createPrimitive() {auto dstMemPtr = getDstMemoryAtPort(0);auto srcMemPtr = getSrcMemoryAtPort(0);- if (!dstMemPtr) {- THROW_CPU_NODE_ERR("has null destination memory");- }- if (!srcMemPtr) {- THROW_CPU_NODE_ERR("has null input memory");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor");- }+ CPU_NODE_ASSERT(dstMemPtr, "has null destination memory");+ CPU_NODE_ASSERT(srcMemPtr, "has null input memory");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "has unidentified preferable primitive descriptor");const auto& memoryDesc = srcMemPtr->getDesc();attrs.dataSize = memoryDesc.getPrecision().size();@@ -228,18 +210,16 @@ void SpaceToDepth::prepareParams() {auto cache = context->getParamsCache();auto result = cache->getOrCreate(attrs, builder);- if (!result.first) {- THROW_CPU_NODE_ERR("executor was not found.");- }+ CPU_NODE_ASSERT(result.first, "executor was not found.");execPtr = result.first;}SpaceToDepth::SpaceToDepthExecutor::SpaceToDepthExecutor(const SpaceToDepthAttrs& attrs) {- if (!one_of(attrs.layoutType, LayoutType::nCsp16c, LayoutType::nCsp8c, LayoutType::nspc, LayoutType::ncsp)) {- OPENVINO_THROW("SpaceToDepth executor supports only 'nCsp16c', 'nCsp8c', "- "'nspc' or 'ncsp' layouts.");- }+ OPENVINO_ASSERT(+ one_of(attrs.layoutType, LayoutType::nCsp16c, LayoutType::nCsp8c, LayoutType::nspc, LayoutType::ncsp),+ "SpaceToDepth executor supports only 'nCsp16c', 'nCsp8c', "+ "'nspc' or 'ncsp' layouts.");const bool isBlocked = one_of(attrs.layoutType, LayoutType::nCsp16c, LayoutType::nCsp8c);const bool isChannelsFirst = attrs.layoutType == LayoutType::nspc;@@ -332,16 +312,12 @@ SpaceToDepth::SpaceToDepthExecutor::SpaceToDepthExecutor(const SpaceToDepthAttrs}void SpaceToDepth::SpaceToDepthExecutor::exec(const uint8_t* srcData, uint8_t* dstData, const int MB) {- if (!permuteKernel) {- OPENVINO_THROW("Could not execute. Kernel for Transpose node was not compiled.");- }+ OPENVINO_ASSERT(permuteKernel, "Could not execute. Kernel for Transpose node was not compiled.");permuteKernel->execute(srcData, dstData, MB);}void SpaceToDepth::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("doesn't have a compiled executor.");- }+ CPU_NODE_ASSERT(execPtr, "doesn't have a compiled executor.");const auto* srcData = getSrcDataAtPortAs<const uint8_t>(0);auto* dstData = getDstDataAtPortAs<uint8_t>(0);const int MB = getSrcMemoryAtPort(0)->getStaticDims()[0];diff --git a/src/plugins/intel_cpu/src/nodes/split.cpp b/src/plugins/intel_cpu/src/nodes/split.cppindex d01b388ce04..4700dd5944d 100644--- a/src/plugins/intel_cpu/src/nodes/split.cpp+++ b/src/plugins/intel_cpu/src/nodes/split.cpp@@ -92,7 +92,7 @@ Split::Split(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contaxis += inRank;}if (axis >= static_cast<int64_t>(inRank)) {- THROW_CPU_NODE_ERR("has invalid value of axis parameter: ", axis);+ CPU_NODE_THROW("has invalid value of axis parameter: ", axis);}this->axis = axis;}@@ -111,7 +111,7 @@ void Split::initSupportedPrimitiveDescriptors() {for (const auto& outputShape : outputShapes) {const auto& o_Dims = outputShape.getDims();if (dstFirstDims.size() != o_Dims.size()) {- THROW_CPU_NODE_ERR("only supports output blobs with equal number of dimensions");+ CPU_NODE_THROW("only supports output blobs with equal number of dimensions");}for (size_t j = 0; j < dstFirstDims.size(); j++) {@@ -119,7 +119,7 @@ void Split::initSupportedPrimitiveDescriptors() {continue;}if (!dimsEqualWeak(o_Dims[j], dstFirstDims[j])) {- THROW_CPU_NODE_ERR("has incorrect output dimensions");+ CPU_NODE_THROW("has incorrect output dimensions");}}}@@ -278,9 +278,7 @@ void Split::createPrimitive() {void Split::prepareParams() {const auto& srcMemPtr = getSrcMemoryAtPort(0);- if (!srcMemPtr || !srcMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory");- }+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "has undefined input memory");if (!constSplitLengths) {const auto& splitLengthsPtr = getSrcMemoryAtPort(2);@@ -293,9 +291,7 @@ void Split::prepareParams() {std::vector<BlockedMemoryDescCPtr> outDescs;for (size_t port = 0; port < outputShapes.size(); ++port) {const auto& outMemPtr = this->getDstMemoryAtPort(port);- if (!outMemPtr || !outMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined destination memory");- }+ CPU_NODE_ASSERT(outMemPtr && outMemPtr->isDefined(), "has undefined destination memory");if (outMemPtr->getShape().hasZeroDims()) {continue;@@ -327,9 +323,7 @@ void Split::execute([[maybe_unused]] const dnnl::stream& strm) {return;}- if (dstMemPtrs.empty()) {- THROW_CPU_NODE_ERR("Output data pointers have not been initialized.");- }+ CPU_NODE_ASSERT(!dstMemPtrs.empty(), "Output data pointers have not been initialized.");const auto& srcMem = getParentEdgeAt(0)->getMemory();@@ -339,7 +333,7 @@ void Split::execute([[maybe_unused]] const dnnl::stream& strm) {}auto* srcData = srcMem.getDataAs<uint8_t>();- CPU_NODE_ASSERT(execPtr != nullptr, "Split executor is not initialized");+ CPU_NODE_ASSERT(execPtr, "Split executor is not initialized");execPtr->exec(srcData, getRawDstMemPtrs());}@@ -350,9 +344,7 @@ bool Split::created() const {void Split::initOptimalPrimitiveDescriptor() {Node::initOptimalPrimitiveDescriptor();auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(selected_pd, "Preferable primitive descriptor is not set.");auto config = selected_pd->getConfig();canUseOptimizedNspc2Ncsp = false;@@ -516,9 +508,7 @@ std::vector<uint8_t*> Split::getRawDstMemPtrs() const {std::vector<uint8_t*> result(dstMemPtrs.size());for (size_t i = 0; i < dstMemPtrs.size(); ++i) {result[i] = dstMemPtrs[i].second->getDataAs<uint8_t>();- if (!result[i]) {- THROW_CPU_NODE_ERR("can't get child edge indx ", dstMemPtrs[i].first, " data.");- }+ CPU_NODE_ASSERT(result[i], "can't get child edge indx ", dstMemPtrs[i].first, " data.");}return result;}@@ -535,9 +525,8 @@ Split::SplitOptimizedExecutor::SplitOptimizedExecutor(const BlockedMemoryDescCPtbreak;}}- if (std::numeric_limits<unsigned>::max() == axisOrderPos) {- OPENVINO_THROW("Can't create split executor, because can't find the axis in the input tensor order list");- }+ OPENVINO_ASSERT(std::numeric_limits<unsigned>::max() != axisOrderPos,+ "Can't create split executor, because can't find the axis in the input tensor order list");const auto outputPortsCount = outDescs.size();@@ -585,9 +574,7 @@ void Split::resolveInPlaceEdges(Edge::LOOK look) {return;}auto* selected_pd = getSelectedPrimitiveDescriptor();- if (selected_pd == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");- }+ CPU_NODE_ASSERT(selected_pd, "Preferable primitive descriptor is not set.");const auto& config = selected_pd->getConfig();size_t numberOfOutputs = config.outConfs.size();size_t inplaceInpIndx = selected_pd->getConfig().outConfs[0].inPlace();diff --git a/src/plugins/intel_cpu/src/nodes/stft.cpp b/src/plugins/intel_cpu/src/nodes/stft.cppindex d4f28427d58..c13ae958879 100644--- a/src/plugins/intel_cpu/src/nodes/stft.cpp+++ b/src/plugins/intel_cpu/src/nodes/stft.cpp@@ -62,12 +62,8 @@ STFT::STFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contex}void STFT::getSupportedDescriptors() {- if (getParentEdges().size() != 4) {- THROW_CPU_NODE_ERR("STFT has incorrect number of input edges.");- }- if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("STFT has incorrect number of output edges.");- }+ CPU_NODE_ASSERT(getParentEdges().size() == 4, "STFT has incorrect number of input edges.");+ CPU_NODE_ASSERT(!getChildEdges().empty(), "STFT has incorrect number of output edges.");}void STFT::initSupportedPrimitiveDescriptors() {diff --git a/src/plugins/intel_cpu/src/nodes/strided_slice.cpp b/src/plugins/intel_cpu/src/nodes/strided_slice.cppindex 583708bee2f..2dd90788727 100644--- a/src/plugins/intel_cpu/src/nodes/strided_slice.cpp+++ b/src/plugins/intel_cpu/src/nodes/strided_slice.cpp@@ -75,14 +75,11 @@ StridedSlice::StridedSlice(const std::shared_ptr<ov::Node>& op, const GraphConteattrs.AXES_ID = 5;}- if ((attrs.isStridedSliceOp && (inputShapes.size() < 3 || inputShapes.size() > 4)) ||- (!attrs.isStridedSliceOp &&- (inputShapes.size() < (attrs.STRIDE_ID + 1) || inputShapes.size() > (attrs.AXES_ID + 1)))) {- THROW_CPU_NODE_ERR("has incorrect number of input edges");- }- if (outputShapes.size() != 1) {- THROW_CPU_NODE_ERR("has incorrect number of output edges");- }+ CPU_NODE_ASSERT(!(attrs.isStridedSliceOp && (inputShapes.size() < 3 || inputShapes.size() > 4)) &&+ !(!attrs.isStridedSliceOp &&+ (inputShapes.size() < (attrs.STRIDE_ID + 1) || inputShapes.size() > (attrs.AXES_ID + 1))),+ "has incorrect number of input edges");+ CPU_NODE_ASSERT(outputShapes.size() == 1, "has incorrect number of output edges");if (inputShapes.size() > attrs.STRIDE_ID) {isStrideSpecified = true;@@ -149,9 +146,8 @@ StridedSlice::StridedSlice(const std::shared_ptr<ov::Node>& op, const GraphConteattrs.ellipsisMaskCounter += attrs.ellipsisMask[i];attrs.ellipsisPos1 = attrs.ellipsisMask[i] == 1 && attrs.ellipsisPos1 == -1 ? i : attrs.ellipsisPos1;}- if (attrs.ellipsisMaskCounter > 1) {- THROW_CPU_NODE_ERR("has incorrect 'Ellipsis_mask'. Only one non-zero bit is allowed");- }+ CPU_NODE_ASSERT(attrs.ellipsisMaskCounter <= 1,+ "has incorrect 'Ellipsis_mask'. Only one non-zero bit is allowed");int newAxis = std::accumulate(attrs.newAxisMask.begin(), attrs.newAxisMask.end(), 0);int shrinkAxis = std::accumulate(attrs.shrinkAxisMask.begin(), attrs.shrinkAxisMask.end(), 0);@@ -388,9 +384,7 @@ bool StridedSlice::needShapeInfer() const {}void StridedSlice::execute([[maybe_unused]] const dnnl::stream& strm) {- if (!execPtr) {- THROW_CPU_NODE_ERR("doesn't have compiled executor!");- }+ CPU_NODE_ASSERT(execPtr, "doesn't have compiled executor!");execPtr->exec(srcMemory, dstMemory);}@@ -488,16 +482,12 @@ void StridedSlice::StridedSliceCommonExecutor::paramsInitialization(const Strideparams.attrs.beginDims = srcMemory[attrs.BEGIN_ID]->getShape().getStaticDims();params.attrs.endDims = srcMemory[attrs.END_ID]->getShape().getStaticDims();- if (params.attrs.beginDims.size() != 1) {- OPENVINO_THROW("Strided slice common executor should have begin vector with 1 dimension");- }- if (params.attrs.endDims.size() != 1) {- OPENVINO_THROW("Strided slice common executor should have end vector with 1 dimension");- }- if (params.attrs.beginDims[0] != params.attrs.endDims[0]) {- OPENVINO_THROW("Strided slice common executor should have begin vector with size equal to end vector size");- }-+ OPENVINO_ASSERT(params.attrs.beginDims.size() == 1,+ "Strided slice common executor should have begin vector with 1 dimension");+ OPENVINO_ASSERT(params.attrs.endDims.size() == 1,+ "Strided slice common executor should have end vector with 1 dimension");+ OPENVINO_ASSERT(params.attrs.beginDims[0] == params.attrs.endDims[0],+ "Strided slice common executor should have begin vector with size equal to end vector size");if (params.attrs.begin.empty()) {fillingInParameters(params.attrs.begin, attrs.BEGIN_ID, params.attrs.beginDims[0], 0);}@@ -510,11 +500,8 @@ void StridedSlice::StridedSliceCommonExecutor::paramsInitialization(const Strideif (params.attrs.strideDims.size() > 1) {OPENVINO_THROW("Strided slice common executor should have stride vector with 1 dimension");}- if (params.attrs.beginDims[0] != params.attrs.strideDims[0]) {- OPENVINO_THROW(- "Strided slice common executor should have stride vector with size equal to begin vector size");- }-+ OPENVINO_ASSERT(params.attrs.beginDims[0] == params.attrs.strideDims[0],+ "Strided slice common executor should have stride vector with size equal to begin vector size");if (params.attrs.stride.empty()) {fillingInParameters(params.attrs.stride, attrs.STRIDE_ID, params.attrs.strideDims[0], 1);}@@ -525,11 +512,8 @@ void StridedSlice::StridedSliceCommonExecutor::paramsInitialization(const Strideif (params.attrs.axesDims.size() != 1) {OPENVINO_THROW("Strided slice common executor should have axes vector with 1 dimension.");}- if (params.attrs.beginDims[0] != params.attrs.axesDims[0]) {- OPENVINO_THROW(- "Strided slice common executor should have axes vector with size equal to begin vector size.");- }-+ OPENVINO_ASSERT(params.attrs.beginDims[0] == params.attrs.axesDims[0],+ "Strided slice common executor should have axes vector with size equal to begin vector size.");if (params.attrs.axes.empty()) {fillingInParameters(params.attrs.axes, attrs.AXES_ID, params.attrs.axesDims[0], 0);}diff --git a/src/plugins/intel_cpu/src/nodes/subgraph.cpp b/src/plugins/intel_cpu/src/nodes/subgraph.cppindex 1252421a146..cd6cee01d23 100644--- a/src/plugins/intel_cpu/src/nodes/subgraph.cpp+++ b/src/plugins/intel_cpu/src/nodes/subgraph.cpp@@ -23,7 +23,6 @@#include "nodes/executors/subgraph.hpp"#include "nodes/node_config.h"#include "onednn/iml_type_mapper.h"-#include "openvino/core/except.hpp"#include "openvino/core/node.hpp"#include "openvino/core/parallel.hpp"#include "openvino/core/type.hpp"@@ -199,7 +198,7 @@ Subgraph::Subgraph(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtrhost_isa(getHostIsa()),subgraph_attrs(std::make_shared<SubgraphAttrs>()) {const auto& tmp_snippet = ov::as_type_ptr<snippets::op::Subgraph>(op);- OPENVINO_ASSERT(tmp_snippet, "Attempt to create Subgraph node from an invalid op type");+ CPU_NODE_ASSERT(tmp_snippet, "Attempt to create Subgraph node from an invalid op type");subgraph_attrs->snippet = tmp_snippet->clone();subgraph_attrs->bodyHash = getBodyHash(tmp_snippet);@@ -209,7 +208,7 @@ Subgraph::Subgraph(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr#elif defined(OPENVINO_ARCH_X86_64)subgraph_attrs->snippet->set_generator(std::make_shared<CPUGenerator>(host_isa, context->getSnippetsParamsCache()));#else- THROW_CPU_NODE_ERR("Subgraphs code-generator is not supported on non-x64 platforms");+ CPU_NODE_THROW("Subgraphs code-generator is not supported on non-x64 platforms");#endif// Note: we have to update shapeInfer, so it uses the per-thread op::Subgraph copy@@ -687,7 +686,7 @@ Subgraph::ControlFlowPasses Subgraph::getControlFlowPasses() {uint32_t Subgraph::getBroadcastingMask(const std::vector<VectorDims>& input_shapes) {uint32_t mask = 0;- OPENVINO_ASSERT(broadcastable_inputs.size() < sizeof(mask) * CHAR_BIT,+ CPU_NODE_ASSERT(broadcastable_inputs.size() < sizeof(mask) * CHAR_BIT,"Incorrect size of broadcastable inputs of Subgraph");for (const auto& broadcastable_input : broadcastable_inputs) {const auto& shape = input_shapes[broadcastable_input.first];@@ -722,11 +721,11 @@ void Subgraph::optimizeIR() {// DataFlow transformations includes AnalyzeBroadcastableInputs pass:// we should verify that the received map is aligned with our blocked input shapes- OPENVINO_ASSERT((broadcastable_inputs.size() < in_shapes.size()) ||+ CPU_NODE_ASSERT((broadcastable_inputs.size() < in_shapes.size()) ||(!broadcastable_inputs.empty() && broadcastable_inputs.rbegin()->first < in_shapes.size()),"Incorrect indexes of broadcastable inputs of Subgraph");for (const auto broadcastable_input : broadcastable_inputs) {- OPENVINO_ASSERT(broadcastable_input.second < in_shapes[broadcastable_input.first].size(),+ CPU_NODE_ASSERT(broadcastable_input.second < in_shapes[broadcastable_input.first].size(),"Incorrect processing dimension index of broadcastable index");}@@ -830,7 +829,7 @@ void Subgraph::prepareParams() {execPtr = result.first;#endif- OPENVINO_ASSERT(execPtr != nullptr, "Executor is not created for node ", getName(), ".");+ CPU_NODE_ASSERT(execPtr, "Executor is not created for node ", getName(), ".");}IShapeInfer::Result Subgraph::shapeInfer() const {@@ -880,7 +879,7 @@ bool Subgraph::created() const {}void Subgraph::execute(const dnnl::stream& strm) {- OPENVINO_ASSERT(execPtr, "Can't execute Subgraph node. Primitive didn't created");+ CPU_NODE_ASSERT(execPtr, "Can't execute Subgraph node. Primitive didn't created");execPtr->execute(strm, srcMemPtrs, dstMemPtrs);}diff --git a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp b/src/plugins/intel_cpu/src/nodes/tensoriterator.cppindex 1f170e4c238..a9651061544 100644--- a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp+++ b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp@@ -198,9 +198,7 @@ public:void execute([[maybe_unused]] const dnnl::stream& strm, int n_iter) override {auto mem = mem_holder_dst;auto* data_ptr = static_cast<uint32_t*>(mem.get_data_handle());- if (data_ptr == nullptr) {- OPENVINO_THROW("TensorIterator node has not allocated memory for IterCountPortHelper");- }+ OPENVINO_ASSERT(data_ptr, "TensorIterator node has not allocated memory for IterCountPortHelper");*data_ptr = n_iter;}};@@ -215,9 +213,7 @@ public:int getStatus() override {auto* data_ptr = static_cast<uint8_t*>(mem_holder.get_data_handle());- if (data_ptr == nullptr) {- OPENVINO_THROW("TensorIterator node has not allocated memory for asBoolCheck");- }+ OPENVINO_ASSERT(data_ptr, "TensorIterator node has not allocated memory for asBoolCheck");return *data_ptr == static_cast<uint8_t>(0) ? 0 : 1;}};@@ -232,9 +228,7 @@ public:int getStatus() override {auto* data_ptr = static_cast<uint32_t*>(mem_holder.get_data_handle());- if (data_ptr == nullptr) {- OPENVINO_THROW("TensorIterator node has not allocated memory for asIntCheck");- }+ OPENVINO_ASSERT(data_ptr, "TensorIterator node has not allocated memory for asIntCheck");return *data_ptr;}};@@ -258,12 +252,11 @@ DynamicBuffer::DynamicBuffer(MemoryPtr from_, std::vector<MemoryPtr> to_, constelem_size(DnnlExtensionUtils::sizeOfDataType(from->getDataType())) {}void DynamicBuffer::execute(const dnnl::engine& eng, const int iter) {- if (from->getStaticDims()[map_rule.axis] != static_cast<size_t>(std::abs(map_rule.stride))) {- OPENVINO_THROW("TensorIterator (Loop) has incorrect output shape[axis] after iteration for concatenation. ",- std::abs(map_rule.stride),- " is expected, but actual: ",- from->getStaticDims()[map_rule.axis]);- }+ OPENVINO_ASSERT(from->getStaticDims()[map_rule.axis] == static_cast<size_t>(std::abs(map_rule.stride)),+ "TensorIterator (Loop) has incorrect output shape[axis] after iteration for concatenation. ",+ std::abs(map_rule.stride),+ " is expected, but actual: ",+ from->getStaticDims()[map_rule.axis]);if (iter == 0) {init(eng);@@ -497,7 +490,7 @@ void TensorIterator::createPrimitive() {std::string type_name = desc->get_type_info().name;if (type_name == "ConcatOutputDescription") {auto output_desc = ov::as_type_ptr<const ov::op::util::SubGraphOp::ConcatOutputDescription>(desc);- CPU_NODE_ASSERT(output_desc != nullptr, "Incorrect type of the output description");+ CPU_NODE_ASSERT(output_desc, "Incorrect type of the output description");outputPortMap.emplace_back(PortMap{static_cast<int>(output_desc->m_output_index),static_cast<int>(body_output_idx),@@ -508,7 +501,7 @@ void TensorIterator::createPrimitive() {static_cast<int>(output_desc->m_part_size)});} else if (type_name == "BodyOutputDescription") {auto output_desc = ov::as_type_ptr<const ov::op::util::SubGraphOp::BodyOutputDescription>(desc);- CPU_NODE_ASSERT(output_desc != nullptr, "Incorrect type of the output description");+ CPU_NODE_ASSERT(output_desc, "Incorrect type of the output description");outputPortMap.emplace_back(PortMap{static_cast<int>(output_desc->m_output_index),static_cast<int>(body_output_idx),@@ -518,7 +511,7 @@ void TensorIterator::createPrimitive() {-1,1});} else {- THROW_CPU_NODE_ERR("Incorrect type of the output description.");+ CPU_NODE_THROW("Incorrect type of the output description.");}}@@ -556,7 +549,7 @@ void TensorIterator::createPrimitive() {-1,1});} else {- THROW_CPU_NODE_ERR("has incorrect type of the input description.");+ CPU_NODE_THROW("has incorrect type of the input description.");}}@@ -574,7 +567,7 @@ void TensorIterator::createPrimitive() {} else if (auto ti = ov::as_type_ptr<const ov::op::v0::TensorIterator>(ngraphOp)) {algorithm = Algorithm::TensorIteratorCommon;} else {- THROW_CPU_NODE_ERR("isn't supported!");+ CPU_NODE_THROW("isn't supported!");}if (loopBodyConditionOutputIdx == -1) {@@ -939,45 +932,41 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,const auto getNumIterations = [this](const PortMap& rule, const std::vector<size_t>& dimensions) -> int {const auto axis = rule.axis;- if (axis < 0 || static_cast<std::size_t>(axis) >= dimensions.size()) {- THROW_CPU_NODE_ERR(": Invalid \"axis\" value in an iteration component: ",- rule.axis,- ", dimensions number = ",- dimensions.size(),- " (out of range)");- }+ CPU_NODE_ASSERT(axis >= 0 && static_cast<std::size_t>(axis) < dimensions.size(),+ ": Invalid \"axis\" value in an iteration component: ",+ rule.axis,+ ", dimensions number = ",+ dimensions.size(),+ " (out of range)");const auto space = dimensions[axis];const auto start = static_cast<int>((rule.start < 0 ? (space + 1) : 0) + rule.start);const auto end = static_cast<int>((rule.end < 0 ? (space + 1) : 0) + rule.end);const auto stride = rule.stride;- if (stride == 0) {- THROW_CPU_NODE_ERR(": Invalid \"stride\" value in an iteration component: ",- rule.stride,- " (infinite loop)");- }+ CPU_NODE_ASSERT(stride != 0,+ ": Invalid \"stride\" value in an iteration component: ",+ rule.stride,+ " (infinite loop)");const auto step = std::abs(stride);const auto src = stride < 0 ? end : start;const auto dst = stride < 0 ? start : end;const auto length = dst - src;- if (src < 0 || src >= dst || dst > static_cast<int64_t>(space) || length < step) {- THROW_CPU_NODE_ERR(": Invalid \"start\",\"stride\",\"end\" values in an iteration component",- ": \"start\" = ",- rule.start,- ", \"stride\" = ",- rule.stride,- ", \"end\" = ",- rule.end);- }-- if (length % step != 0) {- THROW_CPU_NODE_ERR(": Each iteration must be the same size: length (",- length,- ") is not divisible by step (",- step,- ")");- }+ CPU_NODE_ASSERT(src >= 0 && src < dst && dst <= static_cast<int64_t>(space) && length >= step,+ ": Invalid \"start\",\"stride\",\"end\" values in an iteration component",+ ": \"start\" = ",+ rule.start,+ ", \"stride\" = ",+ rule.stride,+ ", \"end\" = ",+ rule.end);++ CPU_NODE_ASSERT(length % step == 0,+ ": Each iteration must be the same size: length (",+ length,+ ") is not divisible by step (",+ step,+ ")");return static_cast<int>(length / step);};@@ -985,13 +974,12 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,int numIterations = 1;bool isDefault = true;for (const auto& rule : inputPortMap) {- if (rule.from < 0 || rule.from >= static_cast<int64_t>(inputShapes.size())) {- THROW_CPU_NODE_ERR(": Invalid \"from\" value: \"from\" = ",- rule.from,- " inputs number = ",- inputShapes.size(),- " (out of range)");- }+ CPU_NODE_ASSERT(rule.from >= 0 && rule.from < static_cast<int64_t>(inputShapes.size()),+ ": Invalid \"from\" value: \"from\" = ",+ rule.from,+ " inputs number = ",+ inputShapes.size(),+ " (out of range)");const auto& dims = getSrcMemoryAtPort(rule.from)->getStaticDims();if (!isIterable(rule)) {@@ -1002,11 +990,12 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,if (isDefault) {isDefault = false;numIterations = currentNumIterations;- } else if (numIterations != currentNumIterations) {- THROW_CPU_NODE_ERR(": There are at least two different iterations numbers: ",- numIterations,- " and ",- currentNumIterations);+ } else {+ CPU_NODE_ASSERT(numIterations == currentNumIterations,+ ": There are at least two different iterations numbers: ",+ numIterations,+ " and ",+ currentNumIterations);}}@@ -1020,23 +1009,23 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,continue;}- if (rule.from < 0 || rule.from >= static_cast<int64_t>(outputShapes.size())) {- THROW_CPU_NODE_ERR(": Invalid \"from\" value: \"from\" = ",- rule.from,- " inputs number = ",- outputShapes.size(),- " (out of range)");- }+ CPU_NODE_ASSERT(rule.from >= 0 && rule.from < static_cast<int64_t>(outputShapes.size()),+ ": Invalid \"from\" value: \"from\" = ",+ rule.from,+ " inputs number = ",+ outputShapes.size(),+ " (out of range)");const auto currentNumIterations = getNumIterations(rule, dims);if (isDefault) {isDefault = false;numIterations = currentNumIterations;- } else if (numIterations != currentNumIterations) {- THROW_CPU_NODE_ERR(": There are at least two different iterations numbers: ",- numIterations,- " and ",- currentNumIterations);+ } else {+ CPU_NODE_ASSERT(numIterations == currentNumIterations,+ ": There are at least two different iterations numbers: ",+ numIterations,+ " and ",+ currentNumIterations);}}diff --git a/src/plugins/intel_cpu/src/nodes/tile.cpp b/src/plugins/intel_cpu/src/nodes/tile.cppindex c3dcd5d60f5..ed6beae6f88 100644--- a/src/plugins/intel_cpu/src/nodes/tile.cpp+++ b/src/plugins/intel_cpu/src/nodes/tile.cpp@@ -77,37 +77,37 @@ void Tile::getSupportedDescriptors() {return result;};if (getParentEdges().size() != 2) {- THROW_CPU_NODE_ERR("has incorrect number of input edges. "- "Expected: 2, Actual: ",- getParentEdges().size());+ CPU_NODE_THROW("has incorrect number of input edges. "+ "Expected: 2, Actual: ",+ getParentEdges().size());}if (getChildEdges().empty()) {- THROW_CPU_NODE_ERR("has no output edges.");+ CPU_NODE_THROW("has no output edges.");}const auto& dstDims0 = getOutputShapeAtPort(0).getDims();for (size_t i = 1LU; i < outputShapes.size(); i++) {const auto& dstDims = getOutputShapeAtPort(i).getDims();if (dstDims.size() != dstDims0.size()) {- THROW_CPU_NODE_ERR("has output edges 0 and ",- i,- " with different ranks: ",- dstDims0.size(),- " and ",- dstDims.size());+ CPU_NODE_THROW("has output edges 0 and ",+ i,+ " with different ranks: ",+ dstDims0.size(),+ " and ",+ dstDims.size());}for (size_t j = 0; j < dstDims0.size(); j++) {if (dstDims0[j] != dstDims[j]) {- THROW_CPU_NODE_ERR("has output edges 0 and ",- i,- " with different dims: ",- vec_to_string(dstDims0),- " and ",- vec_to_string(dstDims));+ CPU_NODE_THROW("has output edges 0 and ",+ i,+ " with different dims: ",+ vec_to_string(dstDims0),+ " and ",+ vec_to_string(dstDims));}}}if (constMap[TILE_REPEATS] && getInputShapeAtPort(TILE_INPUT).getRank() > getOutputShapeAtPort(0).getRank()) {- THROW_CPU_NODE_ERR(+ CPU_NODE_THROW(" has incorrect input/output data shape rank. Input shape rank cannot be more than output shape rank. ""Actual input shape size: ",getInputShapeAtPort(TILE_INPUT).getRank(),diff --git a/src/plugins/intel_cpu/src/nodes/topk.cpp b/src/plugins/intel_cpu/src/nodes/topk.cppindex 5f91d085ea6..0c7b5091b50 100644--- a/src/plugins/intel_cpu/src/nodes/topk.cpp+++ b/src/plugins/intel_cpu/src/nodes/topk.cpp@@ -1927,9 +1927,7 @@ TopK::TopK(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contexif (!isDynamicNgraphNode(op)) {auto topKConst = ov::as_type_ptr<const ov::op::v0::Constant>(topKOp->get_input_node_shared_ptr(TOPK_K));- if (!topKConst) {- THROW_CPU_NODE_ERR("gets non-constant second tensor in static shape mode!");- }+ CPU_NODE_ASSERT(topKConst, "gets non-constant second tensor in static shape mode!");}axis = topKOp->get_axis();@@ -1949,28 +1947,22 @@ TopK::TopK(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contexvec_idx_seq.clear();vec_idx_block.clear();- if (inputShapes.size() != 2 || outputShapes.size() < 2) {- THROW_CPU_NODE_ERR("gets incorrect number of input/output edges!");- }+ CPU_NODE_ASSERT(inputShapes.size() == 2 && outputShapes.size() >= 2,+ "gets incorrect number of input/output edges!");- if (getInputShapeAtPort(TOPK_DATA).getRank() != getOutputShapeAtPort(TOPK_DATA).getRank()) {- THROW_CPU_NODE_ERR("gets incorrect number of input/output dimensions!");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(TOPK_DATA).getRank() == getOutputShapeAtPort(TOPK_DATA).getRank(),+ "gets incorrect number of input/output dimensions!");- if (getInputShapeAtPort(TOPK_K).getRank() != 1) {- THROW_CPU_NODE_ERR("gets incorrect index vector dimension! Index vector should be 1 dimension.");- }+ CPU_NODE_ASSERT(getInputShapeAtPort(TOPK_K).getRank() == 1,+ "gets incorrect index vector dimension! Index vector should be 1 dimension.");- if (out_dims != out_idx_dims) {- THROW_CPU_NODE_ERR("gets incorrect output tensor dimension sizes!");- }+ CPU_NODE_ASSERT(out_dims == out_idx_dims, "gets incorrect output tensor dimension sizes!");if (axis < 0) {axis += in_dims_size;}- if (axis < 0 || axis >= static_cast<int>(in_dims_size)) {- THROW_CPU_NODE_ERR("gets incorrect input parameters dimensions and axis number!");- }+ CPU_NODE_ASSERT(axis >= 0 && axis < static_cast<int>(in_dims_size),+ "gets incorrect input parameters dimensions and axis number!");} else {OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}@@ -2077,24 +2069,16 @@ void TopK::preset_params() {void TopK::prepareParams() {auto dstMemPtr = getDstMemoryAtPort(TOPK_DATA);auto srcMemPtr = getSrcMemoryAtPort(TOPK_DATA);- if (!dstMemPtr || !dstMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined destination memory.");- }- if (!srcMemPtr || !srcMemPtr->isDefined()) {- THROW_CPU_NODE_ERR("has undefined input memory.");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has nullable preferable primitive descriptor");- }+ CPU_NODE_ASSERT(dstMemPtr && dstMemPtr->isDefined(), "has undefined destination memory.");+ CPU_NODE_ASSERT(srcMemPtr && srcMemPtr->isDefined(), "has undefined input memory.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor() != nullptr, "has nullable preferable primitive descriptor");src_dims = srcMemPtr->getDesc().getShape().getDims();dst_dims = dstMemPtr->getDesc().getShape().getDims();if (isDynamicNode()) {const int src_k = getSrcDataAtPortAs<int>(TOPK_K)[0];- if (static_cast<size_t>(src_k) > src_dims[axis]) {- THROW_CPU_NODE_ERR("gets top_k out of range!");- }+ CPU_NODE_ASSERT(static_cast<size_t>(src_k) <= src_dims[axis], "gets top_k out of range!");if (top_k != src_k) {top_k = src_k;}@@ -2257,7 +2241,7 @@ void TopK::execute([[maybe_unused]] const dnnl::stream& strm) {auto* out_idx_ptr = reinterpret_cast<int32_t*>(dst_idx);topk_ref(in_ptr, out_ptr, out_idx_ptr);} else {- THROW_CPU_NODE_ERR("only support plain layout on machine w/o sse42.");+ CPU_NODE_THROW("only support plain layout on machine w/o sse42.");}}}diff --git a/src/plugins/intel_cpu/src/nodes/transpose.cpp b/src/plugins/intel_cpu/src/nodes/transpose.cppindex 2ae664f25b7..4b8666fb125 100644--- a/src/plugins/intel_cpu/src/nodes/transpose.cpp+++ b/src/plugins/intel_cpu/src/nodes/transpose.cpp@@ -177,9 +177,7 @@ void Transpose::prepareParams() {auto dstDesc = dstMemPtr->getDescWithType<DnnlMemoryDesc>()->getDnnlDesc();auto srcDesc = dnnl::memory::desc(dstDesc.get_dims(), dstDesc.get_data_type(), memory::format_tag::acdb);auto result = getReorderPrim(context->getParamsCache(), getEngine(), srcDesc, dstDesc);- if (!result) {- THROW_CPU_NODE_ERR("reorder primitive descriptor was not found.");- }+ CPU_NODE_ASSERT(result, "reorder primitive descriptor was not found.");prim = result;getSelectedPrimitiveDescriptor()->setImplementationType(@@ -221,9 +219,7 @@ void Transpose::prepareParams() {auto cache = context->getParamsCache();auto result = cache->getOrCreate(transposeParams.permuteParams, builder);- if (!result.first) {- THROW_CPU_NODE_ERR("Primitive descriptor was not found.");- }+ CPU_NODE_ASSERT(result.first, "Primitive descriptor was not found.");execPtr = result.first;}@@ -235,15 +231,9 @@ void Transpose::createPrimitive() {auto dstMemPtr = getDstMemoryAtPort(0);auto srcMemPtr = getSrcMemoryAtPort(INPUT_DATA_IDX);- if (!dstMemPtr) {- THROW_CPU_NODE_ERR("Destination memory is null.");- }- if (!srcMemPtr) {- THROW_CPU_NODE_ERR("Input memory is null.");- }- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("Preferable primitive descriptor was not set.");- }+ CPU_NODE_ASSERT(dstMemPtr, "Destination memory is null.");+ CPU_NODE_ASSERT(srcMemPtr, "Input memory is null.");+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "Preferable primitive descriptor was not set.");if (getParentEdgeAt(INPUT_DATA_IDX)->getMemory().getDesc().hasLayoutType(LayoutType::ncsp) &&getChildEdgeAt(0)->getMemory().getDesc().hasLayoutType(LayoutType::ncsp) &&@@ -289,7 +279,7 @@ void Transpose::execute(const dnnl::stream& strm) {execPtr->exec({srcMemPtr}, {dstMemPtr});} else {- THROW_CPU_NODE_ERR("Primitive was not created.");+ CPU_NODE_THROW("Primitive was not created.");}}diff --git a/src/plugins/intel_cpu/src/nodes/unique.cpp b/src/plugins/intel_cpu/src/nodes/unique.cppindex fab1b441770..6d6722405fe 100644--- a/src/plugins/intel_cpu/src/nodes/unique.cpp+++ b/src/plugins/intel_cpu/src/nodes/unique.cpp@@ -60,9 +60,8 @@ Unique::Unique(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& coOPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);}- if (!one_of(op->get_input_size(), 1U, 2U) || op->get_output_size() != 4) {- THROW_CPU_NODE_ERR("has incorrect number of input/output edges.");- }+ CPU_NODE_ASSERT(one_of(op->get_input_size(), 1U, 2U) && op->get_output_size() == 4,+ "has incorrect number of input/output edges.");for (int i = 0; i < 4; i++) {definedOutputs[i] = !op->get_output_target_inputs(i).empty();@@ -75,10 +74,9 @@ Unique::Unique(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& coif (axis < 0) {axis += op->get_input_partial_shape(IN_DATA).rank().get_length();}- if (axis < 0 || axis >= op->get_input_partial_shape(IN_DATA).rank().get_length()) {- THROW_CPU_NODE_ERR("has invalid axis value: ",- ov::as_type<op::v0::Constant>(op->get_input_node_ptr(AXIS))->cast_vector<int>()[0]);- }+ CPU_NODE_ASSERT(axis >= 0 && axis < op->get_input_partial_shape(IN_DATA).rank().get_length(),+ "has invalid axis value: ",+ ov::as_type<op::v0::Constant>(op->get_input_node_ptr(AXIS))->cast_vector<int>()[0]);} else {flattened = true;}@@ -113,20 +111,14 @@ void Unique::createPrimitive() {void Unique::prepareParams() {auto dataMemPtr = getSrcMemoryAtPort(IN_DATA);- if (!dataMemPtr) {- THROW_CPU_NODE_ERR("has null input data memory.");- }+ CPU_NODE_ASSERT(dataMemPtr, "has null input data memory.");for (int i = 0; i < 4; i++) {if (definedOutputs[i]) {auto dstMemPtr = getDstMemoryAtPort(i);- if (!dstMemPtr) {- THROW_CPU_NODE_ERR("has null output memory at port ", i);- }+ CPU_NODE_ASSERT(dstMemPtr, "has null output memory at port ", i);}}- if (getSelectedPrimitiveDescriptor() == nullptr) {- THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor.");- }+ CPU_NODE_ASSERT(getSelectedPrimitiveDescriptor(), "has unidentified preferable primitive descriptor.");size_t srcLen = 1;if (flattened) {diff --git a/src/plugins/intel_cpu/src/plugin.cpp b/src/plugins/intel_cpu/src/plugin.cppindex 109e0f0cb6f..a5d20d58d3a 100644--- a/src/plugins/intel_cpu/src/plugin.cpp+++ b/src/plugins/intel_cpu/src/plugin.cpp@@ -227,18 +227,17 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<DEBUG_LOG(PrintableModel(*cloned_model, "cpu_"));- if ((cloned_model->inputs().size() != model->inputs().size()) ||- (cloned_model->outputs().size() != model->outputs().size())) {- OPENVINO_THROW("Input/output ports count mismatch between the original model and after the transformation! "- "Original model inputs count: ",- model->inputs().size(),- " after the transformations ",- cloned_model->inputs().size(),- ". Original model outputs count:",- model->inputs().size(),- " after the transformations ",- cloned_model->outputs().size());- }+ OPENVINO_ASSERT(cloned_model->inputs().size() == model->inputs().size() &&+ cloned_model->outputs().size() == model->outputs().size(),+ "Input/output ports count mismatch between the original model and after the transformation! "+ "Original model inputs count: ",+ model->inputs().size(),+ " after the transformations ",+ cloned_model->inputs().size(),+ ". Original model outputs count:",+ model->inputs().size(),+ " after the transformations ",+ cloned_model->outputs().size());// Make output ports have the same tensor names with original modelfor (size_t idx = 0; idx < cloned_model->outputs().size(); idx++) {auto new_result = cloned_model->output(idx);@@ -521,10 +520,7 @@ ov::Any Plugin::get_ro_property(const std::string& name, [[maybe_unused]] constov::SupportedOpsMap Plugin::query_model(const std::shared_ptr<const ov::Model>& model, const ov::AnyMap& config) const {WeightsSharing::Ptr fake_w_cache;- if (model == nullptr) {- OPENVINO_THROW("Only ngraph-based models are supported!");- }-+ OPENVINO_ASSERT(model, "Only ngraph-based models are supported!");Config conf = engConfig;Config::ModelType modelType = getModelType(model);conf.applyRtInfo(model);diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/color_convert.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/color_convert.cppindex a2065dca343..dd7cb219020 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/color_convert.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/color_convert.cpp@@ -27,9 +27,7 @@ namespace ov::intel_cpu::node {Result ColorConvertShapeInfer::infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,[[maybe_unused]] const std::unordered_map<size_t, MemoryPtr>& data_dependency) {const auto& dims = input_shapes.front().get();- if (dims.size() != 4) {- OPENVINO_THROW("NV12Converter node has incorrect input dimensions");- }+ OPENVINO_ASSERT(dims.size() == 4, "NV12Converter node has incorrect input dimensions");return {m_singlePlain ? std::vector<VectorDims>{{dims[ColorConvert::Converter::N_DIM],dims[ColorConvert::Converter::H_DIM] * 2 / 3,dims[ColorConvert::Converter::W_DIM],diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/eltwise.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/eltwise.cppindex da0c4461df3..6f7041bb7f2 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/eltwise.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/eltwise.cpp@@ -41,18 +41,18 @@ Result EltwiseShapeInfer::infer(const std::vector<std::reference_wrapper<const V}const auto& input_shape = input_shapes[i].get();- if (input_shape.size() > output_shape.size()) {- OPENVINO_THROW("Eltwise shape infer input and output shapes rank mismatch");- }+ OPENVINO_ASSERT(input_shape.size() <= output_shape.size(),+ "Eltwise shape infer input and output shapes rank mismatch");size_t offset = output_shape.size() - input_shape.size();for (size_t j = 0; j < input_shape.size(); ++j) {if (input_shape[j] != output_shape[offset + j]) {if (output_shape[offset + j] == 1) {output_shape[offset + j] = input_shape[j];} else {- if (input_shape[j] != 1) {- OPENVINO_THROW("Eltwise shape infer input shapes dim index: ", j, " mismatch");- }+ OPENVINO_ASSERT(input_shape[j] == 1,+ "Eltwise shape infer input shapes dim index: ",+ j,+ " mismatch");}}}diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/gather.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/gather.cppindex a3c3519f8ff..ff4aa557151 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/gather.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/gather.cpp@@ -59,9 +59,7 @@ ShapeInferPtr GatherShapeInferFactory::makeShapeInfer() const {static constexpr size_t GATHER_AXIS = 2;bool isAxisInputConst = ov::is_type<ov::op::v0::Constant>(m_op->get_input_node_ptr(GATHER_AXIS));const auto& indicesShape = m_op->get_input_partial_shape(GATHER_INDICES);- if (!indicesShape.rank().is_static()) {- OPENVINO_THROW("indicesShape do not support dynamic rank.");- }+ OPENVINO_ASSERT(indicesShape.rank().is_static(), "indicesShape do not support dynamic rank.");bool isIndicesScalar = indicesShape.rank().get_length() == 0;int axis = isAxisInputConst? ov::as_type<ov::op::v0::Constant>(m_op->get_input_node_ptr(GATHER_AXIS))->cast_vector<int>()[0]diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/matmul.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/matmul.cppindex 7b75ba82b3c..2a159cb291d 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/matmul.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/matmul.cpp@@ -59,14 +59,13 @@ Result MMShapeInfer::infer(const std::vector<std::reference_wrapper<const Vectorm_shapeY[i] = shapeA[i];continue;}- if (shapeA[i] != 1) {- OPENVINO_THROW("Incompatible MatMul batch dimension. Cant merge the first input dimension=",- shapeA[i],- " with second input dimension=",- shapeB[i],- " at index=",- i);- }+ OPENVINO_ASSERT(shapeA[i] == 1,+ "Incompatible MatMul batch dimension. Cant merge the first input dimension=",+ shapeA[i],+ " with second input dimension=",+ shapeB[i],+ " at index=",+ i);}m_shapeY[i] = shapeB[i];}diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/ngram.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/ngram.cppindex 352643886d1..9abf4b8a46b 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/ngram.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/ngram.cpp@@ -30,9 +30,7 @@ Result NgramShapeInfer::infer(const std::vector<std::reference_wrapper<const VecShapeInferPtr NgramShapeInferFactory::makeShapeInfer() const {auto ngram = ov::as_type_ptr<NgramNode>(m_op);- if (!ngram) {- OPENVINO_THROW("Wrong operation type");- }+ OPENVINO_ASSERT(ngram, "Wrong operation type");return std::make_shared<NgramShapeInfer>(ngram->get_k());}} // namespace ov::intel_cpu::nodediff --git a/src/plugins/intel_cpu/src/shape_inference/custom/one_hot.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/one_hot.cppindex fe0c0baf7f3..9cb2fef328f 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/one_hot.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/one_hot.cpp@@ -30,9 +30,7 @@ namespace ov::intel_cpu::node {Result OneHotShapeInfer::infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,const std::unordered_map<size_t, MemoryPtr>& data_dependency) {auto depth = data_dependency.at(1)->getDataAs<int32_t>()[0];- if (depth < 0) {- OPENVINO_THROW("OneHot depth value can't be negative.");- }+ OPENVINO_ASSERT(depth >= 0, "OneHot depth value can't be negative.");auto result = input_shapes.front().get();auto depth_pos = result.begin();if (!result.empty()) {@@ -45,9 +43,7 @@ Result OneHotShapeInfer::infer(const std::vector<std::reference_wrapper<const VeShapeInferPtr OneHotShapeInferFactory::makeShapeInfer() const {auto oneHot = ov::as_type_ptr<const ov::op::v1::OneHot>(m_op);- if (!oneHot) {- OPENVINO_THROW("Unexpected op type in OneHot shape inference factory: ", m_op->get_type_name());- }+ OPENVINO_ASSERT(oneHot, "Unexpected op type in OneHot shape inference factory: ", m_op->get_type_name());auto axis = oneHot->get_axis();auto dstShape = oneHot->get_output_partial_shape(0);int output_dims_size = dstShape.size();diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/priorbox.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/priorbox.cppindex d6f2f7447e1..8fbdb13b469 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/priorbox.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/priorbox.cpp@@ -38,9 +38,7 @@ Result PriorBoxShapeInfer::infer(ShapeInferPtr PriorBoxShapeInferFactory::makeShapeInfer() const {auto priorBox = ov::as_type_ptr<const ov::op::v0::PriorBox>(m_op);- if (!priorBox) {- OPENVINO_THROW("Unexpected op type in PriorBox shape inference factory: ", m_op->get_type_name());- }+ OPENVINO_ASSERT(priorBox, "Unexpected op type in PriorBox shape inference factory: ", m_op->get_type_name());const auto& attrs = priorBox->get_attrs();auto number_of_priors = ov::op::v0::PriorBox::number_of_priors(attrs);return std::make_shared<PriorBoxShapeInfer>(number_of_priors);diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/priorbox_clustered.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/priorbox_clustered.cppindex 4d0385d3238..cb55d150406 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/priorbox_clustered.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/priorbox_clustered.cpp@@ -38,9 +38,9 @@ Result PriorBoxClusteredShapeInfer::infer(ShapeInferPtr PriorBoxClusteredShapeInferFactory::makeShapeInfer() const {auto priorBox = ov::as_type_ptr<const ov::op::v0::PriorBoxClustered>(m_op);- if (!priorBox) {- OPENVINO_THROW("Unexpected op type in PriorBoxClustered shape inference factory: ", m_op->get_type_name());- }+ OPENVINO_ASSERT(priorBox,+ "Unexpected op type in PriorBoxClustered shape inference factory: ",+ m_op->get_type_name());const auto& attrs = priorBox->get_attrs();auto number_of_priors = attrs.widths.size();return std::make_shared<PriorBoxClusteredShapeInfer>(number_of_priors);diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cppindex 322eb79b404..95852a61221 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp@@ -75,12 +75,11 @@ Result ReshapeShapeInfer::infer(const std::vector<std::reference_wrapper<const V}inputProduct = std::accumulate(inputShape.begin(), inputShape.end(), 1, std::multiplies<>());outputProduct = std::accumulate(outputShape.begin(), outputShape.end(), 1, std::multiplies<>());- if (minusOneCount > 1 || inputProduct != outputProduct) {- OPENVINO_THROW("[cpu]reshape: the shape of input data ",- ov::intel_cpu::vec2str(inputShape),- " conflicts with the reshape pattern ",- ov::intel_cpu::vec2str(outPattern));- }+ OPENVINO_ASSERT(minusOneCount <= 1 && inputProduct == outputProduct,+ "[cpu]reshape: the shape of input data ",+ ov::intel_cpu::vec2str(inputShape),+ " conflicts with the reshape pattern ",+ ov::intel_cpu::vec2str(outPattern));return {{std::move(outputShape)}, ShapeInferStatus::success};}@@ -179,12 +178,11 @@ Result UnsqueezeShapeInfer::infer(const std::vector<std::reference_wrapper<const}}}- if (existError) {- OPENVINO_THROW("[cpu]unsqueeze: the shape of input data ",- ov::intel_cpu::vec2str(inputShape),- " conflicts with the unsqueeze pattern ",- ov::intel_cpu::vec2str(originOutPattern));- }+ OPENVINO_ASSERT(!existError,+ "[cpu]unsqueeze: the shape of input data ",+ ov::intel_cpu::vec2str(inputShape),+ " conflicts with the unsqueeze pattern ",+ ov::intel_cpu::vec2str(originOutPattern));return {{std::move(outputShape)}, ShapeInferStatus::success};}diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.cppindex d650ea405df..f97651e89a1 100644--- a/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.cpp@@ -48,11 +48,10 @@ Result StridedSliceShapeInfer::infer(const std::vector<std::reference_wrapper<costatic constexpr size_t STRIDE_ID = 3;const VectorDims& shapeIn = input_shapes[DATA_ID].get();const VectorDims& shapeBegin = input_shapes[BEGIN_ID].get();- if (data_dependency.at(BEGIN_ID)->getDesc().getPrecision() != ov::element::i32 ||- data_dependency.at(END_ID)->getDesc().getPrecision() != ov::element::i32 ||- data_dependency.at(STRIDE_ID)->getDesc().getPrecision() != ov::element::i32) {- OPENVINO_THROW("The data type of begin/end/stride is NOT I32, which is unexpected!");- }+ OPENVINO_ASSERT(data_dependency.at(BEGIN_ID)->getDesc().getPrecision() == ov::element::i32 &&+ data_dependency.at(END_ID)->getDesc().getPrecision() == ov::element::i32 &&+ data_dependency.at(STRIDE_ID)->getDesc().getPrecision() == ov::element::i32,+ "The data type of begin/end/stride is NOT I32, which is unexpected!");auto* beginPtr = data_dependency.at(BEGIN_ID)->getDataAs<int32_t>();auto* endPtr = data_dependency.at(END_ID)->getDataAs<int32_t>();auto* stridePtr = data_dependency.at(STRIDE_ID)->getDataAs<int32_t>();diff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cppindex 7dd9614bbbb..01c7ea288b3 100644--- a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp@@ -314,11 +314,11 @@ public:}const ov::CoordinateDiff& get_pads_begin() override {- OPENVINO_ASSERT(false, "ShapeInferBase do not support get_pads_begin() by default.");+ OPENVINO_THROW("ShapeInferBase do not support get_pads_begin() by default.");}const ov::CoordinateDiff& get_pads_end() override {- OPENVINO_ASSERT(false, "ShapeInferBase do not support get_pads_end() by default.");+ OPENVINO_THROW("ShapeInferBase do not support get_pads_end() by default.");}const std::vector<int64_t>& get_input_ranks() override {diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/power_static.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/power_static.cppindex c8d408efe41..a224a0edec4 100644--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/power_static.cpp+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/power_static.cpp@@ -30,9 +30,7 @@ ov::intel_cpu::PowerStaticNode::PowerStaticNode(const ov::Output<Node>& data,std::shared_ptr<ov::Node> ov::intel_cpu::PowerStaticNode::clone_with_new_inputs(const ov::OutputVector& new_args) const {INTERNAL_OP_SCOPE(PowerStaticNode_clone_with_new_inputs);- if (new_args.size() != 1) {- OPENVINO_THROW("Incorrect number of new arguments");- }+ OPENVINO_ASSERT(new_args.size() == 1, "Incorrect number of new arguments");return std::make_shared<ov::intel_cpu::PowerStaticNode>(new_args.at(0),this->power,diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.cppindex bffd87b3cac..663814d78c9 100644--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.cpp+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.cpp@@ -38,7 +38,7 @@ std::string ov::intel_cpu::ReadValueWithSubgraph::get_variable_id() const {void ov::intel_cpu::ReadValueWithSubgraph::set_input(const Output<Node>& value,const std::shared_ptr<op::v0::Parameter>& body_parameter) {- OPENVINO_ASSERT(body_parameter != nullptr, "Missing parameter! parameter is is nullptr!");+ OPENVINO_ASSERT(body_parameter, "Missing parameter! parameter is is nullptr!");auto param_index = m_bodies[0]->get_parameter_index(body_parameter);OPENVINO_ASSERT(param_index != -1, "Missing parameter ", body_parameter->get_friendly_name(), " for \'body\'!");@@ -48,7 +48,7 @@ void ov::intel_cpu::ReadValueWithSubgraph::set_input(const Output<Node>& value,ov::Output<ov::Node> ov::intel_cpu::ReadValueWithSubgraph::set_output(const std::shared_ptr<op::v0::Result>& body_result) {- OPENVINO_ASSERT(body_result != nullptr, "Incorrect result in \"body\"! Result cant be \'nullptr\'");+ OPENVINO_ASSERT(body_result, "Incorrect result in \"body\"! Result cant be \'nullptr\'");auto result_id = m_bodies[0]->get_result_index(body_result);OPENVINO_ASSERT(result_id != -1, "Missing result ", body_result->get_friendly_name(), "in \'body\'!");diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cppindex 88b978fd1a1..d3f8b74d90e 100644--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp@@ -194,9 +194,7 @@ ov::intel_cpu::ConvertFqRnnToQuantizedRnn::ConvertFqRnnToQuantizedRnn() {}const auto* input_scale_ptr = input_scale_constant->get_data_ptr<float>();- if (*input_scale_ptr == 0.F) {- OPENVINO_THROW("Cannot handle zero input scale");- }+ OPENVINO_ASSERT(*input_scale_ptr != 0.F, "Cannot handle zero input scale");const float input_scale = 1 / *input_scale_ptr;std::vector<float> weights_scales = weights_scale_constant->get_vector<float>();diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cppindex 08d042cabe0..c2336dfc95a 100644--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp@@ -160,10 +160,9 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() {auto aligned_a_rank = shape_a_aligned.rank();auto aligned_b_rank = shape_b_aligned.rank();- if (aligned_a_rank.is_dynamic() || aligned_b_rank.is_dynamic() || aligned_a_rank.get_length() < 2 ||- aligned_b_rank.get_length() < 2) {- OPENVINO_THROW("MatMul " + matmul->get_friendly_name() + " shapes are inconsistent.");- }+ OPENVINO_ASSERT(aligned_a_rank.is_static() && aligned_b_rank.is_static() && aligned_a_rank.get_length() >= 2 &&+ aligned_b_rank.get_length() >= 2,+ "MatMul " + matmul->get_friendly_name() + " shapes are inconsistent.");// Weights normalizationif (!matmul->get_transpose_b()) {diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/convert_to_interaction.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/convert_to_interaction.cppindex db30e316421..8138b1aea39 100644--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/convert_to_interaction.cpp+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/convert_to_interaction.cpp@@ -116,7 +116,7 @@ ov::intel_cpu::FuseFQtoInteraction::FuseFQtoInteraction() {matcher_pass_callback callback = [=](Matcher& m) {auto& pattern_to_output = m.get_pattern_value_map();auto fq_node = ov::as_type_ptr<ov::op::v0::FakeQuantize>(pattern_to_output.at(fq_m).get_node_shared_ptr());- OPENVINO_ASSERT(fq_node != nullptr, "FakeQuantize node is not found");+ OPENVINO_ASSERT(fq_node, "FakeQuantize node is not found");std::vector<float> fq_scale;fq_scale = simplifyToScale(fq_node, 0.001F);if (fq_scale.empty()) {diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/perf_count_rdtsc.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/perf_count_rdtsc.cppindex b7671673d60..b69dc1fbd43 100644--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/perf_count_rdtsc.cpp+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/perf_count_rdtsc.cpp@@ -37,7 +37,7 @@ std::shared_ptr<Node> PerfCountRdtscEnd::clone_with_new_inputs(const OutputVectostd::shared_ptr<PerfCountRdtscBegin> PerfCountRdtscEnd::get_pc_begin() {const auto& pc_begin =ov::as_type_ptr<PerfCountRdtscBegin>(get_input_source_output(get_input_size() - 1).get_node_shared_ptr());- OPENVINO_ASSERT(pc_begin != nullptr, "PerfCountRdtscEnd last input is not connected to PerfCountRdtscBegin");+ OPENVINO_ASSERT(pc_begin, "PerfCountRdtscEnd last input is not connected to PerfCountRdtscBegin");return pc_begin;}#endif // SNIPPETS_DEBUG_CAPSdiff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cppindex 0fc7eaeca37..07ae4ec0451 100644--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp@@ -55,10 +55,7 @@ bool pass::BrgemmToBrgemmCPU::run_on_model(const std::shared_ptr<ov::Model>& modconst auto node = matcher->get_match_root();const auto brgemm = ov::as_type_ptr<snippets::op::Brgemm>(node);const auto brgemm_plugin = ov::as_type_ptr<BrgemmCPU>(node);- if (!brgemm || brgemm_plugin) {- OPENVINO_THROW("BrgemmCPU cannot be in body before BrgemmToBrgemmCPU pass");- }-+ OPENVINO_ASSERT(brgemm && !brgemm_plugin, "BrgemmCPU cannot be in body before BrgemmToBrgemmCPU pass");const auto& brgemm_in0_desc = PortDescriptorUtils::get_port_descriptor_ptr(brgemm->input(0));const auto& brgemm_in1_desc = PortDescriptorUtils::get_port_descriptor_ptr(brgemm->input(1));const auto& brgemm_out_desc = PortDescriptorUtils::get_port_descriptor_ptr(brgemm->output(0));diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/fuse_brgemm_cpu_postops.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/fuse_brgemm_cpu_postops.cppindex 0ebf35976b4..10f1805345f 100644--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/fuse_brgemm_cpu_postops.cpp+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/fuse_brgemm_cpu_postops.cpp@@ -156,7 +156,7 @@ pass::FuseUnaryEltwise::FuseUnaryEltwise() {OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "ov::intel_cpu::pass::FuseUnaryEltwise")const auto& pattern_map = m.get_pattern_value_map();const auto brgemm = ov::as_type_ptr<BrgemmCPU>(pattern_map.at(m_brgemm).get_node_shared_ptr());- OPENVINO_ASSERT(brgemm != nullptr, "BrgemmCPU node is expected");+ OPENVINO_ASSERT(brgemm, "BrgemmCPU node is expected");const auto post_op = pattern_map.at(m_postop).get_node_shared_ptr();if (!can_be_fused(post_op)) {return false;@@ -328,7 +328,7 @@ pass::FuseBinaryEltwise::FuseBinaryEltwise(std::set<std::shared_ptr<ov::op::v0::}const auto brgemm = ov::as_type_ptr<BrgemmCPU>(pattern_map.at(m_brgemm).get_node_shared_ptr());- OPENVINO_ASSERT(brgemm != nullptr, "BrgemmCPU node is expected");+ OPENVINO_ASSERT(brgemm, "BrgemmCPU node is expected");const size_t OC = brgemm->get_output_partial_shape(0).rbegin()->get_length();const DnnlBlockedMemoryDesc memory_desc(ov::element::f32, Shape({1, OC}));diff --git a/src/plugins/intel_cpu/src/transformations/tpp/common/pass/brgemm_to_brgemm_tpp.cpp b/src/plugins/intel_cpu/src/transformations/tpp/common/pass/brgemm_to_brgemm_tpp.cppindex 2a585446cbf..928bd034912 100644--- a/src/plugins/intel_cpu/src/transformations/tpp/common/pass/brgemm_to_brgemm_tpp.cpp+++ b/src/plugins/intel_cpu/src/transformations/tpp/common/pass/brgemm_to_brgemm_tpp.cpp@@ -51,9 +51,8 @@ BrgemmToBrgemmTPP::BrgemmToBrgemmTPP() {OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "ov::intel_cpu::pass::BrgemmToBrgemmTPP")const auto node = m.get_match_root();const auto brgemm = ov::as_type_ptr<snippets::op::Brgemm>(node);- if (!brgemm || ov::as_type_ptr<tpp::op::BrgemmTPP>(node)) {- OPENVINO_THROW("BrgemmCPU cannot be in body before BrgemmToBrgemmTPP pass");- }+ OPENVINO_ASSERT(brgemm && !ov::is_type<tpp::op::BrgemmTPP>(node),+ "BrgemmCPU cannot be in body before BrgemmToBrgemmTPP pass");if (brgemm->is_dynamic()) {return false;diff --git a/src/plugins/intel_cpu/src/utils/blob_dump.cpp b/src/plugins/intel_cpu/src/utils/blob_dump.cppindex cf867c40819..9900e20a032 100644--- a/src/plugins/intel_cpu/src/utils/blob_dump.cpp+++ b/src/plugins/intel_cpu/src/utils/blob_dump.cpp@@ -62,9 +62,7 @@ static IEB_HEADER prepare_header(const MemoryDesc& desc) {header.precision = static_cast<char>(ov::element::Type_t(desc.getPrecision()));- if (desc.getShape().getRank() > 7) {- OPENVINO_THROW("Dumper support max 7D blobs");- }+ OPENVINO_ASSERT(desc.getShape().getRank() <= 7, "Dumper support max 7D blobs");header.ndims = desc.getShape().getRank();const auto& dims = desc.getShape().getStaticDims();@@ -78,15 +76,11 @@ static IEB_HEADER prepare_header(const MemoryDesc& desc) {}static DnnlBlockedMemoryDesc parse_header(IEB_HEADER& header) {- if (header.magic[0] != IEB_MAGIC[0] || header.magic[1] != IEB_MAGIC[1] || header.magic[2] != IEB_MAGIC[2] ||- header.magic[3] != IEB_MAGIC[3]) {- OPENVINO_THROW("Dumper cannot parse file. Wrong format.");- }-- if (header.ver[0] != 0 || header.ver[1] != 1) {- OPENVINO_THROW("Dumper cannot parse file. Unsupported IEB format version.");- }-+ OPENVINO_ASSERT(header.magic[0] == IEB_MAGIC[0] && header.magic[1] == IEB_MAGIC[1] &&+ header.magic[2] == IEB_MAGIC[2] && header.magic[3] == IEB_MAGIC[3],+ "Dumper cannot parse file. Wrong format.");+ OPENVINO_ASSERT(header.ver[0] == 0 && header.ver[1] == 1,+ "Dumper cannot parse file. Unsupported IEB format version.");const auto prc = static_cast<ov::element::Type_t>(header.precision);VectorDims dims(header.ndims);for (int i = 0; i < header.ndims; i++) {@@ -152,10 +146,7 @@ void BlobDumper::prepare_plain_data(const MemoryPtr& memory, std::vector<uint8_t}void BlobDumper::dump(std::ostream& stream) const {- if (memory == nullptr) {- OPENVINO_THROW("Dumper cannot dump. Memory is not allocated.");- }-+ OPENVINO_ASSERT(memory, "Dumper cannot dump. Memory is not allocated.");IEB_HEADER header = prepare_header(memory->getDesc());std::vector<uint8_t> data;prepare_plain_data(this->memory, data);@@ -170,10 +161,7 @@ void BlobDumper::dump(std::ostream& stream) const {}void BlobDumper::dumpAsTxt(std::ostream& stream) const {- if (memory == nullptr) {- OPENVINO_THROW("Dumper cannot dump. Memory is not allocated.");- }-+ OPENVINO_ASSERT(memory, "Dumper cannot dump. Memory is not allocated.");const auto& desc = memory->getDesc();const auto dims = desc.getShape().getStaticDims();size_t data_size = desc.getShape().getElementsCount();@@ -296,9 +284,7 @@ BlobDumper BlobDumper::read(std::istream& stream) {BlobDumper BlobDumper::read(const std::string& file_path) {std::ifstream file;file.open(file_path);- if (!file.is_open()) {- OPENVINO_THROW("Dumper cannot open file ", file_path);- }+ OPENVINO_ASSERT(file.is_open(), "Dumper cannot open file ", file_path);auto res = read(file);file.close();@@ -308,9 +294,7 @@ BlobDumper BlobDumper::read(const std::string& file_path) {void BlobDumper::dump(const std::string& dump_path) const {std::ofstream dump_file;dump_file.open(dump_path, std::ios::binary);- if (!dump_file.is_open()) {- OPENVINO_THROW("Dumper cannot create dump file ", dump_path);- }+ OPENVINO_ASSERT(dump_file.is_open(), "Dumper cannot create dump file ", dump_path);dump(dump_file);dump_file.close();@@ -319,9 +303,7 @@ void BlobDumper::dump(const std::string& dump_path) const {void BlobDumper::dumpAsTxt(const std::string& dump_path) const {std::ofstream dump_file;dump_file.open(dump_path);- if (!dump_file.is_open()) {- OPENVINO_THROW("Dumper cannot create dump file ", dump_path);- }+ OPENVINO_ASSERT(dump_file.is_open(), "Dumper cannot create dump file ", dump_path);dumpAsTxt(dump_file);dump_file.close();diff --git a/src/plugins/intel_cpu/src/utils/cpu_utils.hpp b/src/plugins/intel_cpu/src/utils/cpu_utils.hppindex e71244bbde7..57618651177 100644--- a/src/plugins/intel_cpu/src/utils/cpu_utils.hpp+++ b/src/plugins/intel_cpu/src/utils/cpu_utils.hpp@@ -152,9 +152,7 @@ inline ov::element::Type normalizeToSupportedPrecision(ov::element::Type precisi* @return aligned buffer*/inline std::vector<float> makeAlignedBuffer(size_t targetSize, const std::vector<float>& buffer, int align = -1) {- if (buffer.empty()) {- OPENVINO_THROW("Can't align buffer, because buffer is empty");- }+ OPENVINO_ASSERT(!buffer.empty(), "Can't align buffer, because buffer is empty");auto alignedBuffer = buffer;if (align == -1) {diff --git a/src/plugins/intel_cpu/src/utils/debug_caps_config.h b/src/plugins/intel_cpu/src/utils/debug_caps_config.hindex b3f0b5d4e14..310e6d006b9 100644--- a/src/plugins/intel_cpu/src/utils/debug_caps_config.h+++ b/src/plugins/intel_cpu/src/utils/debug_caps_config.h@@ -125,15 +125,13 @@ public:}}- if (failed) {- OPENVINO_THROW(- "Wrong syntax: ",- str,- "\n",- "The following space separated options are supported (option names are case insensitive):",- "\n",- getHelp());- }+ OPENVINO_ASSERT(!failed,+ "Wrong syntax: ",+ str,+ "\n",+ "The following space separated options are supported (option names are case insensitive):",+ "\n",+ getHelp());}};diff --git a/src/plugins/intel_cpu/src/utils/ngraph_utils.hpp b/src/plugins/intel_cpu/src/utils/ngraph_utils.hppindex 8dac8a95b60..5318d9800cd 100644--- a/src/plugins/intel_cpu/src/utils/ngraph_utils.hpp+++ b/src/plugins/intel_cpu/src/utils/ngraph_utils.hpp@@ -40,9 +40,7 @@ inline std::string getImplPriorityValue(const std::shared_ptr<ov::Node>& node) {template <typename T>inline std::shared_ptr<T> getNgraphOpAs(const std::shared_ptr<ov::Node>& op) {auto typedOp = ov::as_type_ptr<T>(op);- if (!typedOp) {- OPENVINO_THROW("Can't get ngraph node ", op->get_type_name(), " with name ", op->get_friendly_name());- }+ OPENVINO_ASSERT(typedOp, "Can't get ngraph node ", op->get_type_name(), " with name ", op->get_friendly_name());return typedOp;}diff --git a/src/plugins/intel_cpu/src/utils/plain_tensor.hpp b/src/plugins/intel_cpu/src/utils/plain_tensor.hppindex 39a9ecc3196..6c2427b593e 100644--- a/src/plugins/intel_cpu/src/utils/plain_tensor.hpp+++ b/src/plugins/intel_cpu/src/utils/plain_tensor.hpp@@ -372,9 +372,7 @@ struct PlainTensor {ptr = _aligned_malloc(capacity_new, 64);#elseint rc = ::posix_memalign(&ptr, 64, capacity_new);- if (rc) {- OPENVINO_ASSERT(false, "PlainTensor call posix_memalign failed: ", rc);- }+ OPENVINO_ASSERT(rc == 0, "PlainTensor call posix_memalign failed: ", rc);#endifm_ptr = std::shared_ptr<uint8_t>(static_cast<uint8_t*>(ptr), [](uint8_t* ptr) {#ifdef _WIN32diff --git a/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp b/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hppindex 6788be7288c..b6513188f18 100644--- a/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp+++ b/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp@@ -50,10 +50,9 @@ public:}}- if (unique_mem_format.size() > 1) {- OPENVINO_THROW(std::string(MemoryFormat::get_type_info_static().name) +- " no rule defined for multiple values.");- }+ OPENVINO_ASSERT(+ unique_mem_format.size() <= 1,+ std::string(MemoryFormat::get_type_info_static().name) + " no rule defined for multiple values.");std::string final_mem_format;if (unique_mem_format.size() == 1) {diff --git a/src/plugins/intel_cpu/src/utils/serialize.cpp b/src/plugins/intel_cpu/src/utils/serialize.cppindex 8f9c3a8146d..4bb1a79d2c6 100644--- a/src/plugins/intel_cpu/src/utils/serialize.cpp+++ b/src/plugins/intel_cpu/src/utils/serialize.cpp@@ -103,9 +103,7 @@ void ModelDeserializer::process_model(std::shared_ptr<ov::Model>& model,(hdr.custom_data_size == hdr.consts_offset - hdr.custom_data_offset) &&(hdr.consts_size == hdr.model_offset - hdr.consts_offset) &&((hdr.model_size = file_size - hdr.model_offset) != 0U);- if (!is_valid_model) {- OPENVINO_THROW("[CPU] Could not deserialize by device xml header.");- }+ OPENVINO_ASSERT(is_valid_model, "[CPU] Could not deserialize by device xml header.");// Read model input/output precisions.pugi::xml_document xml_in_out_doc;@@ -114,9 +112,7 @@ void ModelDeserializer::process_model(std::shared_ptr<ov::Model>& model,hdr.custom_data_size,pugi::parse_default,pugi::encoding_utf8);- if (res.status != pugi::status_ok) {- OPENVINO_THROW("[CPU] Could to deserialize custom data.");- }+ OPENVINO_ASSERT(res.status == pugi::status_ok, "[CPU] Could to deserialize custom data.");}// Map blob content@@ -168,9 +164,7 @@ void ModelDeserializer::process_model(std::shared_ptr<ov::Model>& model,(hdr.custom_data_size == hdr.consts_offset - hdr.custom_data_offset) &&(hdr.consts_size == hdr.model_offset - hdr.consts_offset) &&((hdr.model_size = file_size - hdr.model_offset) != 0U);- if (!is_valid_model) {- OPENVINO_THROW("[CPU] Could not deserialize by device xml header.");- }+ OPENVINO_ASSERT(is_valid_model, "[CPU] Could not deserialize by device xml header.");// read model input/output precisionsmodel_stream.seekg(hdr.custom_data_offset);@@ -181,9 +175,8 @@ void ModelDeserializer::process_model(std::shared_ptr<ov::Model>& model,xmlInOutString.resize(hdr.custom_data_size);model_stream.read(const_cast<char*>(xmlInOutString.c_str()), hdr.custom_data_size);auto res = xmlInOutDoc.load_string(xmlInOutString.c_str());- if (res.status != pugi::status_ok) {- OPENVINO_THROW("NetworkNotRead: The inputs and outputs information is invalid.");- }+ OPENVINO_ASSERT(res.status == pugi::status_ok,+ "NetworkNotRead: The inputs and outputs information is invalid.");}// read blob contentdiff --git a/src/plugins/intel_cpu/src/weights_cache.cpp b/src/plugins/intel_cpu/src/weights_cache.cppindex a22b3645d04..5153f08d32c 100644--- a/src/plugins/intel_cpu/src/weights_cache.cpp+++ b/src/plugins/intel_cpu/src/weights_cache.cpp@@ -78,17 +78,11 @@ WeightsSharing::SharedMemory::Ptr WeightsSharing::get(const std::string& key) costd::unique_lock<std::mutex> lock(guard);auto found = sharedWeights.find(key);- if (found == sharedWeights.end()) {- OPENVINO_THROW("Unknown shared memory with key ", key);- }+ OPENVINO_ASSERT(found != sharedWeights.end(), "Unknown shared memory with key ", key);ptr = found->second;- if (!ptr) {- OPENVINO_THROW("Unknown shared memory with key ", key);- }+ OPENVINO_ASSERT(ptr, "Unknown shared memory with key ", key);newPtr = ptr->sharedMemory.lock();- if (!newPtr) {- OPENVINO_THROW("Unknown shared memory with key ", key);- }+ OPENVINO_ASSERT(newPtr, "Unknown shared memory with key ", key);}return std::make_shared<SharedMemory>(ptr->valid.load(std::memory_order_relaxed)? std::unique_lock<std::mutex>(ptr->guard, std::defer_lock)@@ -106,17 +100,13 @@ SocketsWeights::SocketsWeights() {WeightsSharing::Ptr& SocketsWeights::operator[](int socket_id) {auto found = _cache_map.find(socket_id);- if (found == _cache_map.end()) {- OPENVINO_THROW("Unknown socket id ", socket_id);- }+ OPENVINO_ASSERT(found != _cache_map.end(), "Unknown socket id ", socket_id);return found->second;}const WeightsSharing::Ptr& SocketsWeights::operator[](int socket_id) const {auto found = _cache_map.find(socket_id);- if (found == _cache_map.end()) {- OPENVINO_THROW("Unknown socket id ", socket_id);- }+ OPENVINO_ASSERT(found != _cache_map.end(), "Unknown socket id ", socket_id);return found->second;}