try avoid timeout in batch plugin during transition in auto plugin (#10753)

* initial debug

Signed-off-by: fishbell <bell.song@intel.com>

* refine

Signed-off-by: fishbell <bell.song@intel.com>

* remove debug msg

Signed-off-by: fishbell <bell.song@intel.com>
This commit is contained in:
yanlan song
2022-03-14 16:05:26 +08:00
committed by GitHub
parent 0bc6196d96
commit a6583965a5
2 changed files with 12 additions and 7 deletions

View File

@@ -137,10 +137,12 @@ void MultiDeviceExecutableNetwork::GenerateWorkers(const std::string& device, co
// let's try to pop a task, as we know there is at least one idle request, schedule if succeeded
// if no device-agnostic tasks, let's try pop the device specific task, schedule if succeeded
Task t;
if (_inferPipelineTasks.try_pop(t))
ScheduleToWorkerInferRequest(std::move(t));
else if (_inferPipelineTasksDeviceSpecific[device]->try_pop(t))
ScheduleToWorkerInferRequest(std::move(t), device);
do {
_inferPipelineTasks.try_pop(t);
} while (t && ScheduleToWorkerInferRequest(std::move(t)));
do {
_inferPipelineTasksDeviceSpecific[device]->try_pop(t);
} while (t && ScheduleToWorkerInferRequest(std::move(t), device));
}
});
}
@@ -291,6 +293,7 @@ MultiDeviceExecutableNetwork::MultiDeviceExecutableNetwork(const std::string&
_workerRequests["CPU_HELP"].clear();
_loadContext[CPU].executableNetwork._ptr.reset();
_loadContext[CPU].executableNetwork._so.reset();
LOG_INFO("[AUTOPLUGIN]:helper released!!");
break;
}
}
@@ -452,7 +455,7 @@ void MultiDeviceExecutableNetwork::WaitActualNetworkReady() const {
});
}
void MultiDeviceExecutableNetwork::ScheduleToWorkerInferRequest(Task inferPipelineTask, DeviceName preferred_device) {
bool MultiDeviceExecutableNetwork::ScheduleToWorkerInferRequest(Task inferPipelineTask, DeviceName preferred_device) {
std::vector<DeviceInformation> devices;
// AUTO work mode
if (_workModeIsAUTO) {
@@ -486,7 +489,7 @@ void MultiDeviceExecutableNetwork::ScheduleToWorkerInferRequest(Task inferPipeli
if (!preferred_device.empty() && (device.deviceName != preferred_device))
continue;
if (RunPipelineTask(inferPipelineTask, _idleWorkerRequests[device.deviceName], preferred_device)) {
return;
return true;
}
}
@@ -495,6 +498,7 @@ void MultiDeviceExecutableNetwork::ScheduleToWorkerInferRequest(Task inferPipeli
_inferPipelineTasksDeviceSpecific[preferred_device]->push(std::move(inferPipelineTask));
else
_inferPipelineTasks.push(std::move(inferPipelineTask));
return false;
}
bool MultiDeviceExecutableNetwork::RunPipelineTask(Task& inferPipelineTask,

View File

@@ -116,7 +116,8 @@ public:
std::shared_ptr<InferenceEngine::ICore> GetCore() const;
~MultiDeviceExecutableNetwork() override;
void ScheduleToWorkerInferRequest(InferenceEngine::Task, DeviceName preferred_device = "");
// return true if current schedule success, fail otherwise
bool ScheduleToWorkerInferRequest(InferenceEngine::Task, DeviceName preferred_device = "");
static thread_local WorkerInferRequest* _thisWorkerInferRequest;
// have to use the const char* ptr rather than std::string due to a bug in old gcc versions,