@@ -38,6 +38,19 @@ class OPENVINO_RUNTIME_API IStreamsExecutor : virtual public ITaskExecutor {
38
38
*/
39
39
using Ptr = std::shared_ptr<IStreamsExecutor>;
40
40
41
+ enum MsgType{
42
+ TP,
43
+ START_INFER,
44
+ CALL_BACK
45
+ };
46
+
47
+ struct MessageInfo {
48
+ MsgType msg_type;
49
+ std::vector<int > rank;
50
+ void * buf;
51
+ Task task;
52
+ };
53
+
41
54
/* *
42
55
* @brief Defines inference thread binding type
43
56
*/
@@ -95,6 +108,7 @@ class OPENVINO_RUNTIME_API IStreamsExecutor : virtual public ITaskExecutor {
95
108
std::vector<std::vector<int >> _streams_info_table = {};
96
109
std::vector<std::vector<int >> _stream_processor_ids;
97
110
int _sub_streams = 0 ;
111
+ std::vector<int > _rank = {};
98
112
99
113
/* *
100
114
* @brief Get and reserve cpu ids based on configuration and hardware information,
@@ -124,21 +138,24 @@ class OPENVINO_RUNTIME_API IStreamsExecutor : virtual public ITaskExecutor {
124
138
* @param[in] cpu_reservation @copybrief Config::_cpu_reservation
125
139
* @param[in] cpu_pinning @copybrief Config::_cpu_pinning
126
140
* @param[in] streams_info_table @copybrief Config::_streams_info_table
141
+ * @param[in] rank @copybrief Config::_rank
127
142
*/
128
143
Config (std::string name = " StreamsExecutor" ,
129
144
int streams = 1 ,
130
145
int threads_per_stream = 0 ,
131
146
ov::hint::SchedulingCoreType thread_preferred_core_type = ov::hint::SchedulingCoreType::ANY_CORE,
132
147
bool cpu_reservation = false ,
133
148
bool cpu_pinning = false ,
134
- std::vector<std::vector<int >> streams_info_table = {})
149
+ std::vector<std::vector<int >> streams_info_table = {},
150
+ std::vector<int > rank = {})
135
151
: _name{std::move (name)},
136
152
_streams{streams},
137
153
_threads_per_stream{threads_per_stream},
138
154
_thread_preferred_core_type (thread_preferred_core_type),
139
155
_cpu_reservation{cpu_reservation},
140
156
_cpu_pinning{cpu_pinning},
141
- _streams_info_table{std::move (streams_info_table)} {
157
+ _streams_info_table{std::move (streams_info_table)},
158
+ _rank{rank} {
142
159
update_executor_config ();
143
160
}
144
161
@@ -197,6 +214,9 @@ class OPENVINO_RUNTIME_API IStreamsExecutor : virtual public ITaskExecutor {
197
214
int get_sub_streams () const {
198
215
return _sub_streams;
199
216
}
217
+ std::vector<int > get_rank () const {
218
+ return _rank;
219
+ }
200
220
StreamsMode get_sub_stream_mode () const {
201
221
const auto proc_type_table = get_proc_type_table ();
202
222
int sockets = proc_type_table.size () > 1 ? static_cast <int >(proc_type_table.size ()) - 1 : 1 ;
@@ -250,31 +270,17 @@ class OPENVINO_RUNTIME_API IStreamsExecutor : virtual public ITaskExecutor {
250
270
virtual int get_socket_id () = 0;
251
271
252
272
/* *
253
- * @brief Execute the task in the current thread using streams executor configuration and constraints
254
- * @param task A task to start
273
+ * @brief Return the rank of current stream
274
+ * Return {} when current stream has no rank
275
+ * @return Rank array, or throws exceptions if called not from stream thread
255
276
*/
256
- virtual void execute (Task task ) = 0;
277
+ virtual std::vector< int > get_rank ( ) = 0;
257
278
258
279
/* *
259
- * @brief Execute ov::Task inside sub stream of task executor context
280
+ * @brief Execute the task in the current thread using streams executor configuration and constraints
260
281
* @param task A task to start
261
- * @param id Sub stream id
262
- */
263
- virtual void run_sub_stream (Task task, int id) = 0;
264
-
265
- /* *
266
- * @brief Execute all of the tasks and waits for its completion.
267
- * Default run_sub_stream_and_wait() method implementation uses run_sub_stream() pure virtual method
268
- * and higher level synchronization primitives from STL.
269
- * The task is wrapped into std::packaged_task which returns std::future.
270
- * std::packaged_task will call the task and signal to std::future that the task is finished
271
- * or the exception is thrown from task
272
- * Than std::future is used to wait for task execution completion and
273
- * task exception extraction
274
- * @note run_sub_stream_and_wait() does not copy or capture tasks!
275
- * @param tasks A vector of tasks to execute
276
282
*/
277
- void run_sub_stream_and_wait ( const std::vector< Task>& tasks) ;
283
+ virtual void execute ( Task task) = 0 ;
278
284
};
279
285
280
286
} // namespace threading
0 commit comments