Moved DEPRECATION macro and ITT domains to ov namespace (#7153)
* Moved DEPRECATION macro and ITT domains to ov namespace * Fixed code style
This commit is contained in:
parent
133b3b6468
commit
e46f6ce573
@ -4,64 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//
|
||||
// The NGRAPH_DEPRECATED macro can be used to deprecate a function declaration. For example:
|
||||
//
|
||||
// NGRAPH_DEPRECATED("replace with groxify");
|
||||
// void frobnicate()
|
||||
//
|
||||
// The macro will expand to a deprecation attribute supported by the compiler,
|
||||
// so any use of `frobnicate` will produce a compiler warning.
|
||||
//
|
||||
#include "openvino/core/deprecated.hpp"
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define NGRAPH_DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
# if __cplusplus >= 201402L
|
||||
# define NGRAPH_ENUM_DEPRECATED(msg) [[deprecated(msg)]]
|
||||
# else
|
||||
# define NGRAPH_ENUM_DEPRECATED(msg)
|
||||
# endif
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
# define NGRAPH_DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
# define NGRAPH_ENUM_DEPRECATED(msg) NGRAPH_DEPRECATED(msg)
|
||||
#elif defined(__GNUC__)
|
||||
# define NGRAPH_DEPRECATED(msg) __attribute__((deprecated((msg))))
|
||||
# if __GNUC__ < 6 && !defined(__clang__)
|
||||
# define NGRAPH_ENUM_DEPRECATED(msg)
|
||||
# else
|
||||
# define NGRAPH_ENUM_DEPRECATED(msg) NGRAPH_DEPRECATED(msg)
|
||||
# endif
|
||||
#else
|
||||
# define NGRAPH_DEPRECATED(msg)
|
||||
# define NGRAPH_ENUM_DEPRECATED(msg)
|
||||
#endif
|
||||
|
||||
// Suppress warning "-Wdeprecated-declarations" / C4996
|
||||
#if defined(_MSC_VER)
|
||||
# define NGRAPH_DO_PRAGMA(x) __pragma(x)
|
||||
#elif defined(__GNUC__)
|
||||
# define NGRAPH_DO_PRAGMA(x) _Pragma(# x)
|
||||
#else
|
||||
# define NGRAPH_DO_PRAGMA(x)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
# define NGRAPH_SUPPRESS_DEPRECATED_START \
|
||||
NGRAPH_DO_PRAGMA(warning(push)) \
|
||||
NGRAPH_DO_PRAGMA(warning(disable : 4996))
|
||||
# define NGRAPH_SUPPRESS_DEPRECATED_END NGRAPH_DO_PRAGMA(warning(pop))
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
# define NGRAPH_SUPPRESS_DEPRECATED_START \
|
||||
NGRAPH_DO_PRAGMA(warning(push)) \
|
||||
NGRAPH_DO_PRAGMA(warning(disable : 1478))
|
||||
NGRAPH_DO_PRAGMA(warning(disable : 1786))
|
||||
# define NGRAPH_SUPPRESS_DEPRECATED_END NGRAPH_DO_PRAGMA(warning(pop))
|
||||
#elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
|
||||
# define NGRAPH_SUPPRESS_DEPRECATED_START \
|
||||
NGRAPH_DO_PRAGMA(GCC diagnostic push) \
|
||||
NGRAPH_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
|
||||
# define NGRAPH_SUPPRESS_DEPRECATED_END NGRAPH_DO_PRAGMA(GCC diagnostic pop)
|
||||
#else
|
||||
# define NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
# define NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
#endif
|
||||
#define NGRAPH_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
|
||||
#define NGRAPH_ENUM_DEPRECATED(msg) OPENVINO_ENUM_DEPRECATED(msg)
|
||||
#define NGRAPH_SUPPRESS_DEPRECATED_START OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
#define NGRAPH_SUPPRESS_DEPRECATED_END OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
67
ngraph/core/include/openvino/core/deprecated.hpp
Normal file
67
ngraph/core/include/openvino/core/deprecated.hpp
Normal file
@ -0,0 +1,67 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
//
|
||||
// The OPENVINO_DEPRECATED macro can be used to deprecate a function declaration. For example:
|
||||
//
|
||||
// OPENVINO_DEPRECATED("replace with groxify");
|
||||
// void frobnicate()
|
||||
//
|
||||
// The macro will expand to a deprecation attribute supported by the compiler,
|
||||
// so any use of `frobnicate` will produce a compiler warning.
|
||||
//
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define OPENVINO_DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
# if __cplusplus >= 201402L
|
||||
# define OPENVINO_ENUM_DEPRECATED(msg) [[deprecated(msg)]]
|
||||
# else
|
||||
# define OPENVINO_ENUM_DEPRECATED(msg)
|
||||
# endif
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
|
||||
#elif defined(__GNUC__)
|
||||
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated((msg))))
|
||||
# if __GNUC__ < 6 && !defined(__clang__)
|
||||
# define OPENVINO_ENUM_DEPRECATED(msg)
|
||||
# else
|
||||
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
|
||||
# endif
|
||||
#else
|
||||
# define OPENVINO_DEPRECATED(msg)
|
||||
# define OPENVINO_ENUM_DEPRECATED(msg)
|
||||
#endif
|
||||
|
||||
// Suppress warning "-Wdeprecated-declarations" / C4996
|
||||
#if defined(_MSC_VER)
|
||||
# define OPENVINO_DO_PRAGMA(x) __pragma(x)
|
||||
#elif defined(__GNUC__)
|
||||
# define OPENVINO_DO_PRAGMA(x) _Pragma(# x)
|
||||
#else
|
||||
# define OPENVINO_DO_PRAGMA(x)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
# define OPENVINO_SUPPRESS_DEPRECATED_START \
|
||||
OPENVINO_DO_PRAGMA(warning(push)) \
|
||||
OPENVINO_DO_PRAGMA(warning(disable : 4996))
|
||||
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(warning(pop))
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
# define OPENVINO_SUPPRESS_DEPRECATED_START \
|
||||
OPENVINO_DO_PRAGMA(warning(push)) \
|
||||
OPENVINO_DO_PRAGMA(warning(disable : 1478))
|
||||
OPENVINO_DO_PRAGMA(warning(disable : 1786))
|
||||
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(warning(pop))
|
||||
#elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
|
||||
# define OPENVINO_SUPPRESS_DEPRECATED_START \
|
||||
OPENVINO_DO_PRAGMA(GCC diagnostic push) \
|
||||
OPENVINO_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
|
||||
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(GCC diagnostic pop)
|
||||
#else
|
||||
# define OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
# define OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
#endif
|
@ -26,7 +26,7 @@ constexpr DiscreteTypeInfo Function::type_info;
|
||||
atomic<size_t> Function::m_next_instance_id(0);
|
||||
|
||||
void check_all_variables_registered(const std::vector<shared_ptr<Node>>& ordered_ops, const VariableVector& variables) {
|
||||
OV_ITT_SCOPED_TASK(ngraph::itt::domains::nGraphPass_LT, "Function::check_all_variables_registered");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraphPass_LT, "Function::check_all_variables_registered");
|
||||
std::stringstream unregistered_variables;
|
||||
for (auto& node : ordered_ops) {
|
||||
const auto& variable_op = dynamic_pointer_cast<VariableExtension>(node);
|
||||
@ -40,7 +40,7 @@ void check_all_variables_registered(const std::vector<shared_ptr<Node>>& ordered
|
||||
|
||||
void check_all_parameters_registered(const std::vector<shared_ptr<Node>>& ordered_ops,
|
||||
const ParameterVector& parameters) {
|
||||
OV_ITT_SCOPED_TASK(ngraph::itt::domains::nGraph, "Function::check_all_parameters_registered");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "Function::check_all_parameters_registered");
|
||||
|
||||
std::stringstream unregistered_parameters;
|
||||
for (auto& node : ordered_ops) {
|
||||
@ -52,7 +52,7 @@ void check_all_parameters_registered(const std::vector<shared_ptr<Node>>& ordere
|
||||
}
|
||||
|
||||
VariableVector auto_detect_variables(const std::vector<std::shared_ptr<Node>>& ordered_ops) {
|
||||
OV_ITT_SCOPED_TASK(ngraph::itt::domains::nGraph, "Function::auto_detect_variables");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "Function::auto_detect_variables");
|
||||
unordered_set<VariablePtr> variables;
|
||||
for (const auto& op : ordered_ops) {
|
||||
if (const auto& variable_op = dynamic_pointer_cast<VariableExtension>(op)) {
|
||||
@ -63,7 +63,7 @@ VariableVector auto_detect_variables(const std::vector<std::shared_ptr<Node>>& o
|
||||
}
|
||||
|
||||
ParameterVector auto_detect_parameters(const std::vector<std::shared_ptr<Node>>& ordered_ops) {
|
||||
OV_ITT_SCOPED_TASK(ngraph::itt::domains::nGraph, "Function::auto_detect_parameters");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "Function::auto_detect_parameters");
|
||||
ParameterVector parameter_vector;
|
||||
for (const auto& op : ordered_ops) {
|
||||
if (const auto& param = dynamic_pointer_cast<opset7::Parameter>(op)) {
|
||||
@ -168,7 +168,7 @@ Function::Function(const OutputVector& results, const SinkVector& sinks, const s
|
||||
Function::Function(const OutputVector& results, const string& name) : Function(results, SinkVector{}, name) {}
|
||||
|
||||
void Function::prerequirements(bool detect_variables, bool detect_parameters) {
|
||||
OV_ITT_SCOPED_TASK(ngraph::itt::domains::nGraph, "Function::prerequirements");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "Function::prerequirements");
|
||||
|
||||
const auto& ordered_ops = get_ordered_ops();
|
||||
if (detect_parameters)
|
||||
@ -183,7 +183,7 @@ void Function::prerequirements(bool detect_variables, bool detect_parameters) {
|
||||
}
|
||||
|
||||
void Function::validate_nodes_and_infer_types() const {
|
||||
OV_ITT_SCOPED_TASK(ngraph::itt::domains::nGraph, "Function::validate_nodes_and_infer_types");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "Function::validate_nodes_and_infer_types");
|
||||
|
||||
struct Counter {
|
||||
int cnt_assign = 0;
|
||||
@ -223,7 +223,7 @@ void Function::validate_nodes_and_infer_types() const {
|
||||
}
|
||||
|
||||
std::vector<shared_ptr<Node>> Function::get_ordered_ops() const {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraph, "Function::get_ordered_ops");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "Function::get_ordered_ops");
|
||||
|
||||
vector<shared_ptr<Node>> nodes;
|
||||
for (auto& r : get_results()) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include <openvino/itt.hpp>
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
namespace itt {
|
||||
namespace domains {
|
||||
OV_ITT_DOMAIN(nGraph);
|
||||
@ -22,7 +22,7 @@ OV_ITT_DOMAIN(nGraphPass_LT);
|
||||
OV_ITT_DOMAIN(ngraph_op, "nGraph::Op");
|
||||
} // namespace domains
|
||||
} // namespace itt
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
OV_CC_DOMAINS(ngraph_op);
|
||||
OV_ITT_DOMAIN(SIMPLE_ngraph_pass);
|
||||
|
||||
@ -38,7 +38,7 @@ OV_ITT_DOMAIN(SIMPLE_ngraph_pass);
|
||||
throw ngraph::ngraph_error(std::string(OV_PP_TOSTRING(OV_PP_CAT3(ngraph_op, _, region))) + " is disabled!")
|
||||
# define NGRAPH_PASS_CALLBACK(matcher)
|
||||
#else
|
||||
# define NGRAPH_OP_SCOPE(region) OV_ITT_SCOPED_TASK(ngraph::itt::domains::ngraph_op, OV_PP_TOSTRING(region))
|
||||
# define NGRAPH_OP_SCOPE(region) OV_ITT_SCOPED_TASK(ov::itt::domains::ngraph_op, OV_PP_TOSTRING(region))
|
||||
# define NGRAPH_PASS_CALLBACK(matcher)
|
||||
#endif
|
||||
|
||||
|
@ -800,7 +800,7 @@ bool Node::evaluate_upper(const HostTensorVector& output_values) const {
|
||||
}
|
||||
|
||||
bool Node::constant_fold(OutputVector& output_values, const OutputVector& input_values) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraph, "Node::constant_fold");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "Node::constant_fold");
|
||||
|
||||
if (m_rt_info.count("DISABLED_CONSTANT_FOLDING")) {
|
||||
return false;
|
||||
|
@ -36,7 +36,7 @@ shared_ptr<Node> op::v1::ConvertLike::clone_with_new_inputs(const OutputVector&
|
||||
}
|
||||
|
||||
bool op::v1::ConvertLike::constant_fold(OutputVector& output_values, const OutputVector& input_values) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraph, "op::v1::ConvertLike::constant_fold");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "op::v1::ConvertLike::constant_fold");
|
||||
if (auto data_const = std::dynamic_pointer_cast<op::Constant>(input_values[0].get_node_shared_ptr())) {
|
||||
auto convert = make_shared<Convert>(input_values[0], input_values[1].get_element_type());
|
||||
convert->constant_fold(output_values, OutputVector{data_const});
|
||||
|
@ -173,7 +173,7 @@ bool op::v3::ShapeOf::evaluate_upper(const HostTensorVector& output_values) cons
|
||||
}
|
||||
|
||||
bool op::v3::ShapeOf::constant_fold(OutputVector& output_values, const OutputVector& input_values) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraph, "op::v3::ShapeOf::constant_fold");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "op::v3::ShapeOf::constant_fold");
|
||||
if (get_rt_info().count("DISABLED_CONSTANT_FOLDING"))
|
||||
return false;
|
||||
return shape_of::constant_fold_shape_of(this, output_values[0], input_values[0]);
|
||||
@ -232,7 +232,7 @@ bool op::v0::ShapeOf::has_evaluate() const {
|
||||
}
|
||||
|
||||
bool op::v0::ShapeOf::constant_fold(OutputVector& output_values, const OutputVector& input_values) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraph, "op::v0::ShapeOf::constant_fold");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "op::v0::ShapeOf::constant_fold");
|
||||
if (get_rt_info().count("DISABLED_CONSTANT_FOLDING"))
|
||||
return false;
|
||||
return shape_of::constant_fold_shape_of(this, output_values[0], input_values[0]);
|
||||
|
@ -89,7 +89,7 @@ bool pass::GraphRewrite::run_on_function(std::shared_ptr<ngraph::Function> f) {
|
||||
}
|
||||
|
||||
bool pass::GraphRewrite::apply_matcher_passes(shared_ptr<Function> f, deque<std::weak_ptr<Node>> nodes_to_run) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraph, "pass::GraphRewrite::run_on_function");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "pass::GraphRewrite::run_on_function");
|
||||
|
||||
bool rewritten = false;
|
||||
const auto& pass_config = get_pass_config();
|
||||
@ -377,7 +377,7 @@ void ngraph::pass::MatcherPass::register_matcher(const std::shared_ptr<ngraph::p
|
||||
}
|
||||
|
||||
bool ngraph::pass::MatcherPass::apply(std::shared_ptr<ngraph::Node> node) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraph, pass::internal::perf_counters_graph_rewrite()[get_type_info()]);
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, pass::internal::perf_counters_graph_rewrite()[get_type_info()]);
|
||||
m_new_nodes.clear();
|
||||
if (m_handler)
|
||||
return m_handler(node);
|
||||
|
@ -46,7 +46,7 @@ pass::Manager::~Manager() {}
|
||||
pass::Manager::Manager(std::shared_ptr<ngraph::pass::PassConfig> pass_config) : m_pass_config(std::move(pass_config)) {}
|
||||
|
||||
void pass::Manager::run_passes(shared_ptr<Function> func) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraph, "pass::Manager::run_passes");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "pass::Manager::run_passes");
|
||||
|
||||
static bool profile_enabled = getenv_bool("NGRAPH_PROFILE_PASS_ENABLE");
|
||||
|
||||
@ -62,7 +62,7 @@ void pass::Manager::run_passes(shared_ptr<Function> func) {
|
||||
}
|
||||
|
||||
OV_ITT_SCOPE(FIRST_INFERENCE,
|
||||
itt::domains::nGraphPass_LT,
|
||||
ov::itt::domains::nGraphPass_LT,
|
||||
pass::internal::perf_counters()[pass->get_type_info()]);
|
||||
|
||||
pass_timer.start();
|
||||
|
@ -18,7 +18,7 @@ std::shared_ptr<Function> ngraph::specialize_function(std::shared_ptr<Function>
|
||||
const std::vector<void*>& parameter_values)
|
||||
|
||||
{
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraph, "specialize_function");
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "specialize_function");
|
||||
|
||||
NGRAPH_CHECK(f->get_parameters().size() == parameter_shapes.size());
|
||||
NGRAPH_CHECK(f->get_parameters().size() == parameter_element_types.size());
|
||||
|
Loading…
Reference in New Issue
Block a user