Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed OV_SCOPE semantic #3692

Merged
merged 8 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ struct TestNode : public TestNodeBase {

TEST(ConditionalCompilationTests, SimpleScope) {
#define CCTests_Scope0 1

int n = 0;

// Simple scope is enabled
OV_SCOPE(CCTests, Scope0, n = 42;);
OV_SCOPE(CCTests, Scope0) {
n = 42;
}
EXPECT_EQ(n, 42);

// Simple scope is disabled
OV_SCOPE(CCTests, Scope1, n = 0;);
OV_SCOPE(CCTests, Scope1) n = 43;
EXPECT_EQ(n, 42);

#undef CCTests_Scope0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ struct TestNode : public TestNodeBase {
TEST(ConditionalCompilationTests, SimpleScopeAnalysys) {
int n = 0;

OV_SCOPE(CCTests, Scope0, n = 42;);
OV_SCOPE(CCTests, Scope0) n = 42;
EXPECT_EQ(n, 42);

OV_SCOPE(CCTests, Scope1, n = 43;);
OV_SCOPE(CCTests, Scope1) {
n = 43;
}
EXPECT_EQ(n, 43);
}

Expand Down
4 changes: 0 additions & 4 deletions ngraph/core/include/ngraph/op/topk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ namespace ngraph
const PartialShape input_partial_shape,
const int64_t k) const;
void set_axis(const Rank input_rank, const int64_t axis);

private:
bool evaluate_topk(const HostTensorVector& outputs,
const HostTensorVector& inputs) const;
};
} // namespace v1

Expand Down
23 changes: 12 additions & 11 deletions ngraph/core/src/itt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,27 @@ namespace ngraph
}

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

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

#define NGRAPH_COPY_TENSOR(region, a, ...) \
case element::Type_t::a: \
{ \
OV_SCOPE(ngraph_op, \
OV_CC_CAT3(region, _, a), \
rc = copy_tensor<element::Type_t::a>(__VA_ARGS__)); \
OV_SCOPE(ngraph_op, OV_CC_CAT3(region, _, a)) \
{ \
rc = copy_tensor<element::Type_t::a>(__VA_ARGS__); \
} \
} \
break;
break
7 changes: 4 additions & 3 deletions ngraph/core/src/op/abs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ namespace absop
bool op::Abs::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
bool rc = false;
NGRAPH_OP_SCOPE(
v0_Abs_evaluate,
rc = absop::evaluate_abs(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Abs_evaluate)
{
rc = absop::evaluate_abs(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return rc;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/acos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ namespace acosop
bool op::Acos::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
bool rc = false;
NGRAPH_OP_SCOPE(
v0_Acos_evaluate,
rc = acosop::evaluate_acos(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Acos_evaluate)
{
rc = acosop::evaluate_acos(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return rc;
}
2 changes: 1 addition & 1 deletion ngraph/core/src/op/acosh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ namespace acoshop
bool op::v3::Acosh::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
bool rc = false;
NGRAPH_OP_SCOPE(v3_Acosh_evaluate, rc = acoshop::evaluate_acosh(inputs[0], outputs[0]));
NGRAPH_OP_SCOPE(v3_Acosh_evaluate) rc = acoshop::evaluate_acosh(inputs[0], outputs[0]);
return rc;
}
6 changes: 4 additions & 2 deletions ngraph/core/src/op/add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ 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
{
bool rc = false;
NGRAPH_OP_SCOPE(v1_Add_evaluate,
rc = add::evaluate_add(inputs[0], inputs[1], outputs[0], get_autob()));
NGRAPH_OP_SCOPE(v1_Add_evaluate)
{
rc = add::evaluate_add(inputs[0], inputs[1], outputs[0], get_autob());
}
return rc;
}
6 changes: 4 additions & 2 deletions ngraph/core/src/op/and.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ bool op::v1::LogicalAnd::evaluate(const HostTensorVector& outputs,
const HostTensorVector& inputs) const
{
bool rc = false;
NGRAPH_OP_SCOPE(v1_LogicalAnd_evaluate,
rc = logand::evaluate_logand(inputs[0], inputs[1], outputs[0], get_autob()));
NGRAPH_OP_SCOPE(v1_LogicalAnd_evaluate)
{
rc = logand::evaluate_logand(inputs[0], inputs[1], outputs[0], get_autob());
}
return rc;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/asin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ namespace asinop
bool op::Asin::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
bool rc = false;
NGRAPH_OP_SCOPE(
v0_Asin_evaluate,
rc = asinop::evaluate_asin(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Asin_evaluate)
{
rc = asinop::evaluate_asin(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return rc;
}
2 changes: 1 addition & 1 deletion ngraph/core/src/op/asinh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ namespace asinhop
bool op::v3::Asinh::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
bool rc = false;
NGRAPH_OP_SCOPE(v3_Asinh_evaluate, rc = asinhop::evaluate_asinh(inputs[0], outputs[0]));
NGRAPH_OP_SCOPE(v3_Asinh_evaluate) rc = asinhop::evaluate_asinh(inputs[0], outputs[0]);
return rc;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/atan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ namespace atanop
bool op::Atan::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
bool rc = false;
NGRAPH_OP_SCOPE(
v0_Atan_evaluate,
rc = atanop::evaluate_atan(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Atan_evaluate)
{
rc = atanop::evaluate_atan(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return rc;
}
2 changes: 1 addition & 1 deletion ngraph/core/src/op/atanh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ namespace atanhop
bool op::v3::Atanh::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
bool rc = false;
NGRAPH_OP_SCOPE(v3_Atanh_evaluate, rc = atanhop::evaluate_atanh(inputs[0], outputs[0]));
NGRAPH_OP_SCOPE(v3_Atanh_evaluate) rc = atanhop::evaluate_atanh(inputs[0], outputs[0]);
return rc;
}
2 changes: 1 addition & 1 deletion ngraph/core/src/op/batch_to_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,6 @@ namespace
bool ngraph::op::v1::BatchToSpace::evaluate(const HostTensorVector& outputs,
const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(v1_BatchToSpace, return batch_to_space_evaluate(outputs, inputs));
NGRAPH_OP_SCOPE(v1_BatchToSpace) return batch_to_space_evaluate(outputs, inputs);
return false;
}
8 changes: 5 additions & 3 deletions ngraph/core/src/op/broadcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ bool op::v3::Broadcast::visit_attributes(AttributeVisitor& visitor)
bool op::v3::Broadcast::evaluate(const HostTensorVector& outputs,
const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(v3_Broadcast_evaluate, return broadcast_evaluate(outputs, inputs));
NGRAPH_OP_SCOPE(v3_Broadcast_evaluate) return broadcast_evaluate(outputs, inputs);
return false;
}

Expand Down Expand Up @@ -318,7 +318,9 @@ bool op::v1::Broadcast::visit_attributes(AttributeVisitor& visitor)
bool op::v1::Broadcast::evaluate(const HostTensorVector& outputs,
const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(v1_Broadcast_evaluate,
return op::util::BroadcastBase::evaluate(outputs, inputs));
NGRAPH_OP_SCOPE(v1_Broadcast_evaluate)
{
return op::util::BroadcastBase::evaluate(outputs, inputs);
}
return false;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/ceiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ namespace ceiling

bool op::Ceiling::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(
v0_Ceiling_evaluate,
return ceiling::evaluate_ceiling(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Ceiling_evaluate)
{
return ceiling::evaluate_ceiling(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return false;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/clamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ namespace clamp

bool op::v0::Clamp::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(
v0_Clamp_evaluate,
NGRAPH_OP_SCOPE(v0_Clamp_evaluate)
{
return clamp::evaluate_clamp(
inputs[0], outputs[0], get_min(), get_max(), shape_size(get_input_shape(0))));
inputs[0], outputs[0], get_min(), get_max(), shape_size(get_input_shape(0)));
}
return false;
}

Expand Down
9 changes: 5 additions & 4 deletions ngraph/core/src/op/concat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ namespace

bool op::Concat::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(v0_Concat_evaluate,
auto concat_axis =
get_axis() < 0 ? get_axis() + inputs[0]->get_shape().size() : get_axis();
return evaluate_concat(inputs, outputs[0], concat_axis));
NGRAPH_OP_SCOPE(v0_Concat_evaluate)
{
auto concat_axis = get_axis() < 0 ? get_axis() + inputs[0]->get_shape().size() : get_axis();
return evaluate_concat(inputs, outputs[0], concat_axis);
}
return false;
}
9 changes: 6 additions & 3 deletions ngraph/core/src/op/constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,12 @@ bool op::v0::Constant::visit_attributes(AttributeVisitor& visitor)
bool op::v0::Constant::evaluate(const HostTensorVector& outputs,
const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(v0_Constant_evaluate, auto output = outputs[0];
output->write(get_data_ptr(), output->get_size_in_bytes());
return true);
NGRAPH_OP_SCOPE(v0_Constant_evaluate)
{
auto output = outputs[0];
output->write(get_data_ptr(), output->get_size_in_bytes());
return true;
}
return false;
}

Expand Down
10 changes: 6 additions & 4 deletions ngraph/core/src/op/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ namespace convert
#define TYPE_OUT_CASE(a, ...) \
case element::Type_t::a: \
{ \
NGRAPH_OP_SCOPE(OV_CC_CAT3(evaluate_covert_out, _, a), \
rc = evaluate<INPUT_ET, element::Type_t::a>(__VA_ARGS__)); \
NGRAPH_OP_SCOPE(OV_CC_CAT3(evaluate_covert_out, _, a)) \
{ \
rc = evaluate<INPUT_ET, element::Type_t::a>(__VA_ARGS__); \
} \
} \
break

Expand Down Expand Up @@ -117,7 +119,7 @@ namespace convert
bool op::v0::Convert::evaluate(const HostTensorVector& output_values,
const HostTensorVector& input_values) const
{
NGRAPH_OP_SCOPE(v0_Convert_evaluate,
return convert::evaluate_convert(input_values[0], output_values[0]));
NGRAPH_OP_SCOPE(v0_Convert_evaluate)
return convert::evaluate_convert(input_values[0], output_values[0]);
ilyachur marked this conversation as resolved.
Show resolved Hide resolved
return false;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/cos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ namespace cosop

bool op::Cos::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(
v0_Cos_evaluate,
return cosop::evaluate_cos(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Cos_evaluate)
{
return cosop::evaluate_cos(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return false;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/cosh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ namespace coshop

bool op::Cosh::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(
v0_Cosh_evaluate,
return coshop::evaluate_cosh(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Cosh_evaluate)
{
return coshop::evaluate_cosh(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return false;
}
2 changes: 1 addition & 1 deletion ngraph/core/src/op/depth_to_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ bool op::DepthToSpace::evaluate_depth_to_space(const HostTensorVector& outputs,
bool op::DepthToSpace::evaluate(const HostTensorVector& outputs,
const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(v0_DepthToSpace_evaluate, return evaluate_depth_to_space(outputs, inputs));
NGRAPH_OP_SCOPE(v0_DepthToSpace_evaluate) return evaluate_depth_to_space(outputs, inputs);
return false;
}
namespace ngraph
Expand Down
8 changes: 5 additions & 3 deletions ngraph/core/src/op/divide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ shared_ptr<Node> op::v1::Divide::clone_with_new_inputs(const OutputVector& new_a

bool op::v1::Divide::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(v1_Divide_evaluate,
return divide::evaluate_divide(
inputs[0], inputs[1], outputs[0], get_autob(), is_pythondiv()));
NGRAPH_OP_SCOPE(v1_Divide_evaluate)
{
return divide::evaluate_divide(
inputs[0], inputs[1], outputs[0], get_autob(), is_pythondiv());
}
return false;
}
6 changes: 4 additions & 2 deletions ngraph/core/src/op/equal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ shared_ptr<Node> op::v1::Equal::clone_with_new_inputs(const OutputVector& new_ar

bool op::v1::Equal::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(v1_Equal_evaluate,
return equal::evaluate_equal(inputs[0], inputs[1], outputs[0], get_autob()));
NGRAPH_OP_SCOPE(v1_Equal_evaluate)
{
return equal::evaluate_equal(inputs[0], inputs[1], outputs[0], get_autob());
}
return false;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/erf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ namespace erfop

bool op::Erf::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(
v0_Erf_evaluate,
return erfop::evaluate_erf(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Erf_evaluate)
{
return erfop::evaluate_erf(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return false;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ namespace expop

bool op::Exp::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(
v0_Exp_evaluate,
return expop::evaluate_exp(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Exp_evaluate)
{
return expop::evaluate_exp(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return false;
}
7 changes: 4 additions & 3 deletions ngraph/core/src/op/floor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ namespace floorop

bool op::Floor::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
NGRAPH_OP_SCOPE(
v0_Floor_evaluate,
return floorop::evaluate_floor(inputs[0], outputs[0], shape_size(get_output_shape(0))));
NGRAPH_OP_SCOPE(v0_Floor_evaluate)
{
return floorop::evaluate_floor(inputs[0], outputs[0], shape_size(get_output_shape(0)));
}
return false;
}
Loading