enable new property ov::hint::use_hyper_threading (#16176)
* enable apply_processor_type() * declare PROCESSOR_TYPE * enable readProperties * test case for get_property() * enable set_property() and test cases * reduce changes * fix code style issue * fix python test case issue * remove python interface * move processor type definition out of dev_api * refine coding * add dependency * update header file * update description * merge intel_cpu header file * add inline in-code documentation * change 'UNDEFINED' to 'DEFAULT' * remove ProcTypeConfig * refine change * refine change * enable new property use hyper threading * update description * resume legacy code * change to ov::hint namespace * update including header file * update C API and Python API * update description for comments * update test case for comments * update function location for comments * fix typo * fix typo * fix code style issue and update test case * move cpu_map_scheduling into threading folder
This commit is contained in:
@@ -119,6 +119,13 @@ ov_property_key_affinity;
|
||||
OPENVINO_C_VAR(const char*)
|
||||
ov_property_key_inference_num_threads;
|
||||
|
||||
/**
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* @brief Read-write property, it is high-level OpenVINO Performance Hints
|
||||
* @ingroup ov_property_c_api
|
||||
|
||||
@@ -23,6 +23,7 @@ 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_hyper_threading = "USE_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";
|
||||
|
||||
@@ -259,6 +259,22 @@ TEST_P(ov_core_test, ov_core_set_property_enum_invalid) {
|
||||
OV_EXPECT_OK(ov_core_get_property(core, device_name.c_str(), key, &ret));
|
||||
EXPECT_STRNE(invalid_mode, ret);
|
||||
ov_free(ret);
|
||||
|
||||
const char* key_ht = ov_property_key_hint_use_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;
|
||||
OV_EXPECT_OK(ov_core_get_property(core, device_name.c_str(), key_ht, &ret));
|
||||
EXPECT_STREQ(val_ht, ret);
|
||||
ov_free(ret);
|
||||
|
||||
const char* invalid_val = "INVALID_VAL";
|
||||
OV_EXPECT_NOT_OK(ov_core_set_property(core, device_name.c_str(), key_ht, invalid_val));
|
||||
ret = nullptr;
|
||||
OV_EXPECT_OK(ov_core_get_property(core, device_name.c_str(), key_ht, &ret));
|
||||
EXPECT_STRNE(invalid_val, ret);
|
||||
ov_free(ret);
|
||||
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
@@ -276,6 +292,14 @@ TEST_P(ov_core_test, ov_core_set_and_get_property_enum) {
|
||||
EXPECT_STREQ(affinity, ret);
|
||||
ov_free(ret);
|
||||
|
||||
const char* key_ht = ov_property_key_hint_use_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;
|
||||
OV_EXPECT_OK(ov_core_get_property(core, device_name.c_str(), key_ht, &ret));
|
||||
EXPECT_STREQ(val_ht, ret);
|
||||
ov_free(ret);
|
||||
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ 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_hyper_threading, "use_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");
|
||||
|
||||
@@ -219,6 +219,16 @@ def test_properties_ro(ov_property_ro, expected_value):
|
||||
"PERFORMANCE_HINT",
|
||||
((properties.hint.PerformanceMode.UNDEFINED, properties.hint.PerformanceMode.UNDEFINED),),
|
||||
),
|
||||
(
|
||||
properties.hint.use_hyper_threading,
|
||||
"USE_HYPER_THREADING",
|
||||
(
|
||||
(True, True),
|
||||
(False, False),
|
||||
(1, True),
|
||||
(0, False),
|
||||
),
|
||||
),
|
||||
(
|
||||
properties.hint.execution_mode,
|
||||
"EXECUTION_MODE_HINT",
|
||||
@@ -399,6 +409,7 @@ def test_single_property_setting(device):
|
||||
properties.affinity(properties.Affinity.NONE),
|
||||
properties.inference_precision(Type.f32),
|
||||
properties.hint.performance_mode(properties.hint.PerformanceMode.LATENCY),
|
||||
properties.hint.use_hyper_threading(True),
|
||||
properties.hint.num_requests(12),
|
||||
properties.streams.num(5),
|
||||
],
|
||||
@@ -411,6 +422,7 @@ def test_single_property_setting(device):
|
||||
properties.affinity(): properties.Affinity.NONE,
|
||||
properties.inference_precision(): Type.f32,
|
||||
properties.hint.performance_mode(): properties.hint.PerformanceMode.LATENCY,
|
||||
properties.hint.use_hyper_threading(): True,
|
||||
properties.hint.num_requests(): 12,
|
||||
properties.streams.num(): 5,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user