File tree 3 files changed +7
-0
lines changed
src/plugins/auto_batch/src
3 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ AsyncInferRequest::AsyncInferRequest(const std::shared_ptr<SyncInferRequest>& re
69
69
// it is ok to call size() here as the queue only grows (and the bulk removal happens under the mutex)
70
70
const int sz = static_cast <int >(workerInferRequest->_tasks .size ());
71
71
if (sz == workerInferRequest->_batch_size ) {
72
+ workerInferRequest->_is_wakeup = true ;
72
73
workerInferRequest->_cond .notify_one ();
73
74
}
74
75
};
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ CompiledModel::GetWorkerInferRequest() const {
64
64
workerRequestPtr->_infer_request_batched ._so = m_compiled_model_with_batch._so ;
65
65
workerRequestPtr->_batch_size = m_device_info.device_batch_size ;
66
66
workerRequestPtr->_completion_tasks .resize (workerRequestPtr->_batch_size );
67
+ workerRequestPtr->_is_wakeup = false ;
67
68
workerRequestPtr->_infer_request_batched ->set_callback (
68
69
[workerRequestPtr](std::exception_ptr exceptionPtr) mutable {
69
70
if (exceptionPtr)
@@ -74,6 +75,7 @@ CompiledModel::GetWorkerInferRequest() const {
74
75
workerRequestPtr->_completion_tasks [c]();
75
76
}
76
77
// reset the timeout
78
+ workerRequestPtr->_is_wakeup = true ;
77
79
workerRequestPtr->_cond .notify_one ();
78
80
});
79
81
@@ -83,6 +85,9 @@ CompiledModel::GetWorkerInferRequest() const {
83
85
{
84
86
std::unique_lock<std::mutex> lock (workerRequestPtr->_mutex );
85
87
status = workerRequestPtr->_cond .wait_for (lock, std::chrono::milliseconds (m_time_out));
88
+ if ((status != std::cv_status::timeout) && (workerRequestPtr->_is_wakeup == false ))
89
+ continue ;
90
+ workerRequestPtr->_is_wakeup = false ;
86
91
}
87
92
if (m_terminate) {
88
93
break ;
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ class CompiledModel : public ov::ICompiledModel {
30
30
std::condition_variable _cond;
31
31
std::mutex _mutex;
32
32
std::exception_ptr _exception_ptr;
33
+ bool _is_wakeup;
33
34
};
34
35
35
36
CompiledModel (const std::shared_ptr<ov::Model>& model,
You can’t perform that action at this time.
0 commit comments