From 9f5450423202ba446487c1e859157418e5ca8cfa Mon Sep 17 00:00:00 2001 From: "Shen, Wanglei" Date: Tue, 4 Apr 2023 19:25:11 +0800 Subject: [PATCH] update cpu properties name to enable_hyper_threading and enable_hyper_threading (#16723) --- .../c/include/openvino/c/ov_property.h | 4 +-- src/bindings/c/src/ov_property.cpp | 4 +-- src/bindings/c/tests/ov_core_test.cpp | 8 ++--- .../pyopenvino/core/properties/properties.cpp | 4 +-- .../tests/test_runtime/test_properties.py | 16 ++++----- .../runtime/threading/cpu_map_scheduling.hpp | 2 +- .../include/openvino/runtime/properties.hpp | 12 +++---- src/plugins/intel_cpu/src/config.cpp | 16 ++++----- src/plugins/intel_cpu/src/config.h | 4 +-- src/plugins/intel_cpu/src/exec_network.cpp | 16 ++++----- src/plugins/intel_cpu/src/plugin.cpp | 16 ++++----- .../behavior/ov_plugin/core_integration.cpp | 4 +-- .../behavior/ov_plugin/core_integration.hpp | 36 +++++++++---------- 13 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/bindings/c/include/openvino/c/ov_property.h b/src/bindings/c/include/openvino/c/ov_property.h index cf15cf272d8..1b8a580c42a 100644 --- a/src/bindings/c/include/openvino/c/ov_property.h +++ b/src/bindings/c/include/openvino/c/ov_property.h @@ -125,14 +125,14 @@ ov_property_key_inference_num_threads; * @ingroup ov_property_c_api */ OPENVINO_C_VAR(const char*) -ov_property_key_hint_use_cpu_pinning; +ov_property_key_hint_enable_cpu_pinning; /** * @brief Read-write property, it is high-level OpenVINO hint for using hyper threading processors during CPU inference * @ingroup ov_property_c_api */ OPENVINO_C_VAR(const char*) -ov_property_key_hint_use_hyper_threading; +ov_property_key_hint_enable_hyper_threading; /** * @brief Read-write property, it is high-level OpenVINO Performance Hints diff --git a/src/bindings/c/src/ov_property.cpp b/src/bindings/c/src/ov_property.cpp index 999162df720..a7ea7697856 100644 --- a/src/bindings/c/src/ov_property.cpp +++ b/src/bindings/c/src/ov_property.cpp @@ -23,9 +23,9 @@ const char* ov_property_key_num_streams = "NUM_STREAMS"; const char* ov_property_key_affinity = "AFFINITY"; const char* ov_property_key_inference_num_threads = "INFERENCE_NUM_THREADS"; const char* ov_property_key_hint_performance_mode = "PERFORMANCE_HINT"; -const char* ov_property_key_hint_use_cpu_pinning = "USE_CPU_PINNING"; +const char* ov_property_key_hint_enable_cpu_pinning = "ENABLE_CPU_PINNING"; const char* ov_property_key_hint_scheduling_core_type = "SCHEDULING_CORE_TYPE"; -const char* ov_property_key_hint_use_hyper_threading = "USE_HYPER_THREADING"; +const char* ov_property_key_hint_enable_hyper_threading = "ENABLE_HYPER_THREADING"; const char* ov_property_key_hint_inference_precision = "INFERENCE_PRECISION_HINT"; const char* ov_property_key_hint_num_requests = "PERFORMANCE_HINT_NUM_REQUESTS"; const char* ov_property_key_hint_model_priority = "MODEL_PRIORITY"; diff --git a/src/bindings/c/tests/ov_core_test.cpp b/src/bindings/c/tests/ov_core_test.cpp index b9045ffeca4..1a4c7045f92 100644 --- a/src/bindings/c/tests/ov_core_test.cpp +++ b/src/bindings/c/tests/ov_core_test.cpp @@ -260,7 +260,7 @@ TEST_P(ov_core_test, ov_core_set_property_enum_invalid) { EXPECT_STRNE(invalid_mode, ret); ov_free(ret); - const char* key_pin = ov_property_key_hint_use_cpu_pinning; + const char* key_pin = ov_property_key_hint_enable_cpu_pinning; const char* val_pin = "YES"; OV_EXPECT_OK(ov_core_set_property(core, device_name.c_str(), key_pin, val_pin)); ret = nullptr; @@ -289,7 +289,7 @@ TEST_P(ov_core_test, ov_core_set_property_enum_invalid) { EXPECT_STRNE(invalid_val, ret); ov_free(ret); - const char* key_ht = ov_property_key_hint_use_hyper_threading; + const char* key_ht = ov_property_key_hint_enable_hyper_threading; const char* val_ht = "YES"; OV_EXPECT_OK(ov_core_set_property(core, device_name.c_str(), key_ht, val_ht)); ret = nullptr; @@ -320,7 +320,7 @@ TEST_P(ov_core_test, ov_core_set_and_get_property_enum) { EXPECT_STREQ(affinity, ret); ov_free(ret); - const char* key_pin = ov_property_key_hint_use_cpu_pinning; + const char* key_pin = ov_property_key_hint_enable_cpu_pinning; const char* val_pin = "YES"; OV_EXPECT_OK(ov_core_set_property(core, device_name.c_str(), key_pin, val_pin)); ret = nullptr; @@ -336,7 +336,7 @@ TEST_P(ov_core_test, ov_core_set_and_get_property_enum) { EXPECT_STREQ(val_type, ret); ov_free(ret); - const char* key_ht = ov_property_key_hint_use_hyper_threading; + const char* key_ht = ov_property_key_hint_enable_hyper_threading; const char* val_ht = "YES"; OV_EXPECT_OK(ov_core_set_property(core, device_name.c_str(), key_ht, val_ht)); ret = nullptr; diff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp index 923ae8eb88b..01471f27218 100644 --- a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp +++ b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp @@ -72,9 +72,9 @@ void regmodule_properties(py::module m) { wrap_property_RW(m_hint, ov::hint::inference_precision, "inference_precision"); wrap_property_RW(m_hint, ov::hint::model_priority, "model_priority"); wrap_property_RW(m_hint, ov::hint::performance_mode, "performance_mode"); - wrap_property_RW(m_hint, ov::hint::use_cpu_pinning, "use_cpu_pinning"); + wrap_property_RW(m_hint, ov::hint::enable_cpu_pinning, "enable_cpu_pinning"); wrap_property_RW(m_hint, ov::hint::scheduling_core_type, "scheduling_core_type"); - wrap_property_RW(m_hint, ov::hint::use_hyper_threading, "use_hyper_threading"); + wrap_property_RW(m_hint, ov::hint::enable_hyper_threading, "enable_hyper_threading"); wrap_property_RW(m_hint, ov::hint::execution_mode, "execution_mode"); wrap_property_RW(m_hint, ov::hint::num_requests, "num_requests"); wrap_property_RW(m_hint, ov::hint::model, "model"); diff --git a/src/bindings/python/tests/test_runtime/test_properties.py b/src/bindings/python/tests/test_runtime/test_properties.py index 0e96ffedf59..ea7dd3ba6db 100644 --- a/src/bindings/python/tests/test_runtime/test_properties.py +++ b/src/bindings/python/tests/test_runtime/test_properties.py @@ -226,8 +226,8 @@ def test_properties_ro(ov_property_ro, expected_value): ((properties.hint.PerformanceMode.UNDEFINED, properties.hint.PerformanceMode.UNDEFINED),), ), ( - properties.hint.use_cpu_pinning, - "USE_CPU_PINNING", + properties.hint.enable_cpu_pinning, + "ENABLE_CPU_PINNING", ( (True, True), (False, False), @@ -241,8 +241,8 @@ def test_properties_ro(ov_property_ro, expected_value): ((properties.hint.SchedulingCoreType.PCORE_ONLY, properties.hint.SchedulingCoreType.PCORE_ONLY),), ), ( - properties.hint.use_hyper_threading, - "USE_HYPER_THREADING", + properties.hint.enable_hyper_threading, + "ENABLE_HYPER_THREADING", ( (True, True), (False, False), @@ -460,9 +460,9 @@ def test_single_property_setting(device): properties.affinity(properties.Affinity.NONE), properties.hint.inference_precision(Type.f32), properties.hint.performance_mode(properties.hint.PerformanceMode.LATENCY), - properties.hint.use_cpu_pinning(True), + properties.hint.enable_cpu_pinning(True), properties.hint.scheduling_core_type(properties.hint.SchedulingCoreType.PCORE_ONLY), - properties.hint.use_hyper_threading(True), + properties.hint.enable_hyper_threading(True), properties.hint.num_requests(12), properties.streams.num(5), ], @@ -475,9 +475,9 @@ def test_single_property_setting(device): properties.affinity(): properties.Affinity.NONE, properties.hint.inference_precision(): Type.f32, properties.hint.performance_mode(): properties.hint.PerformanceMode.LATENCY, - properties.hint.use_cpu_pinning(): True, + properties.hint.enable_cpu_pinning(): True, properties.hint.scheduling_core_type(): properties.hint.SchedulingCoreType.PCORE_ONLY, - properties.hint.use_hyper_threading(): True, + properties.hint.enable_hyper_threading(): True, properties.hint.num_requests(): 12, properties.streams.num(): 5, }, diff --git a/src/inference/dev_api/openvino/runtime/threading/cpu_map_scheduling.hpp b/src/inference/dev_api/openvino/runtime/threading/cpu_map_scheduling.hpp index db13f57fe76..438a730565d 100644 --- a/src/inference/dev_api/openvino/runtime/threading/cpu_map_scheduling.hpp +++ b/src/inference/dev_api/openvino/runtime/threading/cpu_map_scheduling.hpp @@ -26,7 +26,7 @@ std::vector> apply_scheduling_core_type(const ov::hint::Schedul /** * @brief Limit available CPU resource in processors type table according to hyper threading property - * @param[in] input_type indicate value of property use_hyper_threading. + * @param[in] input_type indicate value of property enable_hyper_threading. * @param[in] input_changed indicate if value is set by user. * @param[in] proc_type_table candidate processors available at this time * @return updated proc_type_table which removed unmatched processors diff --git a/src/inference/include/openvino/runtime/properties.hpp b/src/inference/include/openvino/runtime/properties.hpp index cfdb4786691..1dbf47db03e 100644 --- a/src/inference/include/openvino/runtime/properties.hpp +++ b/src/inference/include/openvino/runtime/properties.hpp @@ -418,11 +418,11 @@ static constexpr Property scheduling_core_type{"SCHEDULING_C * The following code is example to use this property. * * @code - * ie.set_property(ov::hint::use_cpu_pinning(true)); - * ie.set_property(ov::hint::use_cpu_pinning(false)); + * ie.set_property(ov::hint::enable_cpu_pinning(true)); + * ie.set_property(ov::hint::enable_cpu_pinning(false)); * @endcode */ -static constexpr Property use_cpu_pinning{"USE_CPU_PINNING"}; +static constexpr Property enable_cpu_pinning{"ENABLE_CPU_PINNING"}; /** * @brief This property define if using hyper threading during inference. @@ -434,11 +434,11 @@ static constexpr Property use_cpu_pinning{"USE_CPU_PINNING"}; * The following code is example to use this property. * * @code - * ie.set_property(ov::hint::use_hyper_threading(true)); - * ie.set_property(ov::hint::use_hyper_threading(false)); + * ie.set_property(ov::hint::enable_hyper_threading(true)); + * ie.set_property(ov::hint::enable_hyper_threading(false)); * @endcode */ -static constexpr Property use_hyper_threading{"USE_HYPER_THREADING"}; +static constexpr Property enable_hyper_threading{"ENABLE_HYPER_THREADING"}; /** * @brief (Optional) property that backs the (above) Performance Hints diff --git a/src/plugins/intel_cpu/src/config.cpp b/src/plugins/intel_cpu/src/config.cpp index 10a0e3f04cf..534d835534f 100644 --- a/src/plugins/intel_cpu/src/config.cpp +++ b/src/plugins/intel_cpu/src/config.cpp @@ -79,15 +79,15 @@ void Config::readProperties(const std::map &prop) { streamExecutorConfig.SetConfig(key, val); } else if (hintsConfigKeys.end() != std::find(hintsConfigKeys.begin(), hintsConfigKeys.end(), key)) { perfHintsConfig.SetConfig(key, val); - } else if (key == ov::hint::use_cpu_pinning.name()) { + } else if (key == ov::hint::enable_cpu_pinning.name()) { if (val == PluginConfigParams::YES) { - useCpuPinning = true; + enableCpuPinning = true; changedCpuPinning = true; } else if (val == PluginConfigParams::NO) { - useCpuPinning = false; + enableCpuPinning = false; changedCpuPinning = true; } else { - IE_THROW() << "Wrong value " << val << "for property key " << ov::hint::use_cpu_pinning.name() + IE_THROW() << "Wrong value " << val << "for property key " << ov::hint::enable_cpu_pinning.name() << ". Expected only true/false." << std::endl; } } else if (key == ov::hint::scheduling_core_type.name()) { @@ -102,15 +102,15 @@ void Config::readProperties(const std::map &prop) { << ov::hint::SchedulingCoreType::PCORE_ONLY << "/" << ov::hint::SchedulingCoreType::ECORE_ONLY << std::endl; } - } else if (key == ov::hint::use_hyper_threading.name()) { + } else if (key == ov::hint::enable_hyper_threading.name()) { if (val == PluginConfigParams::YES) { - useHyperThreading = true; + enableHyperThreading = true; changedHyperThreading = true; } else if (val == PluginConfigParams::NO) { - useHyperThreading = false; + enableHyperThreading = false; changedHyperThreading = true; } else { - IE_THROW() << "Wrong value " << val << "for property key " << ov::hint::use_hyper_threading.name() + IE_THROW() << "Wrong value " << val << "for property key " << ov::hint::enable_hyper_threading.name() << ". Expected only true/false." << std::endl; } } else if (key == PluginConfigParams::KEY_DYN_BATCH_LIMIT) { diff --git a/src/plugins/intel_cpu/src/config.h b/src/plugins/intel_cpu/src/config.h index 497603f3156..894d21d87c6 100644 --- a/src/plugins/intel_cpu/src/config.h +++ b/src/plugins/intel_cpu/src/config.h @@ -51,10 +51,10 @@ struct Config { size_t rtCacheCapacity = 5000ul; InferenceEngine::IStreamsExecutor::Config streamExecutorConfig; InferenceEngine::PerfHintsConfig perfHintsConfig; - bool useCpuPinning = true; + bool enableCpuPinning = true; bool changedCpuPinning = false; ov::hint::SchedulingCoreType schedulingCoreType = ov::hint::SchedulingCoreType::ANY_CORE; - bool useHyperThreading = true; + bool enableHyperThreading = true; bool changedHyperThreading = false; #if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64) LPTransformsMode lpTransformsMode = LPTransformsMode::On; diff --git a/src/plugins/intel_cpu/src/exec_network.cpp b/src/plugins/intel_cpu/src/exec_network.cpp index ae81a3e1083..825c66c2b42 100644 --- a/src/plugins/intel_cpu/src/exec_network.cpp +++ b/src/plugins/intel_cpu/src/exec_network.cpp @@ -313,9 +313,9 @@ InferenceEngine::Parameter ExecNetwork::GetMetric(const std::string &name) const RO_property(ov::hint::performance_mode.name()), RO_property(ov::hint::execution_mode.name()), RO_property(ov::hint::num_requests.name()), - RO_property(ov::hint::use_cpu_pinning.name()), + RO_property(ov::hint::enable_cpu_pinning.name()), RO_property(ov::hint::scheduling_core_type.name()), - RO_property(ov::hint::use_hyper_threading.name()), + RO_property(ov::hint::enable_hyper_threading.name()), RO_property(ov::execution_devices.name()), }; } @@ -356,15 +356,15 @@ InferenceEngine::Parameter ExecNetwork::GetMetric(const std::string &name) const } else if (name == ov::hint::performance_mode) { const auto perfHint = ov::util::from_string(config.perfHintsConfig.ovPerfHint, ov::hint::performance_mode); return perfHint; - } else if (name == ov::hint::use_cpu_pinning.name()) { - const bool use_pin = config.useCpuPinning; - return decltype(ov::hint::use_cpu_pinning)::value_type(use_pin); + } else if (name == ov::hint::enable_cpu_pinning.name()) { + const bool use_pin = config.enableCpuPinning; + return decltype(ov::hint::enable_cpu_pinning)::value_type(use_pin); } else if (name == ov::hint::scheduling_core_type) { const auto core_type = config.schedulingCoreType; return core_type; - } else if (name == ov::hint::use_hyper_threading.name()) { - const bool use_ht = config.useHyperThreading; - return decltype(ov::hint::use_hyper_threading)::value_type(use_ht); + } else if (name == ov::hint::enable_hyper_threading.name()) { + const bool use_ht = config.enableHyperThreading; + return decltype(ov::hint::enable_hyper_threading)::value_type(use_ht); } else if (name == ov::hint::execution_mode) { return config.executionMode; } else if (name == ov::hint::num_requests) { diff --git a/src/plugins/intel_cpu/src/plugin.cpp b/src/plugins/intel_cpu/src/plugin.cpp index 1d75a0e5f1e..6db86eeaf7b 100644 --- a/src/plugins/intel_cpu/src/plugin.cpp +++ b/src/plugins/intel_cpu/src/plugin.cpp @@ -596,15 +596,15 @@ Parameter Engine::GetConfig(const std::string& name, const std::map