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

Update proc_type_table in compile_model() #28117

Closed
Closed
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
7 changes: 7 additions & 0 deletions src/inference/dev_api/openvino/runtime/system_conf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ OPENVINO_RUNTIME_API std::vector<std::vector<int>> get_proc_type_table();
*/
OPENVINO_RUNTIME_API int get_current_socket_id();

/**
* @brief Returns the numa node ID in cpu mapping table of the currently running thread.
* @ingroup ov_dev_api_system_conf
* @return numa node ID in cpu mapping
*/
OPENVINO_RUNTIME_API int get_current_numa_node_id();

/**
* @brief Returns a table of original number of processor types without filtering other plugins occupying CPU
* resources. The difference from get_proc_type_table: This is used to get the configuration of current machine. For
Expand Down
32 changes: 0 additions & 32 deletions src/inference/src/os/cpu_map_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,6 @@ class CPU {
std::mutex _cpu_mutex;
int _socket_idx = 0;

private:
/**
* @brief Sort proc_type_table by CPU ID on which application is running. The numa node containing this CPU ID
* will move to first row.
* @param[in] _processor_id CPU ID on which application is running.
* @param[in] _proc_type_table summary table of number of processors per type
* @param[in] _cpu_mapping_table CPU mapping table for each processor
* @return
*/
void sort_table_by_cpu_id(const int _processor_id,
std::vector<std::vector<int>>& _proc_type_table,
const std::vector<std::vector<int>>& _cpu_mapping_table) {
int current_numa_node = 0;
int current_socket = 0;

for (auto& row : _cpu_mapping_table) {
if (_processor_id == row[CPU_MAP_PROCESSOR_ID]) {
current_numa_node = row[CPU_MAP_NUMA_NODE_ID];
current_socket = row[CPU_MAP_SOCKET_ID];
break;
}
}
for (size_t i = 1; i < _proc_type_table.size(); i++) {
if ((current_numa_node == _proc_type_table[i][PROC_NUMA_NODE_ID]) &&
(current_socket == _proc_type_table[i][PROC_SOCKET_ID])) {
std::rotate(_proc_type_table.begin() + 1, _proc_type_table.begin() + i, _proc_type_table.end());
break;
}
}
};

friend class LinuxSortProcTableTests;
};

CPU& cpu_info();
Expand Down
5 changes: 0 additions & 5 deletions src/inference/src/os/lin/lin_system_conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,6 @@ CPU::CPU() {
OPENVINO_THROW("CPU affinity check failed. No CPU is eligible to run inference.");
};

if (_proc_type_table.size() > 1) {
int cur_processor_id = sched_getcpu();
sort_table_by_cpu_id(cur_processor_id, _proc_type_table, _cpu_mapping_table);
}

_org_proc_type_table = _proc_type_table;

cpu_debug();
Expand Down
5 changes: 0 additions & 5 deletions src/inference/src/os/win/win_system_conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ CPU::CPU() {
}
}

if (_proc_type_table.size() > 1) {
int cur_processor_id = GetCurrentProcessorNumber();
sort_table_by_cpu_id(cur_processor_id, _proc_type_table, _cpu_mapping_table);
}

cpu_debug();
}

Expand Down
43 changes: 43 additions & 0 deletions src/inference/src/system_conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ int get_current_socket_id() {
return 0;
}

int get_current_numa_node_id() {
return 0;
}

std::vector<std::vector<int>> get_proc_type_table() {
return {{-1}};
}
Expand Down Expand Up @@ -322,6 +326,10 @@ int get_current_socket_id() {
return 0;
}

int get_current_numa_node_id() {
return 0;
}

std::vector<std::vector<int>> get_proc_type_table() {
CPU& cpu = cpu_info();
std::lock_guard<std::mutex> lock{cpu._cpu_mutex};
Expand Down Expand Up @@ -411,8 +419,43 @@ int get_current_socket_id() {

return 0;
}

int get_current_numa_node_id() {
CPU& cpu = cpu_info();
int cur_processor_id = sched_getcpu();

for (auto& row : cpu._cpu_mapping_table) {
if (cur_processor_id == row[CPU_MAP_PROCESSOR_ID]) {
return row[CPU_MAP_NUMA_NODE_ID];
}
}

return 0;
}
# else
int get_current_socket_id() {
CPU& cpu = cpu_info();
int cur_processor_id = GetCurrentProcessorNumber();

for (auto& row : cpu._cpu_mapping_table) {
if (cur_processor_id == row[CPU_MAP_PROCESSOR_ID]) {
return row[CPU_MAP_SOCKET_ID];
}
}

return 0;
}

int get_current_numa_node_id() {
CPU& cpu = cpu_info();
int cur_processor_id = GetCurrentProcessorNumber();

for (auto& row : cpu._cpu_mapping_table) {
if (cur_processor_id == row[CPU_MAP_PROCESSOR_ID]) {
return row[CPU_MAP_NUMA_NODE_ID];
}
}

return 0;
}
# endif
Expand Down
173 changes: 0 additions & 173 deletions src/inference/tests/unit/cpu_map_parser/update_proc_table.cpp

This file was deleted.

Loading
Loading