From 7f3ea9a59c2a1f44afbb1c8ebcf1b9af3377a69d Mon Sep 17 00:00:00 2001 From: "Wang, Yang" Date: Wed, 22 Feb 2023 17:01:18 +0800 Subject: [PATCH] Conversion fail for ov::hint::performance_mode with UNDEFINED value (#15629) * Update ov::hint::performance_hint UNDEFINED value from empty string to "UNDEFINED". * Update benchmark Python version. * Update. * Update. * Update. * Update the description about hint setting within benchmark APP README and help message. --- samples/cpp/benchmark_app/README.md | 2 +- samples/cpp/benchmark_app/benchmark_app.hpp | 2 +- src/inference/dev_api/ie_performance_hints.hpp | 6 +++--- src/inference/include/ie/ie_plugin_config.hpp | 1 + src/inference/include/openvino/runtime/properties.hpp | 4 ++-- src/plugins/intel_gna/tests/unit/gna_plugin_config_test.cpp | 2 +- tools/benchmark_tool/openvino/tools/benchmark/main.py | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/samples/cpp/benchmark_app/README.md b/samples/cpp/benchmark_app/README.md index 25322173ec7..f9cdda078e0 100644 --- a/samples/cpp/benchmark_app/README.md +++ b/samples/cpp/benchmark_app/README.md @@ -125,7 +125,7 @@ Options: 'throughput' or 'tput': device performance mode will be set to THROUGHPUT. 'cumulative_throughput' or 'ctput': device performance mode will be set to CUMULATIVE_THROUGHPUT. 'latency': device performance mode will be set to LATENCY. - 'none': no device performance mode will be set. + 'none': device performance mode will be set to UNDEFINED. Using explicit 'nstreams' or other device-specific options, please set hint to 'none' -niter Optional. Number of iterations. If not specified, the number of iterations is calculated depending on a device. -t Optional. Time in seconds to execute topology. diff --git a/samples/cpp/benchmark_app/benchmark_app.hpp b/samples/cpp/benchmark_app/benchmark_app.hpp index f85f9b4099b..50fe8e8dac1 100644 --- a/samples/cpp/benchmark_app/benchmark_app.hpp +++ b/samples/cpp/benchmark_app/benchmark_app.hpp @@ -44,7 +44,7 @@ static const char hint_message[] = " 'cumulative_throughput' or 'ctput': device performance mode will be set to " "CUMULATIVE_THROUGHPUT.\n" " 'latency': device performance mode will be set to LATENCY.\n" - " 'none': no device performance mode will be set.\n" + " 'none': device performance mode will be set to UNDEFINED.\n" " Using explicit 'nstreams' or other device-specific options, please set hint to " "'none'"; diff --git a/src/inference/dev_api/ie_performance_hints.hpp b/src/inference/dev_api/ie_performance_hints.hpp index 511b7d2a3c0..1cfb1aba8bf 100644 --- a/src/inference/dev_api/ie_performance_hints.hpp +++ b/src/inference/dev_api/ie_performance_hints.hpp @@ -13,7 +13,7 @@ namespace InferenceEngine { struct PerfHintsConfig { - std::string ovPerfHint = ""; + std::string ovPerfHint = "UNDEFINED"; int ovPerfHintNumRequests = 0; /** @@ -73,12 +73,12 @@ struct PerfHintsConfig { */ static std::string CheckPerformanceHintValue(const std::string& val) { if (val == PluginConfigParams::LATENCY || val == PluginConfigParams::THROUGHPUT || - val == PluginConfigParams::CUMULATIVE_THROUGHPUT || val == "") + val == PluginConfigParams::CUMULATIVE_THROUGHPUT || val == PluginConfigParams::UNDEFINED) return val; else IE_THROW() << "Wrong value for property key " << PluginConfigParams::KEY_PERFORMANCE_HINT << ". Expected only " << PluginConfigParams::LATENCY << "/" << PluginConfigParams::THROUGHPUT - << "/" << PluginConfigParams::CUMULATIVE_THROUGHPUT; + << "/" << PluginConfigParams::CUMULATIVE_THROUGHPUT << "/" << PluginConfigParams::UNDEFINED; } /** diff --git a/src/inference/include/ie/ie_plugin_config.hpp b/src/inference/include/ie/ie_plugin_config.hpp index a09827b8bd4..73ae94b3d1b 100644 --- a/src/inference/include/ie/ie_plugin_config.hpp +++ b/src/inference/include/ie/ie_plugin_config.hpp @@ -268,6 +268,7 @@ DECLARE_CONFIG_VALUE(MODEL_PRIORITY_LOW); DECLARE_CONFIG_KEY(PERFORMANCE_HINT); DECLARE_CONFIG_VALUE(LATENCY); DECLARE_CONFIG_VALUE(THROUGHPUT); +DECLARE_CONFIG_VALUE(UNDEFINED); DECLARE_CONFIG_VALUE(CUMULATIVE_THROUGHPUT); /** * @brief (Optional) config key that backs the (above) Performance Hints diff --git a/src/inference/include/openvino/runtime/properties.hpp b/src/inference/include/openvino/runtime/properties.hpp index 6b032749824..ab8323e333f 100644 --- a/src/inference/include/openvino/runtime/properties.hpp +++ b/src/inference/include/openvino/runtime/properties.hpp @@ -312,7 +312,7 @@ enum class PerformanceMode { inline std::ostream& operator<<(std::ostream& os, const PerformanceMode& performance_mode) { switch (performance_mode) { case PerformanceMode::UNDEFINED: - return os << ""; + return os << "UNDEFINED"; case PerformanceMode::LATENCY: return os << "LATENCY"; case PerformanceMode::THROUGHPUT: @@ -333,7 +333,7 @@ inline std::istream& operator>>(std::istream& is, PerformanceMode& performance_m performance_mode = PerformanceMode::THROUGHPUT; } else if (str == "CUMULATIVE_THROUGHPUT") { performance_mode = PerformanceMode::CUMULATIVE_THROUGHPUT; - } else if (str == "") { + } else if (str == "UNDEFINED") { performance_mode = PerformanceMode::UNDEFINED; } else { throw ov::Exception{"Unsupported performance mode: " + str}; diff --git a/src/plugins/intel_gna/tests/unit/gna_plugin_config_test.cpp b/src/plugins/intel_gna/tests/unit/gna_plugin_config_test.cpp index d834277da51..b47f7cf9965 100644 --- a/src/plugins/intel_gna/tests/unit/gna_plugin_config_test.cpp +++ b/src/plugins/intel_gna/tests/unit/gna_plugin_config_test.cpp @@ -33,7 +33,7 @@ const std::map supportedConfigKeysWithDefaults = { {GNA_CONFIG_KEY(LIB_N_THREADS), "1"}, {CONFIG_KEY(SINGLE_THREAD), CONFIG_VALUE(YES)}, {CONFIG_KEY(LOG_LEVEL), PluginConfigParams::LOG_NONE}, - {CONFIG_KEY(PERFORMANCE_HINT), ""}, + {CONFIG_KEY(PERFORMANCE_HINT), "UNDEFINED"}, {CONFIG_KEY(PERFORMANCE_HINT_NUM_REQUESTS), "1"}}; IE_SUPPRESS_DEPRECATED_END diff --git a/tools/benchmark_tool/openvino/tools/benchmark/main.py b/tools/benchmark_tool/openvino/tools/benchmark/main.py index 96eb30056a2..6919082c023 100644 --- a/tools/benchmark_tool/openvino/tools/benchmark/main.py +++ b/tools/benchmark_tool/openvino/tools/benchmark/main.py @@ -112,7 +112,7 @@ def main(): if is_flag_set_in_command_line('hint'): if args.perf_hint=='none': logger.warning(f"No device {device} performance hint is set.") - args.perf_hint = '' + args.perf_hint = 'UNDEFINED' else: args.perf_hint = "THROUGHPUT" if benchmark.api_type == "async" else "LATENCY" logger.warning(f"Performance hint was not explicitly specified in command line. " +