AUTO CTPUT single device always goes single device logic (#14425)
* AUTO CTPUT single device always goes single device logic * CreateInferRequest goes single device logic when perf hint is ctput * Optimize single device logic according to bell opinion * Add code comments * merge two isCumulative conditions * add ctput test case * Remove the redundant header file of auto_ctput_test.cpp * Modify the test case according to bell comments
This commit is contained in:
1 parent
04720f0453
commit
9dd08cd929
2 files changed
+285
-19
No files matched your search
@@ -113,40 +113,53 @@ void AutoSchedule::init(const ScheduleContext::Ptr& sContext) {
|
||||
}
|
||||
_autoSContext->_config[IE::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES] = _autoSContext->_strDevices;
|
||||
std::string profilingTask = "AutoSchedule::AutoSchedule:AutoMode";
|
||||
bool isCumulative = (_autoSContext->_performanceHint == IE::PluginConfigParams::CUMULATIVE_THROUGHPUT) ? true : false;
|
||||
// loadContext[ACTUALDEVICE] is always enabled,
|
||||
// when there is CPU and there are more than two devices, loadContext[CPU] is enabled
|
||||
_loadContext[ACTUALDEVICE].isEnabled = true;
|
||||
if (_autoSContext->_modelPath.empty())
|
||||
_loadContext[ACTUALDEVICE].networkPrecision = GetNetworkPrecision(_autoSContext->_network);
|
||||
_loadContext[ACTUALDEVICE].metaDevices = _autoSContext->_devicePriorities;
|
||||
bool isCumulative =
|
||||
(_autoSContext->_performanceHint == IE::PluginConfigParams::CUMULATIVE_THROUGHPUT) ? true : false;
|
||||
if (isCumulative) {
|
||||
std::list<DeviceInformation> validDevices =
|
||||
_autoSContext->_plugin->GetValidDevice(_autoSContext->_devicePriorities,
|
||||
_loadContext[ACTUALDEVICE].networkPrecision);
|
||||
|
||||
std::string deviceName = "MULTI:";
|
||||
for (auto& device : validDevices) {
|
||||
deviceName += device.deviceName;
|
||||
deviceName += ((device.deviceName == validDevices.back().deviceName) ? "" : ",");
|
||||
if (validDevices.size() == 1) {
|
||||
// When the hint is ctput and there is only one device, the single-device logic is used instead of
|
||||
// the MULTI logic
|
||||
_autoSContext->_performanceHint = IE::PluginConfigParams::THROUGHPUT;
|
||||
_loadContext[ACTUALDEVICE].deviceInfo = validDevices.front();
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.config[CONFIG_KEY(PERFORMANCE_HINT)] =
|
||||
IE::PluginConfigParams::THROUGHPUT;
|
||||
isCumulative = false;
|
||||
} else {
|
||||
// When the hint is ctput and there are more than one device, the MULTI logic is used
|
||||
std::string deviceName = "MULTI:";
|
||||
for (auto& device : validDevices) {
|
||||
deviceName += device.deviceName;
|
||||
deviceName += ((device.deviceName == validDevices.back().deviceName) ? "" : ",");
|
||||
}
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.deviceName = deviceName;
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.config[CONFIG_KEY(PERFORMANCE_HINT)] =
|
||||
InferenceEngine::PluginConfigParams::CUMULATIVE_THROUGHPUT;
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.config[CONFIG_KEY(PERF_COUNT)] =
|
||||
_autoSContext->_needPerfCounters ? InferenceEngine::PluginConfigParams::YES
|
||||
: InferenceEngine::PluginConfigParams::NO;
|
||||
if (_autoSContext->_bindBuffer)
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.config[ov::intel_auto::device_bind_buffer.name()] =
|
||||
InferenceEngine::PluginConfigParams::YES;
|
||||
}
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.deviceName = deviceName;
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.config[CONFIG_KEY(PERFORMANCE_HINT)] =
|
||||
InferenceEngine::PluginConfigParams::CUMULATIVE_THROUGHPUT;
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.config[CONFIG_KEY(PERF_COUNT)] =
|
||||
_autoSContext->_needPerfCounters ? InferenceEngine::PluginConfigParams::YES
|
||||
: InferenceEngine::PluginConfigParams::NO;
|
||||
if (_autoSContext->_bindBuffer)
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.config[ov::intel_auto::device_bind_buffer.name()] = InferenceEngine::PluginConfigParams::YES;
|
||||
} else {
|
||||
_loadContext[ACTUALDEVICE].deviceInfo = _autoSContext->_plugin->SelectDevice(_autoSContext->_devicePriorities,
|
||||
_loadContext[ACTUALDEVICE].networkPrecision,
|
||||
_autoSContext->_modelPriority);
|
||||
_loadContext[ACTUALDEVICE].deviceInfo =
|
||||
_autoSContext->_plugin->SelectDevice(_autoSContext->_devicePriorities,
|
||||
_loadContext[ACTUALDEVICE].networkPrecision,
|
||||
_autoSContext->_modelPriority);
|
||||
}
|
||||
LOG_INFO_TAG("select device:%s", _loadContext[ACTUALDEVICE].deviceInfo.deviceName.c_str());
|
||||
bool isActualDevCPU =
|
||||
_loadContext[ACTUALDEVICE].deviceInfo.deviceName.find("CPU") !=std::string::npos && !isCumulative;
|
||||
// if Actual device is CPU, disabled _loadContext[CPU], only use _loadContext[ACTUALDEVICE]
|
||||
// if Actual device is CPU or perf_hint is cumulative, disabled _loadContext[CPU], only use _loadContext[ACTUALDEVICE]
|
||||
if (isActualDevCPU || isCumulative) {
|
||||
_loadContext[CPU].isEnabled = false;
|
||||
} else {
|
||||
@@ -548,4 +561,4 @@ IInferPtr AutoSchedule::CreateInferRequest() {
|
||||
syncRequestImpl,
|
||||
execNetwork->_callbackExecutor);
|
||||
}
|
||||
} // namespace MultiDevicePlugin
|
||||
} // namespace MultiDevicePlugin
|
||||
Reference in new issue
Block a user