OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[CPU] update cpu parser of Linux for docker case (#32994)
Wanglei Shen1fc15e5d8b63
diff --git a/src/inference/src/dev/threading/cpu_streams_executor_internal.cpp b/src/inference/src/dev/threading/cpu_streams_executor_internal.cppindex f2ef521d57a..2c258c3a704 100644--- a/src/inference/src/dev/threading/cpu_streams_executor_internal.cpp+++ b/src/inference/src/dev/threading/cpu_streams_executor_internal.cpp@@ -71,7 +71,11 @@ void get_cur_stream_info(const int stream_id,!ecore_used) { // Latency mode and enable hyper threading in hybrid cores machinestream_type = STREAM_WITH_CORE_TYPE;core_type = MAIN_CORE_PROC;- } else if (proc_type_table.size() > 1 && numa_node_id >= 0) {+ } else if (proc_type_table.size() > 1 && numa_node_id >= 0 &&+ // Both commands "numactl" and "docker run --cpuset-cpus" can restrict the use of numa nodes.+ // Some situation of numa_node_id differs from the original numa_node_id may cause oneTBB to crash+ // when binding cores with numa node id. So not binding cores with numa node id in this case.+ numa_node_id == get_org_numa_id(numa_node_id)) {stream_type = STREAM_WITH_NUMA_ID;}}diff --git a/src/inference/src/dev/threading/executor_manager.cpp b/src/inference/src/dev/threading/executor_manager.cppindex c9c9ed6fe9c..ebc13040e15 100644--- a/src/inference/src/dev/threading/executor_manager.cpp+++ b/src/inference/src/dev/threading/executor_manager.cpp@@ -172,7 +172,7 @@ void ExecutorManagerImpl::clear(const std::string& id) {void ExecutorManagerImpl::execute_task_by_streams_executor(ov::hint::SchedulingCoreType core_type,ov::threading::Task task) {- ov::threading::IStreamsExecutor::Config streamsConfig("StreamsExecutor", 1, 1, core_type);+ ov::threading::IStreamsExecutor::Config streamsConfig("StreamsExecutor", 1, 1, core_type, false, true);if (!streamsConfig.get_streams_info_table().empty()) {auto taskExecutor = std::make_shared<ov::threading::CPUStreamsExecutor>(streamsConfig);std::vector<Task> tasks{std::move(task)};diff --git a/src/inference/src/os/cpu_map_info.hpp b/src/inference/src/os/cpu_map_info.hppindex be6f3c58711..e8a0d314f43 100644--- a/src/inference/src/os/cpu_map_info.hpp+++ b/src/inference/src/os/cpu_map_info.hpp@@ -20,24 +20,38 @@ namespace ov {class CPU {public:CPU();- ~CPU(){};+ ~CPU() {};void cpu_debug() {#ifdef ENABLE_OPENVINO_DEBUGOPENVINO_DEBUG("[ threading ] cpu_mapping_table:");for (size_t i = 0; i < _cpu_mapping_table.size(); i++) {- OPENVINO_DEBUG(_cpu_mapping_table[i][CPU_MAP_PROCESSOR_ID] , " ",- _cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID], " ",- _cpu_mapping_table[i][CPU_MAP_SOCKET_ID], " ", _cpu_mapping_table[i][CPU_MAP_CORE_ID],- " ", _cpu_mapping_table[i][CPU_MAP_CORE_TYPE], " ",- _cpu_mapping_table[i][CPU_MAP_GROUP_ID], " ",+ OPENVINO_DEBUG(_cpu_mapping_table[i][CPU_MAP_PROCESSOR_ID],+ " ",+ _cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID],+ " ",+ _cpu_mapping_table[i][CPU_MAP_SOCKET_ID],+ " ",+ _cpu_mapping_table[i][CPU_MAP_CORE_ID],+ " ",+ _cpu_mapping_table[i][CPU_MAP_CORE_TYPE],+ " ",+ _cpu_mapping_table[i][CPU_MAP_GROUP_ID],+ " ",_cpu_mapping_table[i][CPU_MAP_USED_FLAG]);}OPENVINO_DEBUG("[ threading ] org_proc_type_table:");for (size_t i = 0; i < _proc_type_table.size(); i++) {- OPENVINO_DEBUG(_proc_type_table[i][ALL_PROC], " ", _proc_type_table[i][MAIN_CORE_PROC], " ",- _proc_type_table[i][EFFICIENT_CORE_PROC], " ",- _proc_type_table[i][HYPER_THREADING_PROC], " ", _proc_type_table[i][PROC_NUMA_NODE_ID],- " ", _proc_type_table[i][PROC_SOCKET_ID]);+ OPENVINO_DEBUG(_proc_type_table[i][ALL_PROC],+ " ",+ _proc_type_table[i][MAIN_CORE_PROC],+ " ",+ _proc_type_table[i][EFFICIENT_CORE_PROC],+ " ",+ _proc_type_table[i][HYPER_THREADING_PROC],+ " ",+ _proc_type_table[i][PROC_NUMA_NODE_ID],+ " ",+ _proc_type_table[i][PROC_SOCKET_ID]);}#endif}@@ -53,7 +67,6 @@ public:std::map<int, int> _numaid_mapping_table;std::mutex _cpu_mutex;int _socket_idx = 0;-};CPU& cpu_info();@@ -62,14 +75,14 @@ CPU& cpu_info();/*** @brief Parse nodes information to update _sockets, proc_type_table and cpu_mapping_table on Linux* @param[in] node_info_table nodes information for this platform.- * @param[in] _numa_nodes total number for nodes in system+ * @param[out] _numa_nodes total number for nodes in system* @param[out] _sockets total number for sockets in system* @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*/void parse_node_info_linux(const std::vector<std::string> node_info_table,- const int& _numa_nodes,+ int& _numa_nodes,int& _sockets,std::vector<std::vector<int>>& _proc_type_table,std::vector<std::vector<int>>& _cpu_mapping_table);@@ -121,15 +134,23 @@ void parse_freq_info_linux(const std::vector<std::vector<std::string>> system_in/*** @brief update proc_type_table and cpu_mapping_table for vaild processors.* @param[in] phy_core_list CPU cores id list for physical core of Intel Performance-cores.+ * @param[in] numa_node_per_socket number of numa node per socket.* @param[out] _sockets total number for sockets in system+ * @param[out] _numa_nodes total number for numa nodes in system* @param[out] _cores total number for physical CPU cores in system+ * @param[out] _numaid_mapping_table mapping table of numa node id+ * @param[out] _socketid_mapping_table mapping table of socket id* @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*/void update_valid_processor_linux(const std::vector<int> phy_core_list,+ const int numa_node_per_socket,int& _sockets,+ int& _numa_nodes,int& _cores,+ std::map<int, int>& _numaid_mapping_table,+ std::map<int, int>& _socketid_mapping_table,std::vector<std::vector<int>>& _proc_type_table,std::vector<std::vector<int>>& _cpu_mapping_table);diff --git a/src/inference/src/os/lin/lin_system_conf.cpp b/src/inference/src/os/lin/lin_system_conf.cppindex 91554a54af7..fd145cf79a7 100644--- a/src/inference/src/os/lin/lin_system_conf.cpp+++ b/src/inference/src/os/lin/lin_system_conf.cpp@@ -6,6 +6,7 @@#include <string.h>#include <unistd.h>+#include <algorithm>#include <fstream>#include <iostream>#include <string>@@ -163,78 +164,46 @@ CPU::CPU() {numa_node_list.assign(_sockets, std::vector<int>());for (int i = 0; i < _processors; i++) {- if (CPU_ISSET(_cpu_mapping_table[i][CPU_MAP_PROCESSOR_ID], mask)) {+ if (CPU_ISSET(_cpu_mapping_table[i][CPU_MAP_PROCESSOR_ID], mask) &&+ _cpu_mapping_table[i][CPU_MAP_USED_FLAG] != CPU_BLOCKED) {valid_cpu_mapping_table.emplace_back(_cpu_mapping_table[i]);if (_cpu_mapping_table[i][CPU_MAP_CORE_TYPE] == MAIN_CORE_PROC) {phy_core_list.emplace_back(_cpu_mapping_table[i][CPU_MAP_CORE_ID]);}- if (_sockets > 1) {- if (std::find(socket_list.begin(), socket_list.end(), _cpu_mapping_table[i][CPU_MAP_SOCKET_ID]) ==- socket_list.end()) {- socket_list.push_back(_cpu_mapping_table[i][CPU_MAP_SOCKET_ID]);- }- if (std::find(numa_node_list[_cpu_mapping_table[i][CPU_MAP_SOCKET_ID]].begin(),- numa_node_list[_cpu_mapping_table[i][CPU_MAP_SOCKET_ID]].end(),- _cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID]) ==- numa_node_list[_cpu_mapping_table[i][CPU_MAP_SOCKET_ID]].end()) {- numa_node_list[_cpu_mapping_table[i][CPU_MAP_SOCKET_ID]].push_back(- _cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID]);- }- }- }- }- if (_sockets > 1) {- std::sort(socket_list.begin(), socket_list.end());- for (int n = _sockets - 1; n >= 0; n--) {- if (numa_node_list[n].size() == 0) {- numa_node_list.erase(numa_node_list.begin() + n);- } else {- std::sort(numa_node_list[n].begin(), numa_node_list[n].end());- }- }- std::map<int, int> sockets_map;- std::map<int, int> numa_node_map;- for (int i = 0; i < static_cast<int>(socket_list.size()); i++) {- sockets_map.insert(std::pair<int, int>(socket_list[i], i));- }- for (int i = 0; i < static_cast<int>(numa_node_list.size()); i++) {- for (int j = 0; j < static_cast<int>(numa_node_list[i].size()); j++) {- numa_node_map.insert(std::pair<int, int>(numa_node_list[i][j], i * _numa_nodes / _sockets + j));- }- }- for (size_t i = 0; i < valid_cpu_mapping_table.size(); i++) {- auto new_numa_id = numa_node_map.at(valid_cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID]);- auto new_socket_id = sockets_map.at(valid_cpu_mapping_table[i][CPU_MAP_SOCKET_ID]);- if (_numaid_mapping_table.find(new_numa_id) == _numaid_mapping_table.end()) {- _numaid_mapping_table.insert({new_numa_id, valid_cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID]});- }- if (_socketid_mapping_table.find(new_socket_id) == _socketid_mapping_table.end()) {- _socketid_mapping_table.insert({new_socket_id, valid_cpu_mapping_table[i][CPU_MAP_SOCKET_ID]});- }- valid_cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID] = new_numa_id;- valid_cpu_mapping_table[i][CPU_MAP_SOCKET_ID] = new_socket_id;}}if (valid_cpu_mapping_table.size() == 0) {return -1;- } else if (valid_cpu_mapping_table.size() == (unsigned)_processors) {+ } else if (valid_cpu_mapping_table.size() == _cpu_mapping_table.size() + _blocked_cores &&+ (_numa_nodes == (int)node_info_table.size() || 0 == node_info_table.size())) {+ if (_blocked_cores > 0) {+ std::lock_guard<std::mutex> lock{_cpu_mutex};+ _cpu_mapping_table.swap(valid_cpu_mapping_table);+ }return 0;} else {- _processors = valid_cpu_mapping_table.size();- _cpu_mapping_table.swap(valid_cpu_mapping_table);int cur_numa_nodes = _numa_nodes;int cur_cores = _cores;+ int cur_sockets = _sockets;+ int numa_node_per_socket = node_info_table.size() / _sockets;{std::lock_guard<std::mutex> lock{_cpu_mutex};+ _cpu_mapping_table.swap(valid_cpu_mapping_table);update_valid_processor_linux(std::move(phy_core_list),+ numa_node_per_socket,+ cur_sockets,cur_numa_nodes,cur_cores,+ _numaid_mapping_table,+ _socketid_mapping_table,_proc_type_table,_cpu_mapping_table);}+ _processors = valid_cpu_mapping_table.size();_cores = cur_cores;_numa_nodes = cur_numa_nodes;+ _sockets = cur_sockets;return 0;}};@@ -329,64 +298,110 @@ CPU::CPU() {}void parse_node_info_linux(const std::vector<std::string> node_info_table,- const int& _numa_nodes,+ int& _numa_nodes,int& _sockets,std::vector<std::vector<int>>& _proc_type_table,std::vector<std::vector<int>>& _cpu_mapping_table) {const std::vector<int> line_value_0({0, 0, 0, 0, 0, -1, -1});- std::vector<std::vector<int>> nodes_table;++ std::vector<std::unordered_set<int>> nodes_table;+ std::unordered_set<int> handled_nodes;int node_index = 0;+ int max_node_id = 0;for (auto& one_info : node_info_table) {int core_1 = 0;int core_2 = 0;std::string::size_type pos = 0;- std::string::size_type endpos_1 = 0;- std::string::size_type endpos_2 = 0;+ std::string::size_type endpos = 0;std::string sub_str = "";+ nodes_table.push_back({});- while (pos != std::string::npos) {- endpos_1 = one_info.find(',', pos);- endpos_2 = one_info.find('-', pos);- if ((endpos_1 < endpos_2) || (endpos_1 == std::string::npos && endpos_2 == std::string::npos)) {+ if (((endpos = one_info.find('-', pos)) == std::string::npos) &&+ ((endpos = one_info.find(',', pos)) != std::string::npos)) {+ while (endpos != std::string::npos) {sub_str = one_info.substr(pos);core_1 = std::stoi(sub_str);- nodes_table.push_back({core_1, core_1, node_index});- } else if (endpos_2 != std::string::npos) {- sub_str = one_info.substr(pos, endpos_2 - pos);- core_1 = std::stoi(sub_str);- sub_str = one_info.substr(endpos_2 + 1);- core_2 = std::stoi(sub_str);- nodes_table.push_back({core_1, core_2, node_index});+ nodes_table[node_index].insert(core_1);+ endpos = one_info.find(',', pos);+ pos = endpos + 1;}- if (endpos_1 == std::string::npos) {- break;- } else {- pos = endpos_1 + 1;+ } else {+ while (endpos != std::string::npos) {+ if ((endpos = one_info.find('-', pos)) != std::string::npos) {+ sub_str = one_info.substr(pos, endpos - pos);+ core_1 = std::stoi(sub_str);+ sub_str = one_info.substr(endpos + 1);+ core_2 = std::stoi(sub_str);+ for (int i = core_1; i <= core_2; i++) {+ nodes_table[node_index].insert(i);+ }+ pos = one_info.find(',', endpos);+ if (pos == std::string::npos) {+ break;+ } else {+ pos = pos + 1;+ }+ }}}node_index++;}- _proc_type_table.assign((node_info_table.size() == 1) ? 1 : node_info_table.size() + 1, line_value_0);-- for (auto& row : nodes_table) {- for (int i = row[0]; i <= row[1]; i++) {- _cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID] = row[2];- if (_sockets > _numa_nodes) {- _cpu_mapping_table[i][CPU_MAP_SOCKET_ID] = row[2];+ _proc_type_table.clear();+ max_node_id = nodes_table.size() - 1;++ for (auto& row_cpu_mapping : _cpu_mapping_table) {+ for (size_t n = 0; n < nodes_table.size(); n++) {+ if (nodes_table[n].find(row_cpu_mapping[CPU_MAP_PROCESSOR_ID]) != nodes_table[n].end()) {+ row_cpu_mapping[CPU_MAP_NUMA_NODE_ID] = n;+ node_index = -1;+ for (size_t i = 0; i < _proc_type_table.size(); i++) {+ if (n == static_cast<std::size_t>(_proc_type_table[i][PROC_NUMA_NODE_ID])) {+ node_index = i;+ break;+ }+ }+ if (node_index == -1) {+ _proc_type_table.push_back(line_value_0);+ node_index = _proc_type_table.size() - 1;+ _proc_type_table[node_index][PROC_NUMA_NODE_ID] = row_cpu_mapping[CPU_MAP_NUMA_NODE_ID];+ _proc_type_table[node_index][PROC_SOCKET_ID] = row_cpu_mapping[CPU_MAP_SOCKET_ID] > max_node_id+ ? max_node_id+ : row_cpu_mapping[CPU_MAP_SOCKET_ID];+ }+ _proc_type_table[node_index][ALL_PROC]++;+ _proc_type_table[node_index][row_cpu_mapping[CPU_MAP_CORE_TYPE]]++;+ break;}- _proc_type_table[0][ALL_PROC]++;- _proc_type_table[0][_cpu_mapping_table[i][CPU_MAP_CORE_TYPE]]++;- if (node_info_table.size() != 1) {- _proc_type_table[row[2] + 1][ALL_PROC]++;- _proc_type_table[row[2] + 1][_cpu_mapping_table[i][CPU_MAP_CORE_TYPE]]++;+ }+ row_cpu_mapping[CPU_MAP_SOCKET_ID] = row_cpu_mapping[CPU_MAP_SOCKET_ID] > row_cpu_mapping[CPU_MAP_NUMA_NODE_ID]+ ? row_cpu_mapping[CPU_MAP_NUMA_NODE_ID]+ : row_cpu_mapping[CPU_MAP_SOCKET_ID];+ }++ _numa_nodes = _proc_type_table.size();++ if (_proc_type_table.size() > 1) {+ _proc_type_table.insert(_proc_type_table.begin(), line_value_0);+ _proc_type_table[0][PROC_NUMA_NODE_ID] = _proc_type_table[1][PROC_NUMA_NODE_ID];+ _proc_type_table[0][PROC_SOCKET_ID] = _proc_type_table[1][PROC_SOCKET_ID];++ for (size_t m = 1; m < _proc_type_table.size(); m++) {+ for (int n = 0; n < PROC_NUMA_NODE_ID; n++) {+ _proc_type_table[0][n] += _proc_type_table[m][n];}+ _proc_type_table[0][PROC_NUMA_NODE_ID] =+ _proc_type_table[0][PROC_NUMA_NODE_ID] == _proc_type_table[m][PROC_NUMA_NODE_ID]+ ? _proc_type_table[0][PROC_NUMA_NODE_ID]+ : -1;+ _proc_type_table[0][PROC_SOCKET_ID] =+ _proc_type_table[0][PROC_SOCKET_ID] == _proc_type_table[m][PROC_SOCKET_ID]+ ? _proc_type_table[0][PROC_SOCKET_ID]+ : -1;}- node_index = (node_info_table.size() != 1) ? row[2] + 1 : 0;- _proc_type_table[node_index][PROC_NUMA_NODE_ID] = _cpu_mapping_table[row[0]][CPU_MAP_NUMA_NODE_ID];- _proc_type_table[node_index][PROC_SOCKET_ID] = _cpu_mapping_table[row[0]][CPU_MAP_SOCKET_ID];}+_sockets = (_sockets > _numa_nodes) ? _numa_nodes : _sockets;}@@ -588,15 +603,30 @@ void parse_cache_info_linux(const std::vector<std::vector<std::string>> system_i}}+ for (size_t n = 0; n < offline_list.size(); n++) {+ _cpu_mapping_table.erase(_cpu_mapping_table.begin() + offline_list[n] - n);+ _processors--;+ }+if ((node_info_table.size() == 0) || (node_info_table.size() == (unsigned)_sockets)) {- if (_sockets > 1) {+ if (_proc_type_table.size() > 1) {_proc_type_table.push_back(_proc_type_table[0]);_proc_type_table[0] = line_value_0;+ _proc_type_table[0][PROC_NUMA_NODE_ID] = _proc_type_table[1][PROC_NUMA_NODE_ID];+ _proc_type_table[0][PROC_SOCKET_ID] = _proc_type_table[1][PROC_SOCKET_ID];for (int m = 1; m <= _sockets; m++) {for (int n = 0; n < PROC_NUMA_NODE_ID; n++) {_proc_type_table[0][n] += _proc_type_table[m][n];}+ _proc_type_table[0][PROC_NUMA_NODE_ID] =+ _proc_type_table[0][PROC_NUMA_NODE_ID] == _proc_type_table[m][PROC_NUMA_NODE_ID]+ ? _proc_type_table[0][PROC_NUMA_NODE_ID]+ : -1;+ _proc_type_table[0][PROC_SOCKET_ID] =+ _proc_type_table[0][PROC_SOCKET_ID] == _proc_type_table[m][PROC_SOCKET_ID]+ ? _proc_type_table[0][PROC_SOCKET_ID]+ : -1;}}_numa_nodes = _sockets;@@ -605,11 +635,6 @@ void parse_cache_info_linux(const std::vector<std::vector<std::string>> system_iparse_node_info_linux(node_info_table, _numa_nodes, _sockets, _proc_type_table, _cpu_mapping_table);}- for (size_t n = 0; n < offline_list.size(); n++) {- _cpu_mapping_table.erase(_cpu_mapping_table.begin() + offline_list[n] - n);- _processors--;- }-_processors = _processors - _blocked_cores;};@@ -805,7 +830,6 @@ void parse_freq_info_linux(const std::vector<std::vector<std::string>> system_in}_numa_nodes = _sockets;} else {- _numa_nodes = node_info_table.size();parse_node_info_linux(node_info_table, _numa_nodes, _sockets, _proc_type_table, _cpu_mapping_table);}@@ -816,18 +840,27 @@ void parse_freq_info_linux(const std::vector<std::vector<std::string>> system_in};void update_valid_processor_linux(const std::vector<int> phy_core_list,+ const int numa_node_per_socket,int& _sockets,+ int& _numa_nodes,int& _cores,+ std::map<int, int>& _numaid_mapping_table,+ std::map<int, int>& _socketid_mapping_table,std::vector<std::vector<int>>& _proc_type_table,std::vector<std::vector<int>>& _cpu_mapping_table) {- for (auto& row : _proc_type_table) {- std::fill(row.begin(), row.begin() + PROC_NUMA_NODE_ID, 0);- }_cores = 0;++ std::vector<int> socket_list;+ socket_list.resize(_cpu_mapping_table.size());+ std::vector<std::vector<int>> numa_node_list;+ numa_node_list.resize(_sockets);+ int max_node_node_id = 0;+ const std::vector<int> line_value_0(PROC_TYPE_TABLE_SIZE, 0);+for (auto& row : _cpu_mapping_table) {if (row[CPU_MAP_CORE_TYPE] == HYPER_THREADING_PROC) {- auto iter = std::find(phy_core_list.begin(), phy_core_list.end(), row[CPU_MAP_CORE_ID]);- if (iter == phy_core_list.end()) {+ if (phy_core_list.size() == 0 ||+ phy_core_list.end() == std::find(phy_core_list.begin(), phy_core_list.end(), row[CPU_MAP_CORE_ID])) {row[CPU_MAP_CORE_TYPE] = MAIN_CORE_PROC;_cores++;}@@ -835,29 +868,90 @@ void update_valid_processor_linux(const std::vector<int> phy_core_list,_cores++;}- _proc_type_table[0][ALL_PROC]++;- _proc_type_table[0][row[CPU_MAP_CORE_TYPE]]++;- if (_proc_type_table.size() > 1) {- _proc_type_table[row[CPU_MAP_NUMA_NODE_ID] + 1][ALL_PROC]++;- _proc_type_table[row[CPU_MAP_NUMA_NODE_ID] + 1][row[CPU_MAP_CORE_TYPE]]++;- }+ socket_list.push_back(row[CPU_MAP_SOCKET_ID]);+ numa_node_list[row[CPU_MAP_SOCKET_ID]].push_back(row[CPU_MAP_NUMA_NODE_ID]);+ max_node_node_id = std::max(max_node_node_id, row[CPU_MAP_NUMA_NODE_ID]);}- if (_proc_type_table.size() > 1) {- size_t n = _proc_type_table.size();+ if (numa_node_list.size() == 1) {+ _sockets = 1;+ _numa_nodes = 1;+ _numaid_mapping_table = {{0, 0}};+ _socketid_mapping_table = {{0, 0}};+ _proc_type_table.assign(1, line_value_0);- while (n > 0) {- if (0 == _proc_type_table[n - 1][ALL_PROC]) {- _proc_type_table.erase(_proc_type_table.begin() + n - 1);+ for (auto& row : _cpu_mapping_table) {+ _proc_type_table[0][ALL_PROC]++;+ _proc_type_table[0][row[CPU_MAP_CORE_TYPE]]++;+ }++ } else {+ sort(socket_list.begin(), socket_list.end());+ socket_list.erase(unique(socket_list.begin(), socket_list.end()), socket_list.end());++ _sockets = socket_list.size();++ std::vector<int> socket_map;+ socket_map.resize(_sockets);++ for (int i = 0; i < (int)socket_list.size(); ++i) {+ _socketid_mapping_table.insert({i, socket_list[i]});+ socket_map[socket_list[i]] = i;+ }++ std::vector<int> numa_map;+ numa_map.resize(max_node_node_id + 1);+ std::vector<int> proc_table_map;+ proc_table_map.resize(max_node_node_id + 1);+ int numa_map_id = 0;+ int cur_id = 0;+ max_node_node_id = 0;++ for (int i = 0; i < (int)numa_node_list.size(); ++i) {+ if (numa_node_list[i].size() > 0) {+ sort(numa_node_list[i].begin(), numa_node_list[i].end());+ numa_node_list[i].erase(unique(numa_node_list[i].begin(), numa_node_list[i].end()),+ numa_node_list[i].end());+ numa_map_id = std::max(max_node_node_id, numa_node_per_socket * i);+ for (int n = 0; n < (int)numa_node_list[i].size(); ++n) {+ max_node_node_id = std::max(max_node_node_id, numa_node_list[i][n]);+ numa_map[numa_node_list[i][n]] = numa_map_id;+ proc_table_map[numa_map_id] = cur_id++;+ _numaid_mapping_table.insert({numa_map_id++, numa_node_list[i][n]});+ }+ ++max_node_node_id;}- n--;}- if ((_proc_type_table.size() > 1) && (_proc_type_table[0][ALL_PROC] == _proc_type_table[1][ALL_PROC])) {- _proc_type_table.erase(_proc_type_table.begin());+ for (int r = 0; r < cur_id; ++r) {+ std::fill(_proc_type_table[r].begin(), _proc_type_table[r].end(), 0);+ }+ _proc_type_table.resize(cur_id == 0 ? 1 : cur_id);++ for (auto& row : _cpu_mapping_table) {+ row[CPU_MAP_SOCKET_ID] = socket_map[row[CPU_MAP_SOCKET_ID]];+ row[CPU_MAP_NUMA_NODE_ID] = numa_map[row[CPU_MAP_NUMA_NODE_ID]];++ _proc_type_table[proc_table_map[row[CPU_MAP_NUMA_NODE_ID]]][ALL_PROC]++;+ _proc_type_table[proc_table_map[row[CPU_MAP_NUMA_NODE_ID]]][row[CPU_MAP_CORE_TYPE]]++;+ _proc_type_table[proc_table_map[row[CPU_MAP_NUMA_NODE_ID]]][PROC_NUMA_NODE_ID] = row[CPU_MAP_NUMA_NODE_ID];+ _proc_type_table[proc_table_map[row[CPU_MAP_NUMA_NODE_ID]]][PROC_SOCKET_ID] = row[CPU_MAP_SOCKET_ID];+ }++ _numa_nodes = _proc_type_table.size();++ if (_proc_type_table.size() > 1) {+ _proc_type_table.insert(_proc_type_table.begin(), line_value_0);++ for (int m = 1; m < (int)_proc_type_table.size(); m++) {+ for (int n = 0; n < PROC_NUMA_NODE_ID; n++) {+ _proc_type_table[0][n] += _proc_type_table[m][n];+ }+ _proc_type_table[0][PROC_NUMA_NODE_ID] = 0 == _proc_type_table[m][PROC_NUMA_NODE_ID] ? 0 : -1;+ _proc_type_table[0][PROC_SOCKET_ID] = 0 == _proc_type_table[m][PROC_SOCKET_ID] ? 0 : -1;+ }}}- _sockets = _proc_type_table.size() == 1 ? 1 : _proc_type_table.size() - 1;return;};diff --git a/src/inference/src/system_conf.cpp b/src/inference/src/system_conf.cppindex fbfd82e4eff..d944e4b43be 100644--- a/src/inference/src/system_conf.cpp+++ b/src/inference/src/system_conf.cpp@@ -589,7 +589,7 @@ int get_org_numa_id(int numa_node_id) {if (iter != cpu._numaid_mapping_table.end()) {return iter->second;}- return -1;+ return numa_node_id;}#endifdiff --git a/src/inference/tests/unit/cpu_map_parser/cache_parser_linux.cpp b/src/inference/tests/unit/cpu_map_parser/cache_parser_linux.cppindex 893162820ea..90ca3ba8cbf 100644--- a/src/inference/tests/unit/cpu_map_parser/cache_parser_linux.cpp+++ b/src/inference/tests/unit/cpu_map_parser/cache_parser_linux.cpp@@ -858,8 +858,8 @@ LinuxCpuMapTestCase cache_2sockets_24cores_hyperthreading_1 = {0,{{48, 24, 0, 0, 24, -1, -1},{12, 6, 0, 0, 6, 0, 0},- {12, 6, 0, 0, 6, 1, 0},{12, 6, 0, 0, 6, 2, 1},+ {12, 6, 0, 0, 6, 1, 0},{12, 6, 0, 0, 6, 3, 1}},{{0, 0, 0, 0, HYPER_THREADING_PROC, 0, -1}, {1, 2, 1, 12, HYPER_THREADING_PROC, 12, -1},@@ -1777,6 +1777,844 @@ LinuxCpuMapTestCase cache_mock_2 = {{{"0,2-4,7"}},};+LinuxCpuMapTestCase cache_mock_3 = {+ 16,+ 2,+ 2,+ 16,+ 0,+ {{16, 16, 0, 0, 0, -1, -1}, {8, 8, 0, 0, 0, 0, 0}, {8, 8, 0, 0, 0, 2, 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},+ {64, 2, 1, 8, MAIN_CORE_PROC, 8, -1},+ {65, 2, 1, 9, MAIN_CORE_PROC, 9, -1},+ {66, 2, 1, 10, MAIN_CORE_PROC, 10, -1},+ {67, 2, 1, 11, MAIN_CORE_PROC, 11, -1},+ {68, 2, 1, 12, MAIN_CORE_PROC, 12, -1},+ {69, 2, 1, 13, MAIN_CORE_PROC, 13, -1},+ {70, 2, 1, 14, MAIN_CORE_PROC, 14, -1},+ {71, 2, 1, 15, MAIN_CORE_PROC, 15, -1},+ },+ {+ {"0,128", "0,128", "0-63,128-191"},+ {"1,129", "1,129", "0-63,128-191"},+ {"2,130", "2,130", "0-63,128-191"},+ {"3,131", "3,131", "0-63,128-191"},+ {"4,132", "4,132", "0-63,128-191"},+ {"5,133", "5,133", "0-63,128-191"},+ {"6,134", "6,134", "0-63,128-191"},+ {"7,135", "7,135", "0-63,128-191"},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"64,192", "64,192", "64-127,192-255"},+ {"65,193", "65,193", "64-127,192-255"},+ {"66,194", "66,194", "64-127,192-255"},+ {"67,195", "67,195", "64-127,192-255"},+ {"68,196", "68,196", "64-127,192-255"},+ {"69,197", "69,197", "64-127,192-255"},+ {"70,198", "70,198", "64-127,192-255"},+ {"71,199", "71,199", "64-127,192-255"},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ },+ {{"0-31,128-159"}, {"32-63,160-191"}, {"64-95,192-223"}, {"96-127,224-255"}},+};++LinuxCpuMapTestCase cache_mock_4 = {+ 8,+ 2,+ 2,+ 8,+ 0,+ {{8, 8, 0, 0, 0, -1, -1}, {4, 4, 0, 0, 0, 1, 0}, {4, 4, 0, 0, 0, 3, 1}},+ {+ {60, 1, 0, 0, MAIN_CORE_PROC, 0, -1},+ {61, 1, 0, 1, MAIN_CORE_PROC, 1, -1},+ {62, 1, 0, 2, MAIN_CORE_PROC, 2, -1},+ {63, 1, 0, 3, MAIN_CORE_PROC, 3, -1},+ {224, 3, 1, 4, MAIN_CORE_PROC, 4, -1},+ {225, 3, 1, 5, MAIN_CORE_PROC, 5, -1},+ {226, 3, 1, 6, MAIN_CORE_PROC, 6, -1},+ {227, 3, 1, 7, MAIN_CORE_PROC, 7, -1},+ },+ {+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"60,188", "60,188", "0-63,128-191"},+ {"61,189", "61,189", "0-63,128-191"},+ {"62,190", "62,190", "0-63,128-191"},+ {"63,191", "63,191", "0-63,128-191"},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"96,224", "96,224", "64-127,192-255"},+ {"97,225", "97,225", "64-127,192-255"},+ {"98,226", "98,226", "64-127,192-255"},+ {"99,227", "99,227", "64-127,192-255"},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ },+ {{"0-31,128-159"}, {"32-63,160-191"}, {"64-95,192-223"}, {"96-127,224-255"}},+};++LinuxCpuMapTestCase cache_mock_5 = {+ 4,+ 2,+ 1,+ 4,+ 0,+ {{4, 4, 0, 0, 0, -1, 0}, {2, 2, 0, 0, 0, 0, 0}, {2, 2, 0, 0, 0, 1, 0}},+ {+ {28, 0, 0, 0, MAIN_CORE_PROC, 0, -1},+ {29, 0, 0, 1, MAIN_CORE_PROC, 1, -1},+ {160, 1, 0, 2, MAIN_CORE_PROC, 2, -1},+ {161, 1, 0, 3, MAIN_CORE_PROC, 3, -1},+ },+ {+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"28,156", "28,156", "0-63,128-191"},+ {"29,157", "29,157", "0-63,128-191"},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"32,160", "32,160", "0-63,128-191"},+ {"33,161", "33,161", "0-63,128-191"},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ {"", "", ""},+ },+ {{"0-31,128-159"}, {"32-63,160-191"}, {"64-95,192-223"}, {"96-127,224-255"}},+};+TEST_P(LinuxCpuMapCacheParserTests, LinuxCache) {}INSTANTIATE_TEST_SUITE_P(CPUMap,@@ -1810,7 +2648,10 @@ INSTANTIATE_TEST_SUITE_P(CPUMap,cache_VM_cache_0,cache_mock_0,cache_mock_1,- cache_mock_2));+ cache_mock_2,+ cache_mock_3,+ cache_mock_4,+ cache_mock_5));TEST_P(LinuxGetCpuMapFromCoresTests, LinuxCore) {}diff --git a/src/inference/tests/unit/cpu_map_parser/freq_parser_linux.cpp b/src/inference/tests/unit/cpu_map_parser/freq_parser_linux.cppindex cf74cc9c0a5..1ba5c8f5951 100644--- a/src/inference/tests/unit/cpu_map_parser/freq_parser_linux.cpp+++ b/src/inference/tests/unit/cpu_map_parser/freq_parser_linux.cpp@@ -679,8 +679,8 @@ LinuxCpuMapTestCase freq_2sockets_24cores_hyperthreading_1 = {24,{{48, 24, 0, 0, 24, -1, -1},{12, 6, 0, 0, 6, 0, 0},- {12, 6, 0, 0, 6, 1, 0},{12, 6, 0, 0, 6, 2, 1},+ {12, 6, 0, 0, 6, 1, 0},{12, 6, 0, 0, 6, 3, 1}},{{0, 0, 0, 0, HYPER_THREADING_PROC, 0, -1}, {1, 2, 1, 1, HYPER_THREADING_PROC, 1, -1},diff --git a/src/inference/tests/unit/cpu_map_parser/valid_proc_check.cpp b/src/inference/tests/unit/cpu_map_parser/valid_proc_check.cppindex 3f5a07230e2..e52ff9bcf88 100644--- a/src/inference/tests/unit/cpu_map_parser/valid_proc_check.cpp+++ b/src/inference/tests/unit/cpu_map_parser/valid_proc_check.cpp@@ -19,8 +19,12 @@ struct LinuxNumactlTestCase {std::vector<int> phy_core_list;std::vector<std::vector<int>> input_proc_type_table;std::vector<std::vector<int>> input_cpu_mapping_table;+ int numa_node_per_socket;int _sockets;+ int _numa_nodes;int _cores;+ std::map<int, int> _numaid_mapping_table;+ std::map<int, int> _socketid_mapping_table;std::vector<std::vector<int>> _proc_type_table;std::vector<std::vector<int>> _cpu_mapping_table;};@@ -31,19 +35,29 @@ public:void SetUp() override {const auto& test_data = std::get<0>(GetParam());- int test_sockets = 0;- int test_cores = 0;+ int test_sockets = test_data._sockets;+ int test_numa_nodes = test_data._numa_nodes;+ int test_cores = test_data._cores;+ std::map<int, int> test_numaid_mapping_table;+ std::map<int, int> test_socketid_mapping_table;auto test_proc_type_table = test_data.input_proc_type_table;auto test_cpu_mapping_table = test_data.input_cpu_mapping_table;update_valid_processor_linux(test_data.phy_core_list,+ test_data.numa_node_per_socket,test_sockets,+ test_numa_nodes,test_cores,+ test_numaid_mapping_table,+ test_socketid_mapping_table,test_proc_type_table,test_cpu_mapping_table);ASSERT_EQ(test_data._sockets, test_sockets);+ ASSERT_EQ(test_data._numa_nodes, test_numa_nodes);ASSERT_EQ(test_data._cores, test_cores);+ ASSERT_EQ(test_data._numaid_mapping_table, test_numaid_mapping_table);+ ASSERT_EQ(test_data._socketid_mapping_table, test_socketid_mapping_table);ASSERT_EQ(test_data._proc_type_table, test_proc_type_table);ASSERT_EQ(test_data._cpu_mapping_table, test_cpu_mapping_table);}@@ -63,9 +77,15 @@ LinuxNumactlTestCase numactl_2sockets_20cores_hyperthreading_1 = {{6, 0, 0, 6, HYPER_THREADING_PROC, 6, -1},}, // param[in]: This simulation case select logcial processor 0, 2, 4 and 6 which is marked as logcial core of// Pcore in original cpu_mapping_table.+ 2, // param[in]: number of numa node per socket.1, // param[expected out]: Since all selected logical processors are in one socket, the number of sockets changes// to 1.- 4, // param[expected out]: Since only 4 logical processors are selected, the number of cores changes to 4.+ 1, // param[expected out]: Since all selected logical processors are in one numa node, the number of numa nodes+ // changes+ // to 1.+ 4, // param[expected out]: Since only 4 logical processors are selected, the number of cores changes to 4.+ {{0, 0}}, // param[expected out]: Since processors are in numa node 0, the numa node mapping table is {0, 0}.+ {{0, 0}}, // param[expected out]: Since processors are in socket 0, the socket mapping table is {0, 0}.{{4, 4, 0, 0, 0, 0, 0}}, // param[expected out]: The proc_type_table changes to 4 Pcores only{{0, 0, 0, 0, MAIN_CORE_PROC, 0, -1},@@ -83,8 +103,12 @@ LinuxNumactlTestCase numactl_2sockets_20cores_hyperthreading_2 = {{25, 0, 0, 5, MAIN_CORE_PROC, 5, -1},{27, 0, 0, 7, MAIN_CORE_PROC, 7, -1},},+ 2,+ 1,1,4,+ {{0, 0}},+ {{0, 0}},{{4, 4, 0, 0, 0, 0, 0}},{{21, 0, 0, 1, MAIN_CORE_PROC, 1, -1},@@ -106,8 +130,12 @@ LinuxNumactlTestCase numactl_2sockets_20cores_hyperthreading_3 = {{25, 0, 0, 5, MAIN_CORE_PROC, 5, -1},{27, 0, 0, 7, MAIN_CORE_PROC, 7, -1},},+ 2,+ 1,1,8,+ {{0, 0}},+ {{0, 0}},{{8, 8, 0, 0, 0, 0, 0}},{{0, 0, 0, 0, MAIN_CORE_PROC, 0, -1},@@ -133,8 +161,12 @@ LinuxNumactlTestCase numactl_2sockets_20cores_hyperthreading_4 = {{24, 0, 0, 4, MAIN_CORE_PROC, 4, -1},{26, 0, 0, 6, MAIN_CORE_PROC, 6, -1},},+ 2,+ 1,1,4,+ {{0, 0}},+ {{0, 0}},{{8, 4, 0, 0, 4, 0, 0}},{{0, 0, 0, 0, HYPER_THREADING_PROC, 0, -1},@@ -160,8 +192,12 @@ LinuxNumactlTestCase numactl_2sockets_20cores_hyperthreading_5 = {{14, 1, 1, 14, HYPER_THREADING_PROC, 14, -1},{16, 1, 1, 16, HYPER_THREADING_PROC, 16, -1},},+ 1,+ 2,2,8,+ {{0, 0}, {1, 1}},+ {{0, 0}, {1, 1}},{{8, 8, 0, 0, 0, -1, -1}, {4, 4, 0, 0, 0, 0, 0}, {4, 4, 0, 0, 0, 1, 1}},{{0, 0, 0, 0, MAIN_CORE_PROC, 0, -1},@@ -187,8 +223,12 @@ LinuxNumactlTestCase numactl_2sockets_20cores_hyperthreading_6 = {{34, 1, 1, 14, MAIN_CORE_PROC, 14, -1},{36, 1, 1, 16, MAIN_CORE_PROC, 16, -1},},+ 1,+ 2,2,8,+ {{0, 0}, {1, 1}},+ {{0, 0}, {1, 1}},{{8, 8, 0, 0, 0, -1, -1}, {4, 4, 0, 0, 0, 0, 0}, {4, 4, 0, 0, 0, 1, 1}},{{20, 0, 0, 0, MAIN_CORE_PROC, 0, -1},@@ -214,8 +254,12 @@ LinuxNumactlTestCase numactl_2sockets_20cores_hyperthreading_7 = {{24, 0, 0, 4, MAIN_CORE_PROC, 4, -1},{26, 0, 0, 6, MAIN_CORE_PROC, 6, -1},},+ 1,+ 2,2,8,+ {{0, 0}, {1, 1}},+ {{0, 0}, {1, 1}},{{8, 8, 0, 0, 0, -1, -1}, {4, 4, 0, 0, 0, 0, 0}, {4, 4, 0, 0, 0, 1, 1}},{{10, 1, 1, 10, MAIN_CORE_PROC, 10, -1},@@ -249,8 +293,12 @@ LinuxNumactlTestCase numactl_2sockets_20cores_hyperthreading_8 = {{34, 1, 1, 14, MAIN_CORE_PROC, 14, -1},{36, 1, 1, 16, MAIN_CORE_PROC, 16, -1},},+ 1,+ 2,2,8,+ {{0, 0}, {1, 1}},+ {{0, 0}, {1, 1}},{{16, 8, 0, 0, 8, -1, -1}, {8, 4, 0, 0, 4, 0, 0}, {8, 4, 0, 0, 4, 1, 1}},{{0, 0, 0, 0, HYPER_THREADING_PROC, 0, -1},@@ -281,7 +329,11 @@ LinuxNumactlTestCase numactl_1sockets_16cores_hyperthreading_1 = {{19, 0, 0, 11, EFFICIENT_CORE_PROC, 11, -1},},1,+ 1,+ 1,4,+ {{0, 0}},+ {{0, 0}},{{4, 0, 4, 0, 0, 0, 0}},{{16, 0, 0, 8, EFFICIENT_CORE_PROC, 8, -1},@@ -304,7 +356,11 @@ LinuxNumactlTestCase numactl_1sockets_16cores_hyperthreading_2 = {{19, 0, 0, 11, EFFICIENT_CORE_PROC, 11, -1},},1,+ 1,+ 1,8,+ {{0, 0}},+ {{0, 0}},{{8, 4, 4, 0, 0, 0, 0}},{{0, 0, 0, 0, MAIN_CORE_PROC, 0, -1},@@ -331,7 +387,11 @@ LinuxNumactlTestCase numactl_1sockets_16cores_hyperthreading_3 = {{19, 0, 0, 11, EFFICIENT_CORE_PROC, 11, -1},},1,+ 1,+ 1,8,+ {{0, 0}},+ {{0, 0}},{{8, 4, 4, 0, 0, 0, 0}},{{1, 0, 0, 0, MAIN_CORE_PROC, 0, -1},@@ -362,7 +422,11 @@ LinuxNumactlTestCase numactl_1sockets_16cores_hyperthreading_4 = {{19, 0, 0, 11, EFFICIENT_CORE_PROC, 11, -1},},1,+ 1,+ 1,8,+ {{0, 0}},+ {{0, 0}},{{12, 4, 4, 0, 4, 0, 0}},{{0, 0, 0, 0, HYPER_THREADING_PROC, 0, -1},@@ -397,7 +461,11 @@ LinuxNumactlTestCase numactl_1sockets_16cores_hyperthreading_5 = {{19, 0, 0, 11, EFFICIENT_CORE_PROC, 11, -1},},1,+ 1,+ 1,12,+ {{0, 0}},+ {{0, 0}},{{12, 8, 4, 0, 0, 0, 0}},{{1, 0, 0, 0, MAIN_CORE_PROC, 0, -1},@@ -414,6 +482,146 @@ LinuxNumactlTestCase numactl_1sockets_16cores_hyperthreading_5 = {{19, 0, 0, 11, EFFICIENT_CORE_PROC, 11, -1},},};+LinuxNumactlTestCase mock_1 = {+ {0, 1, 2, 3, 68, 69, 70, 71},+ {{8, 8, 0, 0, 0, -1, -1}, {4, 4, 0, 0, 0, 0, 0}, {4, 4, 0, 0, 0, 2, 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},+ {68, 2, 1, 4, MAIN_CORE_PROC, 4, -1},+ {69, 2, 1, 5, MAIN_CORE_PROC, 5, -1},+ {70, 2, 1, 6, MAIN_CORE_PROC, 6, -1},+ {71, 2, 1, 7, MAIN_CORE_PROC, 7, -1},+ },+ 2,+ 2,+ 2,+ 8,+ {{0, 0}, {2, 2}},+ {{0, 0}, {1, 1}},+ {{8, 8, 0, 0, 0, -1, -1}, {4, 4, 0, 0, 0, 0, 0}, {4, 4, 0, 0, 0, 2, 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},+ {68, 2, 1, 4, MAIN_CORE_PROC, 4, -1},+ {69, 2, 1, 5, MAIN_CORE_PROC, 5, -1},+ {70, 2, 1, 6, MAIN_CORE_PROC, 6, -1},+ {71, 2, 1, 7, MAIN_CORE_PROC, 7, -1},+ },+};+LinuxNumactlTestCase mock_2 = {+ {0, 1, 2, 3, 68, 69, 70, 71},+ {{8, 8, 0, 0, 0, -1, -1}, {4, 4, 0, 0, 0, 1, 0}, {4, 4, 0, 0, 0, 3, 1}},+ {+ {60, 1, 0, 0, MAIN_CORE_PROC, 0, -1},+ {61, 1, 0, 1, MAIN_CORE_PROC, 1, -1},+ {62, 1, 0, 2, MAIN_CORE_PROC, 2, -1},+ {63, 1, 0, 3, MAIN_CORE_PROC, 3, -1},+ {224, 3, 1, 4, MAIN_CORE_PROC, 4, -1},+ {225, 3, 1, 5, MAIN_CORE_PROC, 5, -1},+ {226, 3, 1, 6, MAIN_CORE_PROC, 6, -1},+ {227, 3, 1, 7, MAIN_CORE_PROC, 7, -1},+ },+ 2,+ 2,+ 2,+ 8,+ {{0, 1}, {2, 3}},+ {{0, 0}, {1, 1}},+ {{8, 8, 0, 0, 0, -1, -1}, {4, 4, 0, 0, 0, 0, 0}, {4, 4, 0, 0, 0, 2, 1}},+ {+ {60, 0, 0, 0, MAIN_CORE_PROC, 0, -1},+ {61, 0, 0, 1, MAIN_CORE_PROC, 1, -1},+ {62, 0, 0, 2, MAIN_CORE_PROC, 2, -1},+ {63, 0, 0, 3, MAIN_CORE_PROC, 3, -1},+ {224, 2, 1, 4, MAIN_CORE_PROC, 4, -1},+ {225, 2, 1, 5, MAIN_CORE_PROC, 5, -1},+ {226, 2, 1, 6, MAIN_CORE_PROC, 6, -1},+ {227, 2, 1, 7, MAIN_CORE_PROC, 7, -1},+ },+};+LinuxNumactlTestCase mock_3 = {+ {0, 1, 2, 3, 68, 69, 70, 71},+ {{8, 8, 0, 0, 0, -1, -1},+ {2, 2, 0, 0, 0, 1, 0},+ {2, 2, 0, 0, 0, 3, 0},+ {2, 2, 0, 0, 0, 5, 1},+ {2, 2, 0, 0, 0, 7, 1}},+ {+ {60, 1, 0, 0, MAIN_CORE_PROC, 0, -1},+ {61, 1, 0, 1, MAIN_CORE_PROC, 1, -1},+ {62, 3, 0, 2, MAIN_CORE_PROC, 2, -1},+ {63, 3, 0, 3, MAIN_CORE_PROC, 3, -1},+ {224, 5, 1, 4, MAIN_CORE_PROC, 4, -1},+ {225, 5, 1, 5, MAIN_CORE_PROC, 5, -1},+ {226, 7, 1, 6, MAIN_CORE_PROC, 6, -1},+ {227, 7, 1, 7, MAIN_CORE_PROC, 7, -1},+ },+ 1,+ 2,+ 4,+ 8,+ {{0, 1}, {1, 3}, {4, 5}, {5, 7}},+ {{0, 0}, {1, 1}},+ {{8, 8, 0, 0, 0, -1, -1},+ {2, 2, 0, 0, 0, 0, 0},+ {2, 2, 0, 0, 0, 1, 0},+ {2, 2, 0, 0, 0, 4, 1},+ {2, 2, 0, 0, 0, 5, 1}},+ {+ {60, 0, 0, 0, MAIN_CORE_PROC, 0, -1},+ {61, 0, 0, 1, MAIN_CORE_PROC, 1, -1},+ {62, 1, 0, 2, MAIN_CORE_PROC, 2, -1},+ {63, 1, 0, 3, MAIN_CORE_PROC, 3, -1},+ {224, 4, 1, 4, MAIN_CORE_PROC, 4, -1},+ {225, 4, 1, 5, MAIN_CORE_PROC, 5, -1},+ {226, 5, 1, 6, MAIN_CORE_PROC, 6, -1},+ {227, 5, 1, 7, MAIN_CORE_PROC, 7, -1},+ },+};+LinuxNumactlTestCase mock_4 = {+ {0, 1, 2, 3, 68, 69, 70, 71},+ {{8, 8, 0, 0, 0, -1, -1},+ {2, 2, 0, 0, 0, 1, 0},+ {2, 2, 0, 0, 0, 3, 0},+ {2, 2, 0, 0, 0, 5, 1},+ {2, 2, 0, 0, 0, 7, 1}},+ {+ {60, 1, 0, 0, MAIN_CORE_PROC, 0, -1},+ {61, 1, 0, 1, MAIN_CORE_PROC, 1, -1},+ {62, 3, 0, 2, MAIN_CORE_PROC, 2, -1},+ {63, 3, 0, 3, MAIN_CORE_PROC, 3, -1},+ {224, 5, 1, 4, MAIN_CORE_PROC, 4, -1},+ {225, 5, 1, 5, MAIN_CORE_PROC, 5, -1},+ {226, 7, 1, 6, MAIN_CORE_PROC, 6, -1},+ {227, 7, 1, 7, MAIN_CORE_PROC, 7, -1},+ },+ 5,+ 2,+ 4,+ 8,+ {{0, 1}, {1, 3}, {5, 5}, {6, 7}},+ {{0, 0}, {1, 1}},+ {{8, 8, 0, 0, 0, -1, -1},+ {2, 2, 0, 0, 0, 0, 0},+ {2, 2, 0, 0, 0, 1, 0},+ {2, 2, 0, 0, 0, 5, 1},+ {2, 2, 0, 0, 0, 6, 1}},+ {+ {60, 0, 0, 0, MAIN_CORE_PROC, 0, -1},+ {61, 0, 0, 1, MAIN_CORE_PROC, 1, -1},+ {62, 1, 0, 2, MAIN_CORE_PROC, 2, -1},+ {63, 1, 0, 3, MAIN_CORE_PROC, 3, -1},+ {224, 5, 1, 4, MAIN_CORE_PROC, 4, -1},+ {225, 5, 1, 5, MAIN_CORE_PROC, 5, -1},+ {226, 6, 1, 6, MAIN_CORE_PROC, 6, -1},+ {227, 6, 1, 7, MAIN_CORE_PROC, 7, -1},+ },+};TEST_P(LinuxCpuMapNumactlTests, LinuxCpuMapNumactl) {}@@ -431,7 +639,11 @@ INSTANTIATE_TEST_SUITE_P(CPUMap,numactl_1sockets_16cores_hyperthreading_2,numactl_1sockets_16cores_hyperthreading_3,numactl_1sockets_16cores_hyperthreading_4,- numactl_1sockets_16cores_hyperthreading_5));+ numactl_1sockets_16cores_hyperthreading_5,+ mock_1,+ mock_2,+ mock_3,+ mock_4));#endif} // namespace