Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Pcore and Ecore in latency model for specific cpu #27299

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/inference/dev_api/openvino/runtime/system_conf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ OPENVINO_RUNTIME_API int get_number_of_cpu_cores(bool big_cores_only = false);
OPENVINO_RUNTIME_API int get_number_of_logical_cpu_cores(bool big_cores_only = false);

/**
* @brief Returns number of blocked CPU cores. Please note that this is a temporary interface for performance
* optimization on a specific platform. May be removed in future release.
* @brief Returns cpu type for threading scheduling. Please note that this is a temporary interface for
* performance optimization on a specific platform. May be removed in future release.
* @ingroup ov_dev_api_system_conf
* @return Number of blocked CPU cores.
* @return CPU type for threading scheduling.
*/
OPENVINO_RUNTIME_API int get_number_of_blocked_cores();
OPENVINO_RUNTIME_API int get_thread_cpu_type();

/**
* @brief Checks whether CPU supports SSE 4.2 capability
Expand Down Expand Up @@ -341,4 +341,14 @@ enum ColumnOfCPUMappingTable {
CPU_MAP_TABLE_SIZE = 7 //!< Size of CPU mapping table
};

/**
* @enum ThreadCPUType
* @brief This enum contains definition for specific CPU types in threading scheduling.
*
* THREAD_CPU_NORMAL is normal CPU for threading scheduling.
* THEAD_CPU_BLOCK_CORE is the CPU with blocked cores.
* THEAD_CPU_ONE_L3_CACHE is the CPU with one L3 cache for all cores.
*/
enum ThreadCPUType { THREAD_CPU_NORMAL = 0, THEAD_CPU_BLOCK_CORE = 1, THEAD_CPU_ONE_L3_CACHE = 2};

} // namespace ov
6 changes: 3 additions & 3 deletions src/inference/src/os/cpu_map_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CPU {
int _numa_nodes = 0;
int _sockets = 0;
int _cores = 0;
int _blocked_cores = 0;
int _thread_cpu_type = ThreadCPUType::THREAD_CPU_NORMAL;
std::vector<std::vector<int>> _org_proc_type_table;
std::vector<std::vector<int>> _proc_type_table;
std::vector<std::vector<int>> _cpu_mapping_table;
Expand Down Expand Up @@ -156,7 +156,7 @@ void get_cpu_mapping_from_cores(const int _processors,
* @param[out] _numa_nodes total number for nodes in system
* @param[out] _sockets total number for sockets in system
* @param[out] _cores total number for physical CPU cores in system
* @param[out] _blocked_cores total number for blocked processors in system
* @param[out] _thread_cpu_type CPU type for threading scheduling
* @param[out] _proc_type_table summary table of number of processors per type
* @param[out] _cpu_mapping_table CPU mapping table for each processor
* @return
Expand All @@ -167,7 +167,7 @@ void parse_processor_info_win(const char* base_ptr,
int& _numa_nodes,
int& _sockets,
int& _cores,
int& _blocked_cores,
int& _thread_cpu_type,
std::vector<std::vector<int>>& _proc_type_table,
std::vector<std::vector<int>>& _cpu_mapping_table);
#endif
Expand Down
24 changes: 16 additions & 8 deletions src/inference/src/os/win/win_system_conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CPU::CPU() {
_numa_nodes,
_sockets,
_cores,
_blocked_cores,
_thread_cpu_type,
_proc_type_table,
_cpu_mapping_table);
_org_proc_type_table = _proc_type_table;
Expand All @@ -61,7 +61,7 @@ void parse_processor_info_win(const char* base_ptr,
int& _numa_nodes,
int& _sockets,
int& _cores,
int& _blocked_cores,
int& _thread_cpu_type,
std::vector<std::vector<int>>& _proc_type_table,
std::vector<std::vector<int>>& _cpu_mapping_table) {
std::vector<int> list;
Expand All @@ -81,11 +81,13 @@ void parse_processor_info_win(const char* base_ptr,
int group_type = 0;

int num_package = 0;
int num_proc_l3_cache = 0;
int num_blocked_cores = 0;

_processors = 0;
_sockets = 0;
_cores = 0;
_blocked_cores = 0;
_thread_cpu_type = ThreadCPUType::THREAD_CPU_NORMAL;

PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info = NULL;

Expand Down Expand Up @@ -160,7 +162,7 @@ void parse_processor_info_win(const char* base_ptr,
proc_info[CPU_MAP_GROUP_ID] = group_id;
if (group_id == CPU_BLOCKED) {
proc_info[CPU_MAP_USED_FLAG] = CPU_BLOCKED;
_blocked_cores++;
num_blocked_cores++;
} else {
_proc_type_table[0][group_type]++;
}
Expand Down Expand Up @@ -192,7 +194,7 @@ void parse_processor_info_win(const char* base_ptr,
if (_proc_type_table[0][EFFICIENT_CORE_PROC] > 0) {
group_id = CPU_BLOCKED;
group_type = EFFICIENT_CORE_PROC;
_blocked_cores++;
num_blocked_cores++;
} else {
group_id = group++;
group_type = MAIN_CORE_PROC;
Expand All @@ -218,12 +220,18 @@ void parse_processor_info_win(const char* base_ptr,
_proc_type_table[0][MAIN_CORE_PROC]++;
}
}
} else if ((info->Relationship == RelationCache) && (info->Cache.Level == 3)) {
MaskToList(info->Cache.GroupMask.Mask);
num_proc_l3_cache = list_len;
}
}
_sockets++;
_processors -= _blocked_cores;
_cores -= _blocked_cores;
_proc_type_table[0][ALL_PROC] -= _blocked_cores;
_processors -= num_blocked_cores;
_cores -= num_blocked_cores;
_thread_cpu_type = num_blocked_cores > 0 ? ThreadCPUType::THEAD_CPU_BLOCK_CORE
: (_processors == num_proc_l3_cache && _sockets == 1) ? ThreadCPUType::THEAD_CPU_ONE_L3_CACHE
: ThreadCPUType::THREAD_CPU_NORMAL;
_proc_type_table[0][ALL_PROC] -= num_blocked_cores;
if (_sockets > 1) {
_proc_type_table.push_back(_proc_type_table[0]);
_proc_type_table[0] = proc_init_line;
Expand Down
10 changes: 5 additions & 5 deletions src/inference/src/system_conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ int get_number_of_logical_cpu_cores(bool) {
return parallel_get_max_threads();
}

int get_number_of_blocked_cores() {
int get_thread_cpu_type() {
return 0;
}

Expand Down Expand Up @@ -289,9 +289,9 @@ int get_number_of_logical_cpu_cores(bool) {
return parallel_get_max_threads();
}

int get_number_of_blocked_cores() {
int get_thread_cpu_type() {
CPU& cpu = cpu_info();
return cpu._blocked_cores;
return cpu._thread_cpu_type;
}

bool is_cpu_map_available() {
Expand Down Expand Up @@ -482,9 +482,9 @@ int get_number_of_logical_cpu_cores(bool bigCoresOnly) {
return logical_cores;
}

int get_number_of_blocked_cores() {
int get_thread_cpu_type() {
CPU& cpu = cpu_info();
return cpu._blocked_cores;
return cpu._thread_cpu_type;
}

int get_org_socket_id(int socket_id) {
Expand Down
Loading
Loading