Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[CPU] Replace custom THROW_ERROR macros usage with THROW_CPU_NODE_ERR (#28510)

Arseniy Obolenskiy3e8bc27b2260
diff --git a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp
index bf0823885eb..ed8f1776d6c 100644
--- a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp
+++ b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp
@@ -14,8 +14,6 @@
#include "openvino/opsets/opset1.hpp"
#include "utils/general_utils.h"
-#define THROW_ERROR(...) OPENVINO_THROW("DepthToSpace layer with name '", getName(), "' ", __VA_ARGS__)
-
using namespace dnnl::impl;
namespace ov {
@@ -73,11 +71,11 @@ DepthToSpace::DepthToSpace(const std::shared_ptr<ov::Node>& op, const GraphConte
OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
}
if (inputShapes.size() != 1 || outputShapes.size() != 1)
- THROW_ERROR("has incorrect number of input/output edges!");
+ THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");
auto depthToSpace = ov::as_type_ptr<const ov::opset1::DepthToSpace>(op);
if (!depthToSpace)
- THROW_ERROR("supports only opset1");
+ THROW_CPU_NODE_ERR("supports only opset1");
const auto modeNgraph = depthToSpace->get_mode();
if (modeNgraph == ov::op::v0::DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST) {
@@ -85,22 +83,22 @@ 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_ERROR("doesn't support mode: ", ov::as_string(modeNgraph));
+ THROW_CPU_NODE_ERR("doesn't support mode: ", ov::as_string(modeNgraph));
}
attrs.blockSize = depthToSpace->get_block_size();
if (attrs.blockSize == 0)
- THROW_ERROR("has incorrect block_size parameter is zero!");
+ THROW_CPU_NODE_ERR("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_ERROR("has incorrect number of input dimensions");
+ THROW_CPU_NODE_ERR("has incorrect number of input dimensions");
if (srcRank > 5)
- THROW_ERROR("doesn't support dimensions with rank greater than 5");
+ THROW_CPU_NODE_ERR("doesn't support dimensions with rank greater than 5");
if (srcRank != dstRank)
- THROW_ERROR("has incorrect number of input/output dimensions");
+ THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions");
const size_t nSpatialDims = srcRank - 2;
attrs.blockStep = static_cast<size_t>(std::pow(attrs.blockSize, nSpatialDims));
@@ -164,11 +162,11 @@ void DepthToSpace::createPrimitive() {
auto dstMemPtr = getDstMemoryAtPort(0);
auto srcMemPtr = getSrcMemoryAtPort(0);
if (!dstMemPtr)
- THROW_ERROR("has null destination memory");
+ THROW_CPU_NODE_ERR("has null destination memory");
if (!srcMemPtr)
- THROW_ERROR("has null input memory");
+ THROW_CPU_NODE_ERR("has null input memory");
if (getSelectedPrimitiveDescriptor() == nullptr)
- THROW_ERROR("has unidentified preferable primitive descriptor");
+ THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor");
const auto& memoryDesc = srcMemPtr->getDesc();
attrs.dataSize = memoryDesc.getPrecision().size();
@@ -305,7 +303,7 @@ void DepthToSpace::DepthToSpaceExecutor::exec(const MemoryPtr& srcMemPtr, const
void DepthToSpace::execute(const dnnl::stream& strm) {
if (!execPtr) {
- THROW_ERROR("doesn't have a compiled executor.");
+ THROW_CPU_NODE_ERR("doesn't have a compiled executor.");
}
int MB = getSrcMemoryAtPort(0)->getStaticDims()[0];
diff --git a/src/plugins/intel_cpu/src/nodes/eye.cpp b/src/plugins/intel_cpu/src/nodes/eye.cpp
index 873d07673c8..ef4995a87fd 100644
--- a/src/plugins/intel_cpu/src/nodes/eye.cpp
+++ b/src/plugins/intel_cpu/src/nodes/eye.cpp
@@ -12,8 +12,6 @@
#include "shape_inference/shape_inference.hpp"
#include "utils/bfloat16.hpp"
-#define THROW_ERROR(...) OPENVINO_THROW(NameFromType(getType()), " node with name '", getName(), "' ", __VA_ARGS__)
-
namespace ov {
namespace intel_cpu {
namespace node {
diff --git a/src/plugins/intel_cpu/src/nodes/gather.cpp b/src/plugins/intel_cpu/src/nodes/gather.cpp
index e72901d7d43..f349990f56f 100644
--- a/src/plugins/intel_cpu/src/nodes/gather.cpp
+++ b/src/plugins/intel_cpu/src/nodes/gather.cpp
@@ -24,8 +24,6 @@
using namespace dnnl::impl::cpu;
-#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__)
-
namespace ov {
namespace intel_cpu {
namespace node {
@@ -69,7 +67,7 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
if (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_ERROR("has incorrect number of input/output edges!");
+ THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");
}
const auto& dataShape = getInputShapeAtPort(GATHER_DATA);
@@ -80,7 +78,7 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
isIdxShapeStat = idxShape.isStatic();
const auto indicesRank = idxShape.getRank();
if (dataSrcRank == 0lu || indicesRank == 0lu)
- THROW_ERROR("has incorrect input parameters ranks.");
+ THROW_CPU_NODE_ERR("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());
@@ -104,7 +102,7 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
if (batchDims < 0)
batchDims += indicesRank;
if (batchDims < 0 || batchDims > std::min(static_cast<int>(dataSrcRank), static_cast<int>(indicesRank)))
- THROW_ERROR("has incorrect batch_dims ", batchDims, "!");
+ THROW_CPU_NODE_ERR("has incorrect batch_dims ", batchDims, "!");
if (ov::is_type<ov::op::v0::Constant>(op->get_input_node_ptr(GATHER_AXIS))) {
isAxisInputConst = true;
@@ -112,7 +110,7 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
if (axis < 0)
axis += dataSrcRank;
if (axis < 0 || axis >= dataSrcRank || batchDims > axis)
- THROW_ERROR("has incorrect input parameter axis value: ", axis);
+ THROW_CPU_NODE_ERR("has incorrect input parameter axis value: ", axis);
}
if (auto indices = ov::as_type<ov::op::v0::Constant>(op->get_input_node_ptr(GATHER_INDICES))) {
@@ -339,12 +337,12 @@ bool Gather::needPrepareParams() const {
void Gather::prepareParams() {
auto dataMemPtr = getSrcMemoryAtPort(GATHER_DATA);
if (!dataMemPtr || !dataMemPtr->isDefined())
- THROW_ERROR(" has undefined input data memory.");
+ THROW_CPU_NODE_ERR("has undefined input data memory.");
auto idxMemPtr = getSrcMemoryAtPort(GATHER_INDICES);
if (!idxMemPtr || !idxMemPtr->isDefined())
- THROW_ERROR(" has undefined input indices memory.");
+ THROW_CPU_NODE_ERR("has undefined input indices memory.");
if (getSelectedPrimitiveDescriptor() == nullptr)
- THROW_ERROR(" has unidentified preferable primitive descriptor.");
+ THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor.");
// short 1D vector fast execution impl (typical in shape infer subgraph)
canOptimize1DCase = false;
@@ -363,7 +361,7 @@ void Gather::prepareParams() {
if (axis < 0)
axis += dataSrcRank;
if (axis < 0 || axis >= dataSrcRank || batchDims > axis)
- THROW_ERROR("has incorrect input parameter axis value: ", axis);
+ THROW_CPU_NODE_ERR("has incorrect input parameter axis value: ", axis);
}
if (!isDataShapeStat || !isAxisInputConst) {
@@ -553,7 +551,7 @@ void Gather::executeDynamicImpl(const dnnl::stream& strm) {
void Gather::initShortParams(threadExecParams& p, const uint64_t start) {
if (!jitKernel)
- THROW_ERROR("has uninitialized kernel in function initShortParams.");
+ THROW_CPU_NODE_ERR("has uninitialized kernel in function initShortParams.");
const uint64_t idxElPerVec = jitKernel->getIdxElPerVec();
if (afterAxisSize == 1) { // Elementwise gather.
diff --git a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp
index 7a494d184ce..29bc32370d0 100644
--- a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp
+++ b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp
@@ -38,19 +38,19 @@ GatherElements::GatherElements(const std::shared_ptr<ov::Node>& op, const GraphC
OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
}
if (inputShapes.size() != 2 || outputShapes.size() != 1)
- THROW_CPU_NODE_ERR(" has invalid number of input/output edges.");
+ THROW_CPU_NODE_ERR("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.");
+ THROW_CPU_NODE_ERR("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);
+ THROW_CPU_NODE_ERR("has invalid axis attribute: ", axis);
axis_ = axis;
}
@@ -78,12 +78,12 @@ void GatherElements::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 'inputData' input precision: ", inDataPrecision);
+ THROW_CPU_NODE_ERR("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);
+ THROW_CPU_NODE_ERR("has unsupported 'indices' input precision: ", indicesPrecision);
}
dataTypeSize_ = inDataPrecision.size();
diff --git a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp
index 1124bec4163..8df99882adc 100644
--- a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp
+++ b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp
@@ -14,8 +14,6 @@
#include "openvino/core/parallel.hpp"
#include "utils/general_utils.h"
-#define THROW_ERROR(...) OPENVINO_THROW("GatherND layer with name '", getName(), "' ", __VA_ARGS__)
-
namespace ov {
namespace intel_cpu {
namespace node {
@@ -43,7 +41,7 @@ GatherND::GatherND(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr
}
if (inputShapes.size() != 2 && outputShapes.size() != 1)
- THROW_ERROR("has invalid number of input/output edges.");
+ THROW_CPU_NODE_ERR("has invalid number of input/output edges.");
const size_t dataInputRank = getInputShapeAtPort(GATHERND_DATA).getRank();
const size_t indicesInputRank = getInputShapeAtPort(GATHERND_INDEXES).getRank();
@@ -53,10 +51,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_ERROR("has support only opset5.");
+ THROW_CPU_NODE_ERR("has support only opset5.");
}
if (attrs.batchDims >= std::min(dataInputRank, indicesInputRank))
- THROW_ERROR("has invalid batch_dims attribute: ", attrs.batchDims);
+ THROW_CPU_NODE_ERR("has invalid batch_dims attribute: ", attrs.batchDims);
}
void GatherND::initSupportedPrimitiveDescriptors() {
@@ -68,7 +66,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_ERROR("has unsupported 'data' input precision: ", inDataPrecision);
+ THROW_CPU_NODE_ERR("has unsupported 'data' input precision: ", inDataPrecision);
}
attrs.dataSize = inDataPrecision.size();
@@ -80,7 +78,7 @@ void GatherND::initSupportedPrimitiveDescriptors() {
ov::element::u16,
ov::element::i8,
ov::element::u8)) {
- THROW_ERROR("has unsupported 'indices' input precision: ", indicesPrecision);
+ THROW_CPU_NODE_ERR("has unsupported 'indices' input precision: ", indicesPrecision);
}
addSupportedPrimDesc({{LayoutType::ncsp, inDataPrecision}, {LayoutType::ncsp, ov::element::i32}},
@@ -93,13 +91,13 @@ void GatherND::prepareParams() {
auto idxMemPtr = getSrcMemoryAtPort(GATHERND_INDEXES);
auto dstMemPtr = getDstMemoryAtPort(0);
if (!srcMemPtr || !srcMemPtr->isDefined())
- THROW_ERROR(" has undefined input memory of 'data'.");
+ THROW_CPU_NODE_ERR("has undefined input memory of 'data'.");
if (!idxMemPtr || !idxMemPtr->isDefined())
- THROW_ERROR(" has undefined input memory of 'indices'.");
+ THROW_CPU_NODE_ERR("has undefined input memory of 'indices'.");
if (!dstMemPtr || !dstMemPtr->isDefined())
- THROW_ERROR(" has undefined output memory.");
+ THROW_CPU_NODE_ERR("has undefined output memory.");
if (getSelectedPrimitiveDescriptor() == nullptr)
- THROW_ERROR(" has unidentified preferable primitive descriptor.");
+ THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor.");
attrs.srcDims = srcMemPtr->getStaticDims();
attrs.srcStrides = srcMemPtr->getDescWithType<BlockedMemoryDesc>()->getStrides();
@@ -141,7 +139,7 @@ GatherND::GatherNDExecutor::GatherNDExecutor(const GatherNDAttributes& attrs)
void GatherND::execute(const dnnl::stream& strm) {
if (!execPtr)
- THROW_ERROR("has not compiled executor.");
+ THROW_CPU_NODE_ERR("has not compiled executor.");
execPtr->exec(getSrcMemoryAtPort(GATHERND_DATA), getSrcMemoryAtPort(GATHERND_INDEXES), getDstMemoryAtPort(0));
}
diff --git a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp
index 0e25c64acfe..7a8eb108845 100644
--- a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp
+++ b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp
@@ -14,8 +14,6 @@ using namespace ov::intel_cpu::node;
using namespace dnnl::impl::cpu;
#endif // OPENVINO_ARCH_X86_64
-#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__)
-
bool GridSample::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept {
try {
if (!ov::is_type<op::v9::GridSample>(op)) {
diff --git a/src/plugins/intel_cpu/src/nodes/interaction.cpp b/src/plugins/intel_cpu/src/nodes/interaction.cpp
index 13c846da6e2..d1ffcb35467 100644
--- a/src/plugins/intel_cpu/src/nodes/interaction.cpp
+++ b/src/plugins/intel_cpu/src/nodes/interaction.cpp
@@ -28,8 +28,6 @@ namespace ov {
namespace intel_cpu {
namespace node {
-#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__)
-
#if defined(OPENVINO_ARCH_X86_64)
template <cpu_isa_t isa>
@@ -346,7 +344,7 @@ void Interaction::prepareParams() {
moveFeatureKernel->create_ker();
moveInteractKernel->create_ker();
} else {
- THROW_ERROR("cannot create jit eltwise kernel");
+ THROW_CPU_NODE_ERR("cannot create jit eltwise kernel");
}
#ifdef CPU_DEBUG_CAPS
if (prim) {
diff --git a/src/plugins/intel_cpu/src/nodes/mha.cpp b/src/plugins/intel_cpu/src/nodes/mha.cpp
index e1f4a774011..43867cd99b2 100644
--- a/src/plugins/intel_cpu/src/nodes/mha.cpp
+++ b/src/plugins/intel_cpu/src/nodes/mha.cpp
@@ -25,8 +25,6 @@ using namespace dnnl::impl::cpu::x64;
using namespace dnnl::impl::cpu::x64::matmul;
using namespace Xbyak;
-#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__)
-
namespace ov {
namespace intel_cpu {
namespace node {
@@ -879,7 +877,7 @@ void MHA::init_brgemm(brgemmCtx& ctx, std::unique_ptr<brgemm_kernel_t>& brgKerne
ctx.K,
&strides);
if (status != dnnl_success) {
- THROW_ERROR("cannot be executed due to invalid brgconv params");
+ THROW_CPU_NODE_ERR("cannot be executed due to invalid brgconv params");
}
ctx.is_with_amx = use_amx;
@@ -893,11 +891,11 @@ void MHA::init_brgemm(brgemmCtx& ctx, std::unique_ptr<brgemm_kernel_t>& brgKerne
brgemm_kernel_t* brgKernel_ = nullptr;
status = brgemm_kernel_create(&brgKernel_, brgDesc);
if (status != dnnl_success) {
- THROW_ERROR("cannot be executed due to invalid brgconv params");
+ THROW_CPU_NODE_ERR("cannot be executed due to invalid brgconv params");
}
brgKernel.reset(brgKernel_);
#else
- THROW_ERROR("is not supported on non-x86_64");
+ THROW_CPU_NODE_ERR("is not supported on non-x86_64");
#endif // OPENVINO_ARCH_X86_64
}
@@ -972,7 +970,7 @@ void MHA::init_brgemm_copy_b(std::unique_ptr<jit_brgemm_matmul_copy_b_t>& brgCop
#if defined(OPENVINO_ARCH_X86_64)
auto ret = create_brgemm_matmul_copy_b(brgCopyKernel, &brgCopyKernelConf);
if (ret != dnnl::impl::status_t::dnnl_success)
- THROW_ERROR("cannot create_brgemm_matmul_copy_b kernel, dnnl_status: ", ret);
+ THROW_CPU_NODE_ERR("cannot create_brgemm_matmul_copy_b kernel, dnnl_status: ", ret);
#endif // OPENVINO_ARCH_X86_64
}
@@ -1204,7 +1202,7 @@ void MHA::prepareParams() {
}
#endif // OPENVINO_ARCH_X86_64
if (!mulAddSoftmaxKernel) {
- THROW_ERROR("cannot create jit eltwise kernel");
+ THROW_CPU_NODE_ERR("cannot create jit eltwise kernel");
}
}
@@ -1228,7 +1226,7 @@ void MHA::prepareParams() {
}
#endif // OPENVINO_ARCH_X86_64
if (!convertReorderKernel) {
- THROW_ERROR("cannot create jit eltwise kernel");
+ THROW_CPU_NODE_ERR("cannot create jit eltwise kernel");
}
}
@@ -1255,7 +1253,7 @@ void MHA::prepareParams() {
#endif // OPENVINO_ARCH_X86_64
if (!convertTransposeKernel) {
- THROW_ERROR("cannot create jit eltwise kernel");
+ THROW_CPU_NODE_ERR("cannot create jit eltwise kernel");
}
}
@@ -1312,7 +1310,7 @@ void MHA::callBrgemm(brgemmCtx& ctx,
brgemm_kernel_execute(brgKernel.get(), 1, pin0, pin1, nullptr, pout, wsp);
}
#else
- THROW_ERROR("is not supported on non-x64 platforms");
+ THROW_CPU_NODE_ERR("is not supported on non-x64 platforms");
#endif // OPENVINO_ARCH_X86_64
}
@@ -1547,7 +1545,7 @@ void MHA::execute(const dnnl::stream& strm) {
} else if (inputPrecisions[1] == ov::element::i8) {
mhaImpl<int8_t>();
} else {
- THROW_ERROR("doesn't support provided input precisions");
+ THROW_CPU_NODE_ERR("doesn't support provided input precisions");
}
}
diff --git a/src/plugins/intel_cpu/src/nodes/normalize.cpp b/src/plugins/intel_cpu/src/nodes/normalize.cpp
index e416781cdf6..13322254ab4 100644
--- a/src/plugins/intel_cpu/src/nodes/normalize.cpp
+++ b/src/plugins/intel_cpu/src/nodes/normalize.cpp
@@ -35,7 +35,6 @@ using namespace Xbyak;
#if defined(OPENVINO_ARCH_X86_64)
# define GET_OFF(field) offsetof(jit_normalize_call_args, field)
#endif
-#define THROW_ERROR(...) OPENVINO_THROW("NormalizeL2 layer with name '", getName(), "' ", __VA_ARGS__)
namespace ov {
namespace intel_cpu {
@@ -782,10 +781,10 @@ NormalizeL2::NormalizeL2(const std::shared_ptr<ov::Node>& op, const GraphContext
}
if (inputShapes.size() != 2 || outputShapes.size() != 1)
- THROW_ERROR(" has incorrect number of input/output edges");
+ THROW_CPU_NODE_ERR("has incorrect number of input/output edges");
if (getInputShapeAtPort(DATA).getRank() > 4 || getInputShapeAtPort(DATA).getRank() < 2) {
- THROW_ERROR("has invalid input shape. Normalize supports from 2D to 4D blobs.");
+ THROW_CPU_NODE_ERR("has invalid input shape. Normalize supports from 2D to 4D blobs.");
}
auto norm = ov::as_type_ptr<const ov::op::v0::NormalizeL2>(op);
@@ -825,7 +824,7 @@ void NormalizeL2::initSupportedPrimitiveDescriptors() {
ov::element::f16,
ov::element::i8,
ov::element::u8)) {
- THROW_ERROR("has unsupported input precision: ", inputPrecision);
+ THROW_CPU_NODE_ERR("has unsupported input precision: ", inputPrecision);
}
if (!one_of(outputPrecision,
ov::element::f32,
@@ -833,7 +832,7 @@ void NormalizeL2::initSupportedPrimitiveDescriptors() {
ov::element::f16,
ov::element::i8,
ov::element::u8)) {
- THROW_ERROR("has unsupported output precision: ", outputPrecision);
+ THROW_CPU_NODE_ERR("has unsupported output precision: ", outputPrecision);
}
attrs.input_prec = inputPrecision;
@@ -914,11 +913,11 @@ void NormalizeL2::createPrimitive() {
auto dstMemPtr = getDstMemoryAtPort(DATA);
auto srcMemPtr = getSrcMemoryAtPort(DATA);
if (!dstMemPtr)
- THROW_ERROR("can't get destination memory");
+ THROW_CPU_NODE_ERR("can't get destination memory");
if (!srcMemPtr)
- THROW_ERROR("can't get input memory");
+ THROW_CPU_NODE_ERR("can't get input memory");
if (getSelectedPrimitiveDescriptor() == nullptr)
- THROW_ERROR("has nullable preferable primitive descriptor");
+ THROW_CPU_NODE_ERR("has nullable preferable primitive descriptor");
if (!attrs.cornerCase) {
if (srcMemPtr->getDesc().hasLayoutType(LayoutType::ncsp)) {
@@ -930,7 +929,7 @@ void NormalizeL2::createPrimitive() {
} else if (srcMemPtr->getDesc().hasLayoutType(LayoutType::nspc)) {
attrs.layout = LayoutType::nspc;
} else {
- THROW_ERROR("has selected layout which is not supported");
+ THROW_CPU_NODE_ERR("has selected layout which is not supported");
}
}
@@ -972,7 +971,7 @@ void NormalizeL2::executeDynamicImpl(const dnnl::stream& strm) {
void NormalizeL2::execute(const dnnl::stream& strm) {
if (!execPtr)
- THROW_ERROR("doesn't have a compiled executor.");
+ THROW_CPU_NODE_ERR("doesn't have a compiled executor.");
const uint8_t* src_ptr = getSrcDataAtPortAs<const uint8_t>(DATA);
uint8_t* dst_ptr = getDstDataAtPortAs<uint8_t>(DATA);
diff --git a/src/plugins/intel_cpu/src/nodes/priorbox.cpp b/src/plugins/intel_cpu/src/nodes/priorbox.cpp
index d1a2acd05d1..3bf6a47797e 100644
--- a/src/plugins/intel_cpu/src/nodes/priorbox.cpp
+++ b/src/plugins/intel_cpu/src/nodes/priorbox.cpp
@@ -14,8 +14,6 @@
#include "openvino/opsets/opset1.hpp"
#include "shape_inference/custom/priorbox.hpp"
-#define THROW_ERROR(...) OPENVINO_THROW("PriorBox layer with name '", getName(), "': ", __VA_ARGS__)
-
namespace ov {
namespace intel_cpu {
namespace node {
@@ -69,7 +67,7 @@ PriorBox::PriorBox(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr
exist = false;
if (std::fabs(aspect_ratio_item) < std::numeric_limits<float>::epsilon()) {
- THROW_ERROR("Aspect_ratio param can't be equal to zero");
+ THROW_CPU_NODE_ERR("has aspect_ratio param can't be equal to zero");
}
for (float _aspect_ratio : aspect_ratio) {
@@ -94,7 +92,7 @@ PriorBox::PriorBox(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr
if (attrs.variance.size() == 1 || attrs.variance.size() == 4) {
for (float i : attrs.variance) {
if (i < 0) {
- THROW_ERROR("Variance must be > 0.");
+ THROW_CPU_NODE_ERR("variance must be > 0.");
}
variance.push_back(i);
@@ -102,7 +100,7 @@ PriorBox::PriorBox(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr
} else if (attrs.variance.empty()) {
variance.push_back(0.1f);
} else {
- THROW_ERROR("Wrong number of variance values. Not less than 1 and more than 4 variance values.");
+ THROW_CPU_NODE_ERR("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/space_to_depth.cpp b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp
index 859944161d4..0384dabc63d 100644
--- a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp
+++ b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp
@@ -15,8 +15,6 @@
#include "openvino/util/pp.hpp"
#include "utils/general_utils.h"
-#define THROW_ERROR(...) OPENVINO_THROW("SpaceToDepth layer with name '", getName(), "' ", __VA_ARGS__)
-
using namespace dnnl;
using namespace dnnl::impl;
@@ -76,11 +74,11 @@ SpaceToDepth::SpaceToDepth(const std::shared_ptr<ov::Node>& op, const GraphConte
OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
}
if (inputShapes.size() != 1 || outputShapes.size() != 1)
- THROW_ERROR("has incorrect number of input/output edges!");
+ THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");
auto spaceToDepth = ov::as_type_ptr<const ov::opset1::SpaceToDepth>(op);
if (!spaceToDepth)
- THROW_ERROR("supports only opset1");
+ THROW_CPU_NODE_ERR("supports only opset1");
const auto modeNgraph = spaceToDepth->get_mode();
if (modeNgraph == ov::op::v0::SpaceToDepth::SpaceToDepthMode::BLOCKS_FIRST) {
@@ -88,21 +86,21 @@ 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_ERROR("doesn't support mode: ", ov::as_string(modeNgraph));
+ THROW_CPU_NODE_ERR("doesn't support mode: ", ov::as_string(modeNgraph));
}
attrs.blockSize = spaceToDepth->get_block_size();
if (attrs.blockSize == 0)
- THROW_ERROR("has incorrect block_size parameter is zero!");
+ THROW_CPU_NODE_ERR("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_ERROR("has incorrect number of input dimensions");
+ THROW_CPU_NODE_ERR("has incorrect number of input dimensions");
if (srcRank > 5)
- THROW_ERROR("doesn't support dimensions with rank greater than 5");
+ THROW_CPU_NODE_ERR("doesn't support dimensions with rank greater than 5");
if (srcRank != dstRank)
- THROW_ERROR("has incorrect number of input/output dimensions");
+ THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions");
attrs.nSpatialDims = srcRank - 2;
attrs.blockStep = static_cast<size_t>(std::pow(attrs.blockSize, attrs.nSpatialDims));
}
@@ -164,11 +162,11 @@ void SpaceToDepth::createPrimitive() {
auto dstMemPtr = getDstMemoryAtPort(0);
auto srcMemPtr = getSrcMemoryAtPort(0);
if (!dstMemPtr)
- THROW_ERROR("has null destination memory");
+ THROW_CPU_NODE_ERR("has null destination memory");
if (!srcMemPtr)
- THROW_ERROR("has null input memory");
+ THROW_CPU_NODE_ERR("has null input memory");
if (getSelectedPrimitiveDescriptor() == nullptr)
- THROW_ERROR("has unidentified preferable primitive descriptor");
+ THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor");
const auto& memoryDesc = srcMemPtr->getDesc();
attrs.dataSize = memoryDesc.getPrecision().size();
@@ -301,7 +299,7 @@ void SpaceToDepth::SpaceToDepthExecutor::exec(const uint8_t* srcData, uint8_t* d
void SpaceToDepth::execute(const dnnl::stream& strm) {
if (!execPtr) {
- THROW_ERROR("doesn't have a compiled executor.");
+ THROW_CPU_NODE_ERR("doesn't have a compiled executor.");
}
const uint8_t* srcData = getSrcDataAtPortAs<const uint8_t>(0);
uint8_t* dstData = getDstDataAtPortAs<uint8_t>(0);
diff --git a/src/plugins/intel_cpu/src/nodes/split.cpp b/src/plugins/intel_cpu/src/nodes/split.cpp
index 59ab2776ba8..af8295cbe98 100644
--- a/src/plugins/intel_cpu/src/nodes/split.cpp
+++ b/src/plugins/intel_cpu/src/nodes/split.cpp
@@ -19,8 +19,6 @@
#include "utils/general_utils.h"
#include "utils/ngraph_utils.hpp"
-#define THROW_ERROR(...) OPENVINO_THROW("Split layer with name '", getName(), "' ", __VA_ARGS__)
-
using namespace dnnl;
namespace ov {
@@ -74,7 +72,7 @@ Split::Split(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& cont
axis += inRank;
}
if (axis >= static_cast<int64_t>(inRank)) {
- THROW_ERROR("Split node with name '", op->get_friendly_name(), "' has invalid value of axis parameter: ", axis);
+ THROW_CPU_NODE_ERR("has invalid value of axis parameter: ", axis);
}
this->axis = axis;
}
@@ -92,14 +90,14 @@ void Split::initSupportedPrimitiveDescriptors() {
for (size_t i = 0; i < outputShapes.size(); i++) {
const auto& o_Dims = outputShapes[i].getDims();
if (dstFirstDims.size() != o_Dims.size()) {
- THROW_ERROR("only supports output blobs with equal number of dimensions");
+ THROW_CPU_NODE_ERR("only supports output blobs with equal number of dimensions");
}
for (size_t j = 0; j < dstFirstDims.size(); j++) {
if (j == axis)
continue;
if (!dimsEqualWeak(o_Dims[j], dstFirstDims[j]))
- THROW_ERROR("has incorrect output dimensions");
+ THROW_CPU_NODE_ERR("has incorrect output dimensions");
}
}
@@ -256,7 +254,7 @@ void Split::createPrimitive() {
void Split::prepareParams() {
const auto& srcMemPtr = getSrcMemoryAtPort(0);
if (!srcMemPtr || !srcMemPtr->isDefined()) {
- THROW_ERROR("has undefined input memory");
+ THROW_CPU_NODE_ERR("has undefined input memory");
}
if (!constSplitLengths) {
@@ -271,7 +269,7 @@ void Split::prepareParams() {
for (size_t port = 0; port < outputShapes.size(); ++port) {
const auto& outMemPtr = this->getDstMemoryAtPort(port);
if (!outMemPtr || !outMemPtr->isDefined()) {
- THROW_ERROR("has undefined destination memory");
+ THROW_CPU_NODE_ERR("has undefined destination memory");
}
if (outMemPtr->getShape().hasZeroDims()) {
@@ -301,7 +299,7 @@ void Split::execute(const dnnl::stream& strm) {
}
if (dstMemPtrs.empty())
- THROW_ERROR("Output data pointers have not been initialized.");
+ THROW_CPU_NODE_ERR("Output data pointers have not been initialized.");
const auto& srcMem = getParentEdgeAt(0)->getMemory();
@@ -323,7 +321,7 @@ void Split::initOptimalPrimitiveDescriptor() {
Node::initOptimalPrimitiveDescriptor();
auto selected_pd = getSelectedPrimitiveDescriptor();
if (selected_pd == nullptr)
- THROW_ERROR("Preferable primitive descriptor is not set.");
+ THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set.");
auto config = selected_pd->getConfig();
canUseOptimizedNspc2Ncsp = false;
@@ -487,7 +485,7 @@ std::vector<uint8_t*> Split::getRawDstMemPtrs() const {
for (size_t i = 0; i < dstMemPtrs.size(); ++i) {
result[i] = dstMemPtrs[i].second->getDataAs<uint8_t>();
if (!result[i]) {
- THROW_ERROR("can't get child edge indx ", dstMemPtrs[i].first, " data.");
+ THROW_CPU_NODE_ERR("can't get child edge indx ", dstMemPtrs[i].first, " data.");
}
}
return result;
diff --git a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp
index fbd6361eca5..cffde3a81d2 100644
--- a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp
+++ b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp
@@ -25,8 +25,6 @@ namespace ov {
namespace intel_cpu {
namespace node {
-#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " layer with name '", getName(), "' ", __VA_ARGS__)
-
static NodeConfig make_plain_config(const std::shared_ptr<ov::Node>& op) {
NodeConfig config;
@@ -435,7 +433,7 @@ TensorIterator::TensorIterator(const std::shared_ptr<ov::Node>& op, const GraphC
void TensorIterator::getSupportedDescriptors() {
auto tiOp = ov::as_type_ptr<const ov::op::util::SubGraphOp>(ngraphOp);
if (!tiOp) {
- THROW_ERROR("cannot be cast to ov::op::util::SubGraphOp");
+ THROW_CPU_NODE_ERR("cannot be cast to ov::op::util::SubGraphOp");
}
const std::shared_ptr<const ov::Model> body = tiOp->get_function();
sub_graph.CreateGraph(body, context);
@@ -519,7 +517,7 @@ void TensorIterator::getSupportedDescriptors() {
-1,
1});
} else {
- THROW_ERROR("has incorrect type of the input description.");
+ THROW_CPU_NODE_ERR("has incorrect type of the input description.");
}
}
@@ -537,7 +535,7 @@ void TensorIterator::getSupportedDescriptors() {
} else if (auto ti = ov::as_type_ptr<const ov::op::v0::TensorIterator>(ngraphOp)) {
algorithm = Algorithm::TensorIteratorCommon;
} else {
- THROW_ERROR("isn't supported!");
+ THROW_CPU_NODE_ERR("isn't supported!");
}
}
@@ -894,11 +892,11 @@ 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_ERROR(": Invalid \"axis\" value in an iteration component: ",
- rule.axis,
- ", dimensions number = ",
- dimensions.size(),
- " (out of range)");
+ THROW_CPU_NODE_ERR(": Invalid \"axis\" value in an iteration component: ",
+ rule.axis,
+ ", dimensions number = ",
+ dimensions.size(),
+ " (out of range)");
}
const auto space = dimensions[axis];
const int start = static_cast<int>((rule.start < 0 ? (space + 1) : 0) + rule.start);
@@ -906,7 +904,9 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,
const auto stride = rule.stride;
if (stride == 0) {
- THROW_ERROR(": Invalid \"stride\" value in an iteration component: ", rule.stride, " (infinite loop)");
+ THROW_CPU_NODE_ERR(": Invalid \"stride\" value in an iteration component: ",
+ rule.stride,
+ " (infinite loop)");
}
const auto step = std::abs(stride);
@@ -914,21 +914,21 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,
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_ERROR(": Invalid \"start\",\"stride\",\"end\" values in an iteration component",
- ": \"start\" = ",
- rule.start,
- ", \"stride\" = ",
- rule.stride,
- ", \"end\" = ",
- rule.end);
+ 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_ERROR(": Each iteration must be the same size: length (",
- length,
- ") is not divisible by step (",
- step,
- ")");
+ THROW_CPU_NODE_ERR(": Each iteration must be the same size: length (",
+ length,
+ ") is not divisible by step (",
+ step,
+ ")");
}
return static_cast<int>(length / step);
@@ -943,11 +943,11 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,
}
if (rule.from < 0 || rule.from >= static_cast<int64_t>(inputShapes.size())) {
- THROW_ERROR(": Invalid \"from\" value: \"from\" = ",
- rule.from,
- " inputs number = ",
- inputShapes.size(),
- " (out of range)");
+ THROW_CPU_NODE_ERR(": Invalid \"from\" value: \"from\" = ",
+ rule.from,
+ " inputs number = ",
+ inputShapes.size(),
+ " (out of range)");
}
const auto currentNumIterations = getNumIterations(rule, dims);
@@ -955,10 +955,10 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,
isDefault = false;
numIterations = currentNumIterations;
} else if (numIterations != currentNumIterations) {
- THROW_ERROR(": There are at least two different iterations numbers: ",
- numIterations,
- " and ",
- currentNumIterations);
+ THROW_CPU_NODE_ERR(": There are at least two different iterations numbers: ",
+ numIterations,
+ " and ",
+ currentNumIterations);
}
}
@@ -972,11 +972,11 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,
continue;
if (rule.from < 0 || rule.from >= static_cast<int64_t>(outputShapes.size())) {
- THROW_ERROR(": Invalid \"from\" value: \"from\" = ",
- rule.from,
- " inputs number = ",
- outputShapes.size(),
- " (out of range)");
+ THROW_CPU_NODE_ERR(": Invalid \"from\" value: \"from\" = ",
+ rule.from,
+ " inputs number = ",
+ outputShapes.size(),
+ " (out of range)");
}
const auto currentNumIterations = getNumIterations(rule, dims);
@@ -984,10 +984,10 @@ int TensorIterator::getNumIteration(const std::vector<PortMap>& inputPortMap,
isDefault = false;
numIterations = currentNumIterations;
} else if (numIterations != currentNumIterations) {
- THROW_ERROR(": There are at least two different iterations numbers: ",
- numIterations,
- " and ",
- currentNumIterations);
+ THROW_CPU_NODE_ERR(": There are at least two different iterations numbers: ",
+ numIterations,
+ " and ",
+ currentNumIterations);
}
}
diff --git a/src/plugins/intel_cpu/src/nodes/unique.cpp b/src/plugins/intel_cpu/src/nodes/unique.cpp
index 391e1967a8c..5a5888090ef 100644
--- a/src/plugins/intel_cpu/src/nodes/unique.cpp
+++ b/src/plugins/intel_cpu/src/nodes/unique.cpp
@@ -14,8 +14,6 @@
using namespace ov::intel_cpu;
using namespace ov::intel_cpu::node;
-#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__)
-
bool Unique::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept {
try {
if (!ov::is_type<op::v10::Unique>(op)) {
@@ -41,7 +39,7 @@ Unique::Unique(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
}
if (!one_of(op->get_input_size(), 1u, 2u) || op->get_output_size() != 4)
- THROW_ERROR("has incorrect number of input/output edges.");
+ THROW_CPU_NODE_ERR("has incorrect number of input/output edges.");
for (int i = 0; i < 4; i++) {
definedOutputs[i] = !op->get_output_target_inputs(i).empty();
@@ -55,8 +53,8 @@ Unique::Unique(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
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_ERROR("has invalid axis value: ",
- ov::as_type<op::v0::Constant>(op->get_input_node_ptr(AXIS))->cast_vector<int>()[0]);
+ THROW_CPU_NODE_ERR("has invalid axis value: ",
+ ov::as_type<op::v0::Constant>(op->get_input_node_ptr(AXIS))->cast_vector<int>()[0]);
}
} else {
flattened = true;
@@ -93,18 +91,18 @@ void Unique::createPrimitive() {
void Unique::prepareParams() {
auto dataMemPtr = getSrcMemoryAtPort(IN_DATA);
if (!dataMemPtr) {
- THROW_ERROR(" has null input data memory.");
+ THROW_CPU_NODE_ERR("has null input data memory.");
}
for (int i = 0; i < 4; i++) {
if (definedOutputs[i]) {
auto dstMemPtr = getDstMemoryAtPort(i);
if (!dstMemPtr) {
- THROW_ERROR(" has null output memory at port ", i);
+ THROW_CPU_NODE_ERR("has null output memory at port ", i);
}
}
}
if (getSelectedPrimitiveDescriptor() == nullptr) {
- THROW_ERROR(" has unidentified preferable primitive descriptor.");
+ THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor.");
}
size_t srcLen = 1;