forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexec_graph_info.hpp
145 lines (122 loc) · 4.31 KB
/
exec_graph_info.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief A file defines names to be used by plugins to create execution graph.
* It's an API between plugin and WorkBench tool.
* @file exec_graph_info.hpp
*/
#pragma once
#include <string>
#include "ie_api.h"
#include "ie_parameter.hpp"
#include "openvino/op/op.hpp"
/**
* @brief A namespace with const values for Execution Graph parameters names.
* @ingroup ie_dev_exec_graph
* Executable Graph Info is represented in CNNNetwork 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 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<ov::Node> clone_with_new_inputs(const ov::OutputVector& inputs) const override {
auto cloned = std::make_shared<ExecutionNode>();
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;
}
};
} // namespace ExecGraphInfoSerialization