Skip to content

Commit

Permalink
Support new windows platform (openvinotoolkit#27809)
Browse files Browse the repository at this point in the history
### Details:
- *support new windows platform which is a VM (VPS) running on a
Hypervisor*
 - *using one stream on two sockets*

### Tickets:
-
*[issues-27581](openvinotoolkit#27581
  • Loading branch information
wangleis authored and 11happy committed Dec 23, 2024
1 parent 2b88dc9 commit 6973b3d
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 75 deletions.
69 changes: 42 additions & 27 deletions src/inference/src/os/win/win_system_conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ void parse_processor_info_win(const char* base_ptr,
_cores = 0;
_blocked_cores = 0;

constexpr int initial_core_type = -1;
constexpr int group_with_2_cores = 2;
constexpr int group_with_4_cores = 4;

PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info = NULL;

auto MaskToList = [&](const KAFFINITY mask_input) {
Expand Down Expand Up @@ -131,7 +135,7 @@ void parse_processor_info_win(const char* base_ptr,
base_proc = _processors;
}

if (2 == list_len) {
if (group_with_2_cores == list_len) {
proc_info = cpu_init_line;
proc_info[CPU_MAP_PROCESSOR_ID] = list[0] + base_proc;
proc_info[CPU_MAP_NUMA_NODE_ID] = _sockets;
Expand Down Expand Up @@ -162,7 +166,11 @@ void parse_processor_info_win(const char* base_ptr,
proc_info[CPU_MAP_CORE_ID] = _cores;
if ((_processors > group_start) && (_processors <= group_end)) {
proc_info[CPU_MAP_CORE_TYPE] = group_type;
proc_info[CPU_MAP_GROUP_ID] = group_id;
if ((group_type == MAIN_CORE_PROC) && (group_end - group_start != 1)) {
proc_info[CPU_MAP_GROUP_ID] = group++;
} else {
proc_info[CPU_MAP_GROUP_ID] = group_id;
}
if (group_id == CPU_BLOCKED) {
proc_info[CPU_MAP_USED_FLAG] = CPU_BLOCKED;
_blocked_cores++;
Expand All @@ -178,7 +186,7 @@ void parse_processor_info_win(const char* base_ptr,
} else if ((info->Relationship == RelationCache) && (info->Cache.Level == 2)) {
MaskToList(info->Cache.GroupMask.Mask);

if (4 == list_len) {
if (group_with_4_cores == list_len) {
if (_processors <= list[list_len - 1] + base_proc) {
group_start = list[0];
group_end = list[list_len - 1];
Expand All @@ -190,38 +198,45 @@ void parse_processor_info_win(const char* base_ptr,
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_GROUP_ID] = group_id;
_proc_type_table[0][EFFICIENT_CORE_PROC]++;
}
} else if ((2 == list_len) && (-1 == _cpu_mapping_table[list[0] + base_proc][CPU_MAP_CORE_TYPE])) {
} else if (group_with_2_cores == list_len) {
if (initial_core_type == _cpu_mapping_table[list[0] + base_proc][CPU_MAP_CORE_TYPE]) {
if (_processors <= list[list_len - 1] + base_proc) {
group_start = list[0];
group_end = list[list_len - 1];
if (_proc_type_table[0][EFFICIENT_CORE_PROC] > 0) {
group_id = CPU_BLOCKED;
group_type = EFFICIENT_CORE_PROC;
_blocked_cores++;
} else {
group_id = group++;
group_type = MAIN_CORE_PROC;
}
}
for (int m = 0; m < _processors - list[0]; m++) {
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_CORE_TYPE] = group_type;
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_GROUP_ID] = group_id;
if (group_id == CPU_BLOCKED) {
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_USED_FLAG] = CPU_BLOCKED;
} else {
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_USED_FLAG] = NOT_USED;
_proc_type_table[0][MAIN_CORE_PROC]++;
}
}
}
} else {
if (_processors <= list[list_len - 1] + base_proc) {
group_start = list[0];
group_end = list[list_len - 1];
if (_proc_type_table[0][EFFICIENT_CORE_PROC] > 0) {
group_id = CPU_BLOCKED;
group_type = EFFICIENT_CORE_PROC;
_blocked_cores++;
} else {
group_id = group++;
group_type = MAIN_CORE_PROC;
}
group_id = group;
group_type = MAIN_CORE_PROC;
}
for (int m = 0; m < _processors - list[0]; m++) {
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_CORE_TYPE] = group_type;
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_GROUP_ID] = group_id;
if (group_id == CPU_BLOCKED) {
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_USED_FLAG] = CPU_BLOCKED;
} else {
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_USED_FLAG] = NOT_USED;
if (_cpu_mapping_table[list[m] + base_proc][CPU_MAP_CORE_TYPE] == initial_core_type) {
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_CORE_TYPE] = MAIN_CORE_PROC;
_cpu_mapping_table[list[m] + base_proc][CPU_MAP_GROUP_ID] = group++;
_proc_type_table[0][MAIN_CORE_PROC]++;
}
}

} else if (1 == list_len) {
if ((_cpu_mapping_table.size() > list[0]) &&
(_cpu_mapping_table[list[0] + base_proc][CPU_MAP_CORE_TYPE] == -1)) {
group_id = group++;
_cpu_mapping_table[list[0] + base_proc][CPU_MAP_CORE_TYPE] = MAIN_CORE_PROC;
_cpu_mapping_table[list[0] + base_proc][CPU_MAP_GROUP_ID] = group_id;
_proc_type_table[0][MAIN_CORE_PROC]++;
}
}
}
}
Expand Down
54 changes: 54 additions & 0 deletions src/inference/tests/unit/cpu_map_parser/parser_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,59 @@ WinCpuMapTestCase _2sockets_48cores = {
"fffff0000"},
};

WinCpuMapTestCase _2sockets_16cores = {
16,
2,
2,
16,
0,
{{16, 16, 0, 0, -1, -1}, {8, 8, 0, 0, 0, 0}, {8, 8, 0, 0, 1, 1}},
{
{0, 0, 0, 0, MAIN_CORE_PROC, 0, -1},
{1, 0, 0, 1, MAIN_CORE_PROC, 1, -1},
{2, 0, 0, 2, MAIN_CORE_PROC, 2, -1},
{3, 0, 0, 3, MAIN_CORE_PROC, 3, -1},
{4, 0, 0, 4, MAIN_CORE_PROC, 4, -1},
{5, 0, 0, 5, MAIN_CORE_PROC, 5, -1},
{6, 0, 0, 6, MAIN_CORE_PROC, 6, -1},
{7, 0, 0, 7, MAIN_CORE_PROC, 7, -1},
{8, 1, 1, 8, MAIN_CORE_PROC, 8, -1},
{9, 1, 1, 9, MAIN_CORE_PROC, 9, -1},
{10, 1, 1, 10, MAIN_CORE_PROC, 10, -1},
{11, 1, 1, 11, MAIN_CORE_PROC, 11, -1},
{12, 1, 1, 12, MAIN_CORE_PROC, 12, -1},
{13, 1, 1, 13, MAIN_CORE_PROC, 13, -1},
{14, 1, 1, 14, MAIN_CORE_PROC, 14, -1},
{15, 1, 1, 15, MAIN_CORE_PROC, 15, -1},
},
{"0300000030000000000000000000000000000000000000000000000000000100ff00000000000000000000000000000000000000300000000"
"00000000000000000000000000000000000000000000100010000000000000000000000000000000200000038000000010840000080000002"
"0000000000000000000000000000000000000000000000ff00000000000000000000000000000002000000380000000108400000800000010"
"000000000000000000000000000000000000000000000ff000000000000000000000000000000020000003800000002044000000004000000"
"00000000000000000000000000000000000000000000ff0000000000000000000000000000000200000038000000031040000000000100000"
"0000000000000000000000000000000000000000000ff00000000000000000000000000000000000000300000000000000000000000000000"
"00000000000000000000000100020000000000000000000000000000000000000030000000000000000000000000000000000000000000000"
"00000010004000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000010008000000"
"00000000000000000000000000000000300000000000000000000000000000000000000000000000000001001000000000000000000000000"
"00000000000000030000000000000000000000000000000000000000000000000000100200000000000000000000000000000000000000030"
"00000000000000000000000000000000000000000000000000010040000000000000000000000000000000000000003000000000000000000"
"00000000000000000000000000000000001008000000000000000000000000000000003000000300000000000000000000000000000000000"
"0000000000000000010000ff00000000000000000000000000000000000030000000000000000000000000000000000000000000000000000"
"10000010000000000000000000000000000020000003800000001084000008000000200000000000000000000000000000000000000000000"
"0000ff00000000000000000000000000000200000038000000010840000080000001000000000000000000000000000000000000000000000"
"000ff000000000000000000000000000002000000380000000204400000000400000000000000000000000000000000000000000000000000"
"00ff0000000000000000000000000000020000003800000003104000000000010000000000000000000000000000000000000000000000000"
"0ff00000000000000000000000000000000000030000000000000000000000000000000000000000000000000000100000200000000000000"
"00000000000000000000003000000000000000000000000000000000000000000000000000010000040000000000000000000000000000000"
"00000300000000000000000000000000000000000000000000000000001000008000000000000000000000000000000000000300000000000"
"00000000000000000000000000000000000000000100001000000000000000000000000000000000000030000000000000000000000000000"
"00000000000000000000000010000200000000000000000000000000000000000003000000000000000000000000000000000000000000000"
"00000001000040000000000000000000000000000000000000300000000000000000000000000000000000000000000000000001000080000"
"00000000000000000000000000100000030000000000000000000000000000000000000000000000000000000ffff00000000000000000000"
"00000000040000005000000001000100000000000000000000000000000000000000000010100000000000000000000000000000000000000"
"000000000000000000000000000000000000000ffff000000000000"},
};

WinCpuMapTestCase _1sockets_24cores_hyperthreading_set1 = {
32,
1,
Expand Down Expand Up @@ -2328,6 +2381,7 @@ INSTANTIATE_TEST_SUITE_P(CPUMap,
_2sockets_48cores_hyperthreading,
_2sockets_36cores_hyperthreading,
_2sockets_48cores,
_2sockets_16cores,
_1sockets_24cores_hyperthreading_set1,
_1sockets_24cores_hyperthreading_set2,
_1sockets_22cores_hyperthreading,
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ std::vector<std::vector<int>> get_streams_info_table(
current_socket_id = input_current_socket_id == -1 ? get_current_socket_id() : input_current_socket_id;
if (input_threads > 0) {
if (hint_model_distribution_policy.size() == 0) {
n_threads_per_stream = std::min(input_threads, proc_type_table[0][ALL_PROC]);
} else {
for (auto& row : proc_socket_table) {
if (current_socket_id == row[PROC_SOCKET_ID]) {
n_threads_per_stream = std::min(input_threads, row[ALL_PROC]);
}
}
} else {
n_threads_per_stream = std::min(input_threads, proc_type_table[0][ALL_PROC]);
}
if (proc_type_table.size() == 1) {
if ((n_threads_per_stream > proc_type_table[0][MAIN_CORE_PROC]) &&
Expand Down
Loading

0 comments on commit 6973b3d

Please sign in to comment.