fixed excessive outputs copying (in case when the fallback happened) and updated the test for that (#10110)

* fixed excessive outputs copying (in case when the fallback happened) and updated the test for that

* enum eExecutionFlavor to cover initial state
This commit is contained in:
Maxim Shevtsov
2022-02-04 16:58:37 +03:00
committed by GitHub
parent 9743784f91
commit 8a85bfa312
3 changed files with 22 additions and 2 deletions

View File

@@ -271,7 +271,10 @@ AutoBatchAsyncInferRequest::AutoBatchAsyncInferRequest(
auto& batchReq = this->_inferRequest->_myBatchedRequestWrapper;
if (batchReq._exceptionPtr) // when the batchN execution failed
std::rethrow_exception(batchReq._exceptionPtr);
this->_inferRequest->CopyOutputsIfNeeded();
// in the case of non-batched execution the blobs were set explicitly
if (AutoBatchInferRequest::eExecutionFlavor::BATCH_EXECUTED ==
this->_inferRequest->_wasBatchedRequestUsed)
this->_inferRequest->CopyOutputsIfNeeded();
if (needPerfCounters) {
try {
this->_inferRequest->_perfMap = batchReq._inferRequestBatched->GetPerformanceCounts();
@@ -399,6 +402,8 @@ std::pair<AutoBatchExecutableNetwork::WorkerInferRequest&, int> AutoBatchExecuta
IE_ASSERT(workerRequestPtr->_tasks.try_pop(t));
workerRequestPtr->_completionTasks[n] = std::move(t.second);
t.first->_inferRequest->CopyInputsIfNeeded();
t.first->_inferRequest->_wasBatchedRequestUsed =
AutoBatchInferRequest::eExecutionFlavor::BATCH_EXECUTED;
}
workerRequestPtr->_inferRequestBatched->StartAsync();
} else if ((status == std::cv_status::timeout) && sz) {
@@ -418,6 +423,8 @@ std::pair<AutoBatchExecutableNetwork::WorkerInferRequest&, int> AutoBatchExecuta
if (sz == ++arrived)
all_completed.set_value();
});
t.first->_inferRequest->_wasBatchedRequestUsed =
AutoBatchInferRequest::eExecutionFlavor::TIMEOUT_EXECUTED;
t.first->_inferRequest->SetBlobsToAnotherRequest(t.first->_inferRequestWithoutBatch);
t.first->_inferRequestWithoutBatch->StartAsync();
}

View File

@@ -106,6 +106,11 @@ public:
void CopyOutputsIfNeeded();
AutoBatchExecutableNetwork::WorkerInferRequest& _myBatchedRequestWrapper;
std::exception_ptr _exceptionPtr;
enum eExecutionFlavor : uint8_t {
NOT_EXECUTED,
BATCH_EXECUTED,
TIMEOUT_EXECUTED
} _wasBatchedRequestUsed = eExecutionFlavor::NOT_EXECUTED;
std::map<std::string, InferenceEngine::InferenceEngineProfileInfo> _perfMap;
protected: