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:
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief A header file for CPU map scheduling
|
||||
* @file cpu_map_scheduling.hpp
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "openvino/runtime/properties.hpp"
|
||||
|
||||
namespace ov {
|
||||
|
||||
/**
|
||||
* @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_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
|
||||
*/
|
||||
std::vector<std::vector<int>> apply_hyper_threading(bool input_type,
|
||||
const bool input_changed,
|
||||
const std::vector<std::vector<int>> proc_type_table);
|
||||
|
||||
} // namespace ov
|
||||
@@ -351,6 +351,22 @@ inline std::istream& operator>>(std::istream& is, PerformanceMode& performance_m
|
||||
*/
|
||||
static constexpr Property<PerformanceMode> performance_mode{"PERFORMANCE_HINT"};
|
||||
|
||||
/**
|
||||
* @brief This property allows hyper threading during inference.
|
||||
* @ingroup ov_runtime_cpp_prop_api
|
||||
*
|
||||
* Developer can use this property to use or not use hyper threading during inference. If user does not explicitly set
|
||||
* value for this property, OpenVINO may choose any desired value based on internal logic.
|
||||
*
|
||||
* 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));
|
||||
* @endcode
|
||||
*/
|
||||
static constexpr Property<bool> use_hyper_threading{"USE_HYPER_THREADING"};
|
||||
|
||||
/**
|
||||
* @brief (Optional) property that backs the (above) Performance Hints
|
||||
* by giving additional information on how many inference requests the application will be keeping in flight
|
||||
|
||||
28
src/inference/src/dev/threading/cpu_map_scheduling.cpp
Normal file
28
src/inference/src/dev/threading/cpu_map_scheduling.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/runtime/threading/cpu_map_scheduling.hpp"
|
||||
|
||||
#include "ie_system_conf.h"
|
||||
|
||||
namespace ov {
|
||||
|
||||
std::vector<std::vector<int>> apply_hyper_threading(bool input_value,
|
||||
const bool input_changed,
|
||||
const std::vector<std::vector<int>> proc_type_table) {
|
||||
std::vector<std::vector<int>> result_table = proc_type_table;
|
||||
|
||||
if ((proc_type_table[0][HYPER_THREADING_PROC] > 0) &&
|
||||
(((!input_value) && input_changed) || ((!input_changed) && (proc_type_table.size() > 1)))) {
|
||||
for (auto& i : result_table) {
|
||||
i[ALL_PROC] -= i[HYPER_THREADING_PROC];
|
||||
i[HYPER_THREADING_PROC] = 0;
|
||||
}
|
||||
input_value = false;
|
||||
}
|
||||
|
||||
return result_table;
|
||||
}
|
||||
|
||||
} // namespace ov
|
||||
Reference in New Issue
Block a user