diff --git a/src/inference/dev_api/exec_graph_info.hpp b/src/inference/dev_api/exec_graph_info.hpp index 612885eaf23..b2d47e70470 100644 --- a/src/inference/dev_api/exec_graph_info.hpp +++ b/src/inference/dev_api/exec_graph_info.hpp @@ -12,9 +12,9 @@ #include -#include "ie_api.h" #include "ie_parameter.hpp" #include "openvino/op/op.hpp" +#include "openvino/runtime/exec_model_info.hpp" /** * @brief A namespace with const values for Execution Graph parameters names. @@ -26,120 +26,14 @@ */ namespace ExecGraphInfoSerialization { -/** - * @ingroup ie_dev_exec_graph - * @brief Used to get a string of layer names separated by a comma - * from the original IR, which were fused/merged to the current executable primitive. - */ -static const char ORIGINAL_NAMES[] = "originalLayersNames"; - -/** - * @ingroup ie_dev_exec_graph - * @brief Used to get a type of the executable primitive. - */ -static const char IMPL_TYPE[] = "primitiveType"; - -/** - * @ingroup ie_dev_exec_graph - * @brief Used to get output precisions of the executable primitive. - */ -static const char OUTPUT_PRECISIONS[] = "outputPrecisions"; - -/** - * @ingroup ie_dev_exec_graph - * @brief Used to get a value of execution time of the executable primitive. - */ -static const char PERF_COUNTER[] = "execTimeMcs"; - -/** - * @ingroup ie_dev_exec_graph - * @brief Used to get output layouts of primitive. - */ -static const char OUTPUT_LAYOUTS[] = "outputLayouts"; - -/** - * @ingroup ie_dev_exec_graph - * @brief Used to get an execution order of primitive. - */ -static const char EXECUTION_ORDER[] = "execOrder"; - -/** - * @ingroup ie_dev_exec_graph - * @brief Used to get a type of primitive. - */ -static const char LAYER_TYPE[] = "layerType"; - -/** - * @ingroup ie_dev_exec_graph - * @brief Used to get runtime precision of the executable primitive. - */ -static const char RUNTIME_PRECISION[] = "runtimePrecision"; - -/** - * @ingroup ie_dev_exec_graph - * @brief The Execution node which is used to represent node in execution graph. - * - * It contains the following type of information in node runtime information: - * - ExecGraphInfoSerialization::ORIGINAL_NAMES - * - ExecGraphInfoSerialization::IMPL_TYPE - * - ExecGraphInfoSerialization::OUTPUT_PRECISIONS - * - ExecGraphInfoSerialization::PERF_COUNTER - * - ExecGraphInfoSerialization::OUTPUT_LAYOUTS - * - ExecGraphInfoSerialization::EXECUTION_ORDER - * - ExecGraphInfoSerialization::LAYER_TYPE - * - ExecGraphInfoSerialization::RUNTIME_PRECISION - */ -class INFERENCE_ENGINE_API_CLASS(ExecutionNode) : public ov::op::Op { -public: - OPENVINO_OP("ExecutionNode"); - - /** - * A default constructor with no node inputs and 0 output ports. - */ - ExecutionNode() = default; - - /** - * @brief Constructs a new execution node with a given parameters - * - * @param[in] arguments Inputs nodes - * @param[in] output_size A number of output ports - */ - ExecutionNode(const ov::OutputVector& arguments, size_t output_size = 1) : ov::op::Op() { - set_arguments(arguments); - set_output_size(output_size); - } - - /** - * @brief Creates a new execution node with the same state, but different input nodes - * - * @param[in] inputs The input nodes - * - * @return A newly created execution node - */ - std::shared_ptr clone_with_new_inputs(const ov::OutputVector& inputs) const override { - auto cloned = std::make_shared(); - - cloned->set_arguments(inputs); - - for (auto kvp : get_rt_info()) - cloned->get_rt_info()[kvp.first] = kvp.second; - - for (size_t i = 0; i < get_output_size(); ++i) - cloned->set_output_type(i, get_output_element_type(i), get_output_partial_shape(i)); - - return cloned; - } - - /** - * @brief Visits attributes of the node - * - * @param[in] visitor An attribute visitor - * - * @return Returns `true` if an operation has completed successfully - */ - bool visit_attributes(ov::AttributeVisitor& /*visitor*/) override { - return true; - } -}; +using ov::exec_model_info::EXECUTION_ORDER; +using ov::exec_model_info::ExecutionNode; +using ov::exec_model_info::IMPL_TYPE; +using ov::exec_model_info::LAYER_TYPE; +using ov::exec_model_info::ORIGINAL_NAMES; +using ov::exec_model_info::OUTPUT_LAYOUTS; +using ov::exec_model_info::OUTPUT_PRECISIONS; +using ov::exec_model_info::PERF_COUNTER; +using ov::exec_model_info::RUNTIME_PRECISION; } // namespace ExecGraphInfoSerialization diff --git a/src/inference/dev_api/openvino/runtime/exec_model_info.hpp b/src/inference/dev_api/openvino/runtime/exec_model_info.hpp new file mode 100644 index 00000000000..ec74d732095 --- /dev/null +++ b/src/inference/dev_api/openvino/runtime/exec_model_info.hpp @@ -0,0 +1,126 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/** + * @brief File provides OpenVINO Runtime Execution Model Information + * @file openvino/runtime/exec_model_info.hpp + */ + +#pragma once + +#include "openvino/op/op.hpp" +#include "openvino/runtime/common.hpp" + +/** + * @brief A namespace with const values for Execution Graph parameters names. + * @ingroup ov_dev_exec_model + * Executable Model Info is represented in ov::Model format with general ExecutionNode nodes inside + * including connections between the nodes. Each node describes an executable hardware-specific + * primitive and stores its parameters within ExecutionNode::get_rt_info map. + * There is a list of general keys for the parameters map. + */ +namespace ov { + +namespace exec_model_info { +/** + * @ingroup ov_dev_exec_model + * @brief Used to get a string of layer names separated by a comma + * from the original IR, which were fused/merged to the current executable primitive. + */ +static const char ORIGINAL_NAMES[] = "originalLayersNames"; + +/** + * @ingroup ov_dev_exec_model + * @brief Used to get a type of the executable primitive. + */ +static const char IMPL_TYPE[] = "primitiveType"; + +/** + * @ingroup ov_dev_exec_model + * @brief Used to get output precisions of the executable primitive. + */ +static const char OUTPUT_PRECISIONS[] = "outputPrecisions"; + +/** + * @ingroup ov_dev_exec_model + * @brief Used to get a value of execution time of the executable primitive. + */ +static const char PERF_COUNTER[] = "execTimeMcs"; + +/** + * @ingroup ov_dev_exec_model + * @brief Used to get output layouts of primitive. + */ +static const char OUTPUT_LAYOUTS[] = "outputLayouts"; + +/** + * @ingroup ov_dev_exec_model + * @brief Used to get an execution order of primitive. + */ +static const char EXECUTION_ORDER[] = "execOrder"; + +/** + * @ingroup ov_dev_exec_model + * @brief Used to get a type of primitive. + */ +static const char LAYER_TYPE[] = "layerType"; + +/** + * @ingroup ov_dev_exec_model + * @brief Used to get runtime precision of the executable primitive. + */ +static const char RUNTIME_PRECISION[] = "runtimePrecision"; + +/** + * @ingroup ov_dev_exec_model + * @brief The Execution node which is used to represent node in execution graph. + * + * It contains the following type of information in node runtime information: + * - ExecGraphInfoSerialization::ORIGINAL_NAMES + * - ExecGraphInfoSerialization::IMPL_TYPE + * - ExecGraphInfoSerialization::OUTPUT_PRECISIONS + * - ExecGraphInfoSerialization::PERF_COUNTER + * - ExecGraphInfoSerialization::OUTPUT_LAYOUTS + * - ExecGraphInfoSerialization::EXECUTION_ORDER + * - ExecGraphInfoSerialization::LAYER_TYPE + * - ExecGraphInfoSerialization::RUNTIME_PRECISION + */ +class OPENVINO_RUNTIME_API ExecutionNode : public ov::op::Op { +public: + OPENVINO_OP("ExecutionNode"); + + /** + * A default constructor with no node inputs and 0 output ports. + */ + ExecutionNode(); + + /** + * @brief Constructs a new execution node with a given parameters + * + * @param[in] arguments Inputs nodes + * @param[in] output_size A number of output ports + */ + ExecutionNode(const ov::OutputVector& arguments, size_t output_size = 1); + + /** + * @brief Creates a new execution node with the same state, but different input nodes + * + * @param[in] inputs The input nodes + * + * @return A newly created execution node + */ + std::shared_ptr clone_with_new_inputs(const ov::OutputVector& inputs) const override; + + /** + * @brief Visits attributes of the node + * + * @param[in] visitor An attribute visitor + * + * @return Returns `true` if an operation has completed successfully + */ + bool visit_attributes(ov::AttributeVisitor& /*visitor*/) override; +}; + +} // namespace exec_model_info +} // namespace ov diff --git a/src/inference/dev_api/openvino/runtime/iasync_infer_request.hpp b/src/inference/dev_api/openvino/runtime/iasync_infer_request.hpp index b41935e9bbf..a49c07703e0 100644 --- a/src/inference/dev_api/openvino/runtime/iasync_infer_request.hpp +++ b/src/inference/dev_api/openvino/runtime/iasync_infer_request.hpp @@ -4,7 +4,7 @@ /** * @brief OpenVINO Runtime AsyncInferRequest interface - * @file openvino/runtime/iasync_nfer_request.hpp + * @file openvino/runtime/iasync_infer_request.hpp */ #pragma once diff --git a/src/inference/dev_api/openvino/runtime/iplugin.hpp b/src/inference/dev_api/openvino/runtime/iplugin.hpp index 1c1998205ad..ee8ba7a658c 100644 --- a/src/inference/dev_api/openvino/runtime/iplugin.hpp +++ b/src/inference/dev_api/openvino/runtime/iplugin.hpp @@ -56,9 +56,8 @@ namespace ov { * @defgroup ov_dev_api_system_conf System configuration utilities * @brief API to get information about the system, core processor capabilities * - * TODO: Move execution node - * defgroup ie_dev_exec_graph Execution graph utilities - * brief Contains `ExecutionNode` and its properties + * @defgroup ov_dev_exec_model Execution model utilities + * @brief Contains `ExecutionNode` and its properties * * @defgroup ov_dev_api_error_debug Error handling and debug helpers * @brief Utility methods to works with errors or exceptional situations diff --git a/src/inference/src/dev/exec_model_info.cpp b/src/inference/src/dev/exec_model_info.cpp new file mode 100644 index 00000000000..5694f33b7a0 --- /dev/null +++ b/src/inference/src/dev/exec_model_info.cpp @@ -0,0 +1,39 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/runtime/exec_model_info.hpp" + +ov::exec_model_info::ExecutionNode::ExecutionNode() {} + +ov::exec_model_info::ExecutionNode::ExecutionNode(const ov::OutputVector& arguments, size_t output_size) + : ov::op::Op() { + set_arguments(arguments); + set_output_size(output_size); +} + +std::shared_ptr ov::exec_model_info::ExecutionNode::clone_with_new_inputs( + const ov::OutputVector& inputs) const { + auto cloned = std::make_shared(); + + cloned->set_arguments(inputs); + + for (auto kvp : get_rt_info()) + cloned->get_rt_info()[kvp.first] = kvp.second; + + for (size_t i = 0; i < get_output_size(); ++i) + cloned->set_output_type(i, get_output_element_type(i), get_output_partial_shape(i)); + + return cloned; +} + +/** + * @brief Visits attributes of the node + * + * @param[in] visitor An attribute visitor + * + * @return Returns `true` if an operation has completed successfully + */ +bool ov::exec_model_info::ExecutionNode::visit_attributes(ov::AttributeVisitor& /*visitor*/) { + return true; +}