Skip to content

Commit

Permalink
Add CC to evaluate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyachur committed Dec 18, 2020
1 parent eb975f6 commit 6564278
Show file tree
Hide file tree
Showing 97 changed files with 2,029 additions and 2,497 deletions.
12 changes: 6 additions & 6 deletions ngraph/core/src/itt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,32 @@ namespace ngraph
{
OV_ITT_DOMAIN(nGraph);
OV_ITT_DOMAIN(nGraphPass_LT);
OV_ITT_DOMAIN(nGraphOp, "nGraph::Op");
OV_ITT_DOMAIN(ngraph_op, "nGraph::Op");
}
}
OV_CC_DOMAINS(nGraphOp);
OV_CC_DOMAINS(ngraph_op);
}

#if defined(SELECTIVE_BUILD) || defined(SELECTIVE_BUILD_ANALYZER)
#define NGRAPH_OP_SCOPE(region, ...) OV_SCOPE(nGraphOp, region, __VA_ARGS__)
#define NGRAPH_OP_SCOPE(region, ...) OV_SCOPE(ngraph_op, region, __VA_ARGS__)
#else
#define NGRAPH_OP_SCOPE(region, ...) \
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, region); \
OV_ITT_SCOPED_TASK(itt::domains::ngraph_op, #region); \
__VA_ARGS__
#endif

#define NGRAPH_TYPE_CASE(region, a, ...) \
case element::Type_t::a: \
{ \
OV_SCOPE( \
nGraphOp, OV_CC_CAT3(region, _, a), rc = evaluate<element::Type_t::a>(__VA_ARGS__)); \
ngraph_op, OV_CC_CAT3(region, _, a), rc = evaluate<element::Type_t::a>(__VA_ARGS__)); \
} \
break;

#define NGRAPH_COPY_TENSOR(region, a, ...) \
case element::Type_t::a: \
{ \
OV_SCOPE(nGraphOp, \
OV_SCOPE(ngraph_op, \
OV_CC_CAT3(region, _, a), \
rc = copy_tensor<element::Type_t::a>(__VA_ARGS__)); \
} \
Expand Down
31 changes: 13 additions & 18 deletions ngraph/core/src/op/abs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,14 @@ namespace absop

switch (arg0->get_element_type())
{
TYPE_CASE(boolean)(arg0, out, count);
break;
TYPE_CASE(i32)(arg0, out, count);
break;
TYPE_CASE(i64)(arg0, out, count);
break;
TYPE_CASE(u32)(arg0, out, count);
break;
TYPE_CASE(u64)(arg0, out, count);
break;
TYPE_CASE(f16)(arg0, out, count);
break;
TYPE_CASE(f32)(arg0, out, count);
break;
TYPE_CASE(bf16)(arg0, out, count);
break;
NGRAPH_TYPE_CASE(evaluate_abs, boolean, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_abs, i32, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_abs, i64, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_abs, u32, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_abs, u64, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_abs, f16, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_abs, f32, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_abs, bf16, arg0, out, count);
default: rc = false; break;
}
return rc;
Expand All @@ -81,6 +73,9 @@ namespace absop

bool op::Abs::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::Abs::evaluate");
return absop::evaluate_abs(inputs[0], outputs[0], shape_size(get_output_shape(0)));
bool rc = false;
NGRAPH_OP_SCOPE(
Abs_evaluate,
rc = absop::evaluate_abs(inputs[0], outputs[0], shape_size(get_output_shape(0))));
return rc;
}
28 changes: 12 additions & 16 deletions ngraph/core/src/op/acos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,13 @@ namespace acosop

switch (arg0->get_element_type())
{
TYPE_CASE(boolean)(arg0, out, count);
break;
TYPE_CASE(i32)(arg0, out, count);
break;
TYPE_CASE(i64)(arg0, out, count);
break;
TYPE_CASE(u32)(arg0, out, count);
break;
TYPE_CASE(u64)(arg0, out, count);
break;
TYPE_CASE(f16)(arg0, out, count);
break;
TYPE_CASE(f32)(arg0, out, count);
break;
NGRAPH_TYPE_CASE(evaluate_acos, boolean, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_acos, i32, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_acos, i64, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_acos, u32, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_acos, u64, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_acos, f16, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_acos, f32, arg0, out, count);
default: rc = false; break;
}
return rc;
Expand All @@ -88,6 +81,9 @@ namespace acosop

bool op::Acos::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::Acos::evaluate");
return acosop::evaluate_acos(inputs[0], outputs[0], shape_size(get_output_shape(0)));
bool rc = false;
NGRAPH_OP_SCOPE(
Acos_evaluate,
rc = acosop::evaluate_acos(inputs[0], outputs[0], shape_size(get_output_shape(0))));
return rc;
}
23 changes: 9 additions & 14 deletions ngraph/core/src/op/acosh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,12 @@ namespace acoshop
out->set_unary(arg0);
switch (arg0->get_element_type())
{
TYPE_CASE(i32)(arg0, out);
break;
TYPE_CASE(i64)(arg0, out);
break;
TYPE_CASE(u32)(arg0, out);
break;
TYPE_CASE(u64)(arg0, out);
break;
TYPE_CASE(f16)(arg0, out);
break;
TYPE_CASE(f32)(arg0, out);
break;
NGRAPH_TYPE_CASE(evaluate_acosh, i32, arg0, out);
NGRAPH_TYPE_CASE(evaluate_acosh, i64, arg0, out);
NGRAPH_TYPE_CASE(evaluate_acosh, u32, arg0, out);
NGRAPH_TYPE_CASE(evaluate_acosh, u64, arg0, out);
NGRAPH_TYPE_CASE(evaluate_acosh, f16, arg0, out);
NGRAPH_TYPE_CASE(evaluate_acosh, f32, arg0, out);
default: rc = false; break;
}
return rc;
Expand All @@ -76,6 +70,7 @@ namespace acoshop

bool op::v3::Acosh::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v3::Acosh::evaluate");
return acoshop::evaluate_acosh(inputs[0], outputs[0]);
bool rc = false;
NGRAPH_OP_SCOPE(v3_Acosh_evaluate, rc = acoshop::evaluate_acosh(inputs[0], outputs[0]));
return rc;
}
41 changes: 16 additions & 25 deletions ngraph/core/src/op/add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,17 @@ namespace add
out->set_broadcast(broadcast_spec, arg0, arg1);
switch (arg0->get_element_type())
{
TYPE_CASE(i8)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(i16)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(i32)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(i64)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(u8)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(u16)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(u32)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(u64)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(bf16)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(f16)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(f32)(arg0, arg1, out, broadcast_spec);
break;
NGRAPH_TYPE_CASE(evaluate_add, i8, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, i16, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, i32, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, i64, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, u8, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, u16, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, u32, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, u64, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, bf16, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, f16, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_add, f32, arg0, arg1, out, broadcast_spec);
default: rc = false; break;
}
return rc;
Expand Down Expand Up @@ -104,6 +93,8 @@ shared_ptr<Node> op::v1::Add::clone_with_new_inputs(const OutputVector& new_args

bool op::v1::Add::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v1::Add::evaluate");
return add::evaluate_add(inputs[0], inputs[1], outputs[0], get_autob());
}
bool rc = false;
NGRAPH_OP_SCOPE(v1_Add_evaluate,
rc = add::evaluate_add(inputs[0], inputs[1], outputs[0], get_autob()));
return rc;
}
27 changes: 11 additions & 16 deletions ngraph/core/src/op/and.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,13 @@ namespace logand
out->set_broadcast(broadcast_spec, arg0, arg1);
switch (arg0->get_element_type())
{
TYPE_CASE(boolean)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(i32)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(i64)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(u32)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(u64)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(f16)(arg0, arg1, out, broadcast_spec);
break;
TYPE_CASE(f32)(arg0, arg1, out, broadcast_spec);
break;
NGRAPH_TYPE_CASE(evaluate_logand, boolean, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_logand, i32, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_logand, i64, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_logand, u32, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_logand, u64, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_logand, f16, arg0, arg1, out, broadcast_spec);
NGRAPH_TYPE_CASE(evaluate_logand, f32, arg0, arg1, out, broadcast_spec);
default: rc = false; break;
}
return rc;
Expand All @@ -93,6 +86,8 @@ namespace logand
bool op::v1::LogicalAnd::evaluate(const HostTensorVector& outputs,
const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v1::LogicalAnd::evaluate");
return logand::evaluate_logand(inputs[0], inputs[1], outputs[0], get_autob());
bool rc = false;
NGRAPH_OP_SCOPE(v1_LogicalAnd_evaluate,
rc = logand::evaluate_logand(inputs[0], inputs[1], outputs[0], get_autob()););
return rc;
}
28 changes: 12 additions & 16 deletions ngraph/core/src/op/asin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,13 @@ namespace asinop

switch (arg0->get_element_type())
{
TYPE_CASE(boolean)(arg0, out, count);
break;
TYPE_CASE(i32)(arg0, out, count);
break;
TYPE_CASE(i64)(arg0, out, count);
break;
TYPE_CASE(u32)(arg0, out, count);
break;
TYPE_CASE(u64)(arg0, out, count);
break;
TYPE_CASE(f16)(arg0, out, count);
break;
TYPE_CASE(f32)(arg0, out, count);
break;
NGRAPH_TYPE_CASE(evaluate_asin, boolean, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_asin, i32, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_asin, i64, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_asin, u32, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_asin, u64, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_asin, f16, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_asin, f32, arg0, out, count);
default: rc = false; break;
}
return rc;
Expand All @@ -89,6 +82,9 @@ namespace asinop

bool op::Asin::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::Asin::evaluate");
return asinop::evaluate_asin(inputs[0], outputs[0], shape_size(get_output_shape(0)));
bool rc = false;
NGRAPH_OP_SCOPE(
Asin_evaluate,
rc = asinop::evaluate_asin(inputs[0], outputs[0], shape_size(get_output_shape(0))));
return rc;
}
23 changes: 9 additions & 14 deletions ngraph/core/src/op/asinh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,12 @@ namespace asinhop
out->set_unary(arg0);
switch (arg0->get_element_type())
{
TYPE_CASE(i32)(arg0, out);
break;
TYPE_CASE(i64)(arg0, out);
break;
TYPE_CASE(u32)(arg0, out);
break;
TYPE_CASE(u64)(arg0, out);
break;
TYPE_CASE(f16)(arg0, out);
break;
TYPE_CASE(f32)(arg0, out);
break;
NGRAPH_TYPE_CASE(evaluate_asinh, i32, arg0, out);
NGRAPH_TYPE_CASE(evaluate_asinh, i64, arg0, out);
NGRAPH_TYPE_CASE(evaluate_asinh, u32, arg0, out);
NGRAPH_TYPE_CASE(evaluate_asinh, u64, arg0, out);
NGRAPH_TYPE_CASE(evaluate_asinh, f16, arg0, out);
NGRAPH_TYPE_CASE(evaluate_asinh, f32, arg0, out);
default: rc = false; break;
}
return rc;
Expand All @@ -76,6 +70,7 @@ namespace asinhop

bool op::v3::Asinh::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v3::Asinh::evaluate");
return asinhop::evaluate_asinh(inputs[0], outputs[0]);
bool rc = false;
NGRAPH_OP_SCOPE(v3_Asinh_evaluate, rc = asinhop::evaluate_asinh(inputs[0], outputs[0]));
return rc;
}
28 changes: 12 additions & 16 deletions ngraph/core/src/op/atan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,13 @@ namespace atanop

switch (arg0->get_element_type())
{
TYPE_CASE(boolean)(arg0, out, count);
break;
TYPE_CASE(i32)(arg0, out, count);
break;
TYPE_CASE(i64)(arg0, out, count);
break;
TYPE_CASE(u32)(arg0, out, count);
break;
TYPE_CASE(u64)(arg0, out, count);
break;
TYPE_CASE(f16)(arg0, out, count);
break;
TYPE_CASE(f32)(arg0, out, count);
break;
NGRAPH_TYPE_CASE(evaluate_atan, boolean, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_atan, i32, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_atan, i64, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_atan, u32, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_atan, u64, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_atan, f16, arg0, out, count);
NGRAPH_TYPE_CASE(evaluate_atan, f32, arg0, out, count);
default: rc = false; break;
}
return rc;
Expand All @@ -88,6 +81,9 @@ namespace atanop

bool op::Atan::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::Atan::evaluate");
return atanop::evaluate_atan(inputs[0], outputs[0], shape_size(get_output_shape(0)));
bool rc = false;
NGRAPH_OP_SCOPE(
Atan_evaluate,
rc = atanop::evaluate_atan(inputs[0], outputs[0], shape_size(get_output_shape(0))));
return rc;
}
23 changes: 9 additions & 14 deletions ngraph/core/src/op/atanh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,12 @@ namespace atanhop
out->set_unary(arg0);
switch (arg0->get_element_type())
{
TYPE_CASE(i32)(arg0, out);
break;
TYPE_CASE(i64)(arg0, out);
break;
TYPE_CASE(u32)(arg0, out);
break;
TYPE_CASE(u64)(arg0, out);
break;
TYPE_CASE(f16)(arg0, out);
break;
TYPE_CASE(f32)(arg0, out);
break;
NGRAPH_TYPE_CASE(evaluate_atanh, i32, arg0, out);
NGRAPH_TYPE_CASE(evaluate_atanh, i64, arg0, out);
NGRAPH_TYPE_CASE(evaluate_atanh, u32, arg0, out);
NGRAPH_TYPE_CASE(evaluate_atanh, u64, arg0, out);
NGRAPH_TYPE_CASE(evaluate_atanh, f16, arg0, out);
NGRAPH_TYPE_CASE(evaluate_atanh, f32, arg0, out);
default: rc = false; break;
}
return rc;
Expand All @@ -76,6 +70,7 @@ namespace atanhop

bool op::v3::Atanh::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v3::Atanh::evaluate");
return atanhop::evaluate_atanh(inputs[0], outputs[0]);
bool rc = false;
NGRAPH_OP_SCOPE(v3_Atanh_evaluate, rc = atanhop::evaluate_atanh(inputs[0], outputs[0]));
return rc;
}
Loading

0 comments on commit 6564278

Please sign in to comment.