update cpu properties name to enable_hyper_threading and enable_hyper_threading (#16723)

This commit is contained in:
Shen, Wanglei 2023-04-04 19:25:11 +08:00 committed by GitHub
parent 8691ec2779
commit 9f54504232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 71 additions and 71 deletions

View File

@ -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

View File

@ -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";

View File

@ -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;

View File

@ -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");

View File

@ -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,
},

View File

@ -26,7 +26,7 @@ std::vector<std::vector<int>> 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

View File

@ -418,11 +418,11 @@ static constexpr Property<SchedulingCoreType> 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<bool> use_cpu_pinning{"USE_CPU_PINNING"};
static constexpr Property<bool> enable_cpu_pinning{"ENABLE_CPU_PINNING"};
/**
* @brief This property define if using hyper threading during inference.
@ -434,11 +434,11 @@ static constexpr Property<bool> 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<bool> use_hyper_threading{"USE_HYPER_THREADING"};
static constexpr Property<bool> enable_hyper_threading{"ENABLE_HYPER_THREADING"};
/**
* @brief (Optional) property that backs the (above) Performance Hints

View File

@ -79,15 +79,15 @@ void Config::readProperties(const std::map<std::string, std::string> &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<std::string, std::string> &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) {

View File

@ -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;

View File

@ -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) {

View File

@ -596,15 +596,15 @@ Parameter Engine::GetConfig(const std::string& name, const std::map<std::string,
} else if (name == ov::hint::performance_mode) {
const auto perfHint = ov::util::from_string(engConfig.perfHintsConfig.ovPerfHint, ov::hint::performance_mode);
return perfHint;
} else if (name == ov::hint::use_cpu_pinning) {
const bool pin_value = engConfig.useCpuPinning;
return decltype(ov::hint::use_cpu_pinning)::value_type(pin_value);
} else if (name == ov::hint::enable_cpu_pinning) {
const bool pin_value = engConfig.enableCpuPinning;
return decltype(ov::hint::enable_cpu_pinning)::value_type(pin_value);
} else if (name == ov::hint::scheduling_core_type) {
const auto core_type = engConfig.schedulingCoreType;
return core_type;
} else if (name == ov::hint::use_hyper_threading) {
const bool ht_value = engConfig.useHyperThreading;
return decltype(ov::hint::use_hyper_threading)::value_type(ht_value);
} else if (name == ov::hint::enable_hyper_threading) {
const bool ht_value = engConfig.enableHyperThreading;
return decltype(ov::hint::enable_hyper_threading)::value_type(ht_value);
} else if (name == ov::hint::num_requests) {
const auto perfHintNumRequests = engConfig.perfHintsConfig.ovPerfHintNumRequests;
return decltype(ov::hint::num_requests)::value_type(perfHintNumRequests);
@ -696,9 +696,9 @@ Parameter Engine::GetMetric(const std::string& name, const std::map<std::string,
RW_property(ov::hint::performance_mode.name()),
RW_property(ov::hint::execution_mode.name()),
RW_property(ov::hint::num_requests.name()),
RW_property(ov::hint::use_cpu_pinning.name()),
RW_property(ov::hint::enable_cpu_pinning.name()),
RW_property(ov::hint::scheduling_core_type.name()),
RW_property(ov::hint::use_hyper_threading.name()),
RW_property(ov::hint::enable_hyper_threading.name()),
RW_property(ov::device::id.name()),
};

View File

@ -49,7 +49,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest,
OVClassSetUseHyperThreadingHintConfigTest,
OVClassSetEnableHyperThreadingHintConfigTest,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest,
@ -80,7 +80,7 @@ INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetAvailableDevices, OVClassGetAvailableDevices,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest, OVClassSetUseCpuPinningHintConfigTest, ::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest, OVClassSetEnableCpuPinningHintConfigTest, ::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetModelPriorityConfigTest, OVClassSetModelPriorityConfigTest,

View File

@ -121,9 +121,9 @@ using OVClassLoadNetworkTest = OVClassQueryNetworkTest;
using OVClassSetGlobalConfigTest = OVClassBaseTestP;
using OVClassSetModelPriorityConfigTest = OVClassBaseTestP;
using OVClassSetExecutionModeHintConfigTest = OVClassBaseTestP;
using OVClassSetUseCpuPinningHintConfigTest = OVClassBaseTestP;
using OVClassSetEnableCpuPinningHintConfigTest = OVClassBaseTestP;
using OVClassSetSchedulingCoreTypeHintConfigTest = OVClassBaseTestP;
using OVClassSetUseHyperThreadingHintConfigTest = OVClassBaseTestP;
using OVClassSetEnableHyperThreadingHintConfigTest = OVClassBaseTestP;
using OVClassSetTBBForceTerminatePropertyTest = OVClassBaseTestP;
using OVClassSetLogLevelConfigTest = OVClassBaseTestP;
using OVClassSpecificDeviceTestSetConfig = OVClassBaseTestP;
@ -612,21 +612,21 @@ TEST_P(OVClassSetExecutionModeHintConfigTest, SetConfigNoThrow) {
ASSERT_EQ(ov::hint::ExecutionMode::PERFORMANCE, ie.get_property(target_device, ov::hint::execution_mode));
}
TEST_P(OVClassSetUseCpuPinningHintConfigTest, SetConfigNoThrow) {
TEST_P(OVClassSetEnableCpuPinningHintConfigTest, SetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::use_cpu_pinning);
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::enable_cpu_pinning);
bool defaultMode{};
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::use_cpu_pinning));
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::enable_cpu_pinning));
(void)defaultMode;
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::use_cpu_pinning));
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::enable_cpu_pinning));
ie.set_property(target_device, ov::hint::use_cpu_pinning(false));
ASSERT_EQ(false, ie.get_property(target_device, ov::hint::use_cpu_pinning));
ie.set_property(target_device, ov::hint::use_cpu_pinning(true));
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::use_cpu_pinning));
ie.set_property(target_device, ov::hint::enable_cpu_pinning(false));
ASSERT_EQ(false, ie.get_property(target_device, ov::hint::enable_cpu_pinning));
ie.set_property(target_device, ov::hint::enable_cpu_pinning(true));
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::enable_cpu_pinning));
}
TEST_P(OVClassSetSchedulingCoreTypeHintConfigTest, SetConfigNoThrow) {
@ -648,21 +648,21 @@ TEST_P(OVClassSetSchedulingCoreTypeHintConfigTest, SetConfigNoThrow) {
ASSERT_EQ(ov::hint::SchedulingCoreType::ANY_CORE, ie.get_property(target_device, ov::hint::scheduling_core_type));
}
TEST_P(OVClassSetUseHyperThreadingHintConfigTest, SetConfigNoThrow) {
TEST_P(OVClassSetEnableHyperThreadingHintConfigTest, SetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::use_hyper_threading);
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::enable_hyper_threading);
bool defaultMode{};
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::use_hyper_threading));
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::enable_hyper_threading));
(void)defaultMode;
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::use_hyper_threading));
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::enable_hyper_threading));
ie.set_property(target_device, ov::hint::use_hyper_threading(false));
ASSERT_EQ(false, ie.get_property(target_device, ov::hint::use_hyper_threading));
ie.set_property(target_device, ov::hint::use_hyper_threading(true));
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::use_hyper_threading));
ie.set_property(target_device, ov::hint::enable_hyper_threading(false));
ASSERT_EQ(false, ie.get_property(target_device, ov::hint::enable_hyper_threading));
ie.set_property(target_device, ov::hint::enable_hyper_threading(true));
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::enable_hyper_threading));
}
TEST_P(OVClassSetDevicePriorityConfigTest, SetConfigAndCheckGetConfigNoThrow) {