[AUTO plugin] Enable benchmark setting performance hint with none value to hardware device through AUTO/MULTI plugin (#13063)

* Set 'UNDEFINED' as the performancehint default value. Update benchmark app to pass performance hint with none value to MULTI/AUTO plugin.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Using 'UNDEFINED' as the default value of hint in AUTO/MULTI plugin.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Adding a flag instead of adding a default value of hint to check if user configures the performance hint to AUTO/MULTI plugin.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Update benchmark python version.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

Signed-off-by: Wang, Yang <yang4.wang@intel.com>
This commit is contained in:
Wang, Yang 2022-10-12 10:03:17 +08:00 committed by GitHub
parent 37a0afa330
commit 6bd099917a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 16 deletions

View File

@ -292,11 +292,9 @@ int main(int argc, char* argv[]) {
// high-level performance modes
auto ov_perf_hint = get_performance_hint(device, core);
if (ov_perf_hint != ov::hint::PerformanceMode::UNDEFINED) {
device_config.emplace(ov::hint::performance_mode(ov_perf_hint));
if (FLAGS_nireq != 0)
device_config.emplace(ov::hint::num_requests(FLAGS_nireq));
}
device_config.emplace(ov::hint::performance_mode(ov_perf_hint));
if (FLAGS_nireq != 0)
device_config.emplace(ov::hint::num_requests(FLAGS_nireq));
// Set performance counter
if (isFlagSetInCommandLine("pc")) {

View File

@ -79,12 +79,10 @@ std::vector<DeviceInformation> MultiDeviceInferencePlugin::ParseMetaDevices(cons
std::vector<std::string> devicesWithRequests = _pluginConfig.ParsePrioritiesDevices(priorities);
auto setTputAsDefault = [&](const std::string& targetDevice,
std::map<std::string, std::string>& deviceConfig,
const std::map<std::string, std::string>& mergedConfig) {
// Default value of PERFORMACE_HINT is empty string.
auto iter = mergedConfig.find(PluginConfigParams::KEY_PERFORMANCE_HINT);
if (GetName() == "AUTO" && iter->second.empty() &&
mergedConfig.find(targetDevice) == mergedConfig.end()) {
std::map<std::string, std::string>& deviceConfig,
const std::map<std::string, std::string>& mergedConfig) {
auto isSetPerHint = mergedConfig.find(PluginConfigParams::KEY_PERFORMANCE_HINT) != mergedConfig.end();
if (GetName() == "AUTO" && !isSetPerHint && mergedConfig.find(targetDevice) == mergedConfig.end()) {
// setting tput as the default performance mode if no hints setting for AUTO plugin and no properties
// specified for target device.
deviceConfig[PluginConfigParams::KEY_PERFORMANCE_HINT] = PluginConfigParams::THROUGHPUT;
@ -93,7 +91,7 @@ std::vector<DeviceInformation> MultiDeviceInferencePlugin::ParseMetaDevices(cons
// set TPUT for MULTI if no above propertis were set by user
if (GetName() == "MULTI") {
if (!iter->second.empty() || mergedConfig.find(targetDevice) != mergedConfig.end())
if (isSetPerHint || mergedConfig.find(targetDevice) != mergedConfig.end())
return;
for (auto&& kvp : mergedConfig) {
if (kvp.first == ov::affinity || kvp.first == ov::num_streams ||
@ -370,6 +368,9 @@ IExecutableNetworkInternal::Ptr MultiDeviceInferencePlugin::LoadNetworkImpl(cons
// updateFromMap will check config valid
loadConfig.UpdateFromMap(config, GetName());
auto fullConfig = loadConfig._keyConfigMap;
// Remove the performance hint if no setting to this property from user.
if (!loadConfig.isSetPerHint)
fullConfig.erase(PluginConfigParams::KEY_PERFORMANCE_HINT);
// collect the settings that are applicable to the devices we are loading the network to
std::unordered_map<std::string, InferenceEngine::Parameter> multiNetworkConfig;
std::vector<DeviceInformation> metaDevices;

View File

@ -97,6 +97,8 @@ struct PluginConfig {
_devicePriority = kvp.second;
} else if (std::find(perf_hints_configs.begin(), perf_hints_configs.end(), kvp.first) != perf_hints_configs.end()) {
_perfHintsConfig.SetConfig(kvp.first, kvp.second);
if (kvp.first == ov::hint::performance_mode.name())
isSetPerHint = true;
} else if (_availableDevices.end() !=
std::find(_availableDevices.begin(), _availableDevices.end(), kvp.first)) {
_passThroughConfig.emplace(kvp.first, kvp.second);
@ -201,6 +203,8 @@ struct PluginConfig {
bool _deviceBindBuffer;
std::string _logLevel;
PerfHintsConfig _perfHintsConfig;
// Add this flag to check if user app sets hint with none value that is equal to the default value of hint.
bool isSetPerHint = false;
std::map<std::string, std::string> _passThroughConfig;
std::map<std::string, std::string> _keyConfigMap;
const std::set<std::string> _availableDevices = {"AUTO",

View File

@ -288,6 +288,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AUTO_OVClassLoadNetworkWithDefaultPropertiesTest,
const std::vector<ov::AnyMap> default_incorrect_properties = {
{ov::device::priorities("CPU"), ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
{ov::device::priorities("CPU"), ov::hint::performance_mode(ov::hint::PerformanceMode::UNDEFINED)},
{ov::device::priorities("CPU"), ov::device::properties("CPU", ov::hint::allow_auto_batching(true))}
};
const std::vector<ov::AnyMap> default_multi_incorrect_properties = {

View File

@ -162,10 +162,9 @@ def main():
perf_counts = True if config[device]['PERF_COUNT'] == 'YES' else perf_counts
## high-level performance hints
if is_flag_set_in_command_line('hint') or args.perf_hint:
config[device]['PERFORMANCE_HINT'] = args.perf_hint.upper()
if is_flag_set_in_command_line('nireq'):
config[device]['PERFORMANCE_HINT_NUM_REQUESTS'] = str(args.number_infer_requests)
config[device]['PERFORMANCE_HINT'] = args.perf_hint.upper()
if is_flag_set_in_command_line('nireq'):
config[device]['PERFORMANCE_HINT_NUM_REQUESTS'] = str(args.number_infer_requests)
## infer precision
if device in device_infer_precision and 'INFERENCE_PRECISION_HINT' in supported_properties: