move CPU mapping parser API from dev_api header file to specific header file (#15558)

* move CPU mapping parser API to specific header file

* keep all enum defination in ie_system_conf.h

* move hpp file to inference/src

* fix code style issue
This commit is contained in:
Shen, Wanglei authored and GitHub committed 2023-02-08 18:27:14 +04:00
1 parent 66abecfd3d
commit d72deb955d
5 files changed
+77 -59

No files matched your search

+16 -59
View File
@@ -10,7 +10,6 @@
#pragma once
#include <exception>
#include <string>
#include <vector>
#include "ie_api.h"
@@ -134,11 +133,11 @@ INFERENCE_ENGINE_API_CPP(bool) with_cpu_x86_avx512_core_amx_bf16();
INFERENCE_ENGINE_API_CPP(bool) with_cpu_x86_avx512_core_amx();
/**
* @enum cpu_core_type_of_processor
* @brief This enum contains defination of processor based on specific cpu core types.
* Will extend to support other CPU core type like ARM.
* @enum column_of_processor_type_table
* @brief This enum contains defination of each columns in processor type table which bases on cpu core types. Will
* extend to support other CPU core type like ARM.
*
* This enum are also defination of each columns in processor type table. Below are two example of processor type table.
* The following are two example of processor type table.
* 1. Processor table of two socket CPUs XEON server
*
* ALL_PROC | MAIN_CORE_PROC | EFFICIENT_CORE_PROC | HYPER_THREADING_PROC
@@ -156,31 +155,31 @@ typedef enum {
MAIN_CORE_PROC = 1, //!< Processor based on physical core of Intel Performance-cores
EFFICIENT_CORE_PROC = 2, //!< Processor based on Intel Efficient-cores
HYPER_THREADING_PROC = 3, //!< Processor based on logical core of Intel Performance-cores
PROC_TYPE_TABLE_SIZE = 4
} cpu_core_type_of_processor;
PROC_TYPE_TABLE_SIZE = 4 //!< Size of processor type table
} column_of_processor_type_table;
/**
* @enum column_of_cpu_mapping_table
* @brief This enum contains defination of each columns in CPU mapping table which use processor id as index.
* @enum column_of_cpu_mapping_table
* @brief This enum contains defination of each columns in CPU mapping table which use processor id as index.
*
* GROUP_ID is generated according to the following rules.
* 1. If one MAIN_CORE_PROC and one HYPER_THREADING_PROC are based on same Performance-cores, they are in one group.
* 2. If some EFFICIENT_CORE_PROC share one L2 cachle, they are in one group.
* 3. There are no duplicate group IDs in the system
*
* Below is the example of CPU mapping table.
* The following is the example of CPU mapping table.
* 1. Four processors of two Pcore
* 2. Four processors of four Ecores shared L2 cache
*
* PROCESSOR_ID | SOCKET_ID | CORE_ID | CORE_TYPE | GROUP_ID | Used
* 0 0 0 2 0 0
* 0 0 0 3 0 0
* 1 0 0 1 0 0
* 2 0 1 2 1 0
* 2 0 1 3 1 0
* 3 0 1 1 1 0
* 4 0 2 3 2 0
* 5 0 3 3 2 0
* 6 0 4 3 2 0
* 7 0 5 3 2 0
* 4 0 2 2 2 0
* 5 0 3 2 2 0
* 6 0 4 2 2 0
* 7 0 5 2 2 0
*/
typedef enum {
CPU_MAP_PROCESSOR_ID = 0, //!< column for processor id of the processor
@@ -189,49 +188,7 @@ typedef enum {
CPU_MAP_CORE_TYPE = 3, //!< column for CPU core type corresponding to the processor
CPU_MAP_GROUP_ID = 4, //!< column for group id to the processor. Processors in one group have dependency.
CPU_MAP_USED_FLAG = 5, //!< column for resource management of the processor
CPU_MAP_TABLE_SIZE = 6
CPU_MAP_TABLE_SIZE = 6 //!< Size of CPU mapping table
} column_of_cpu_mapping_table;
#ifdef __linux__
/**
* @brief Parse processors infomation on Linux
* @ingroup ie_dev_api_system_conf
* @param[in] _processors total number for processors in system.
* @param[in] _system_info_table system information for this platform.
* @param[out] _sockets total number for sockets in system
* @param[out] _cores total number for physical CPU cores 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_processor_info_linux(const int _processors,
const std::vector<std::vector<std::string>> _system_info_table,
int& _sockets,
int& _cores,
std::vector<std::vector<int>>& _proc_type_table,
std::vector<std::vector<int>>& _cpu_mapping_table);
#endif
#if (defined(_WIN32) || defined(_WIN64))
/**
* @brief Parse processors infomation on Windows
* @ingroup ie_dev_api_system_conf
* @param[in] base_ptr buffer object pointer of Windows system infomation
* @param[in] len buffer object length of Windows system infomation
* @param[in] _processors total number for processors in system.
* @param[out] _sockets total number for sockets in system
* @param[out] _cores total number for physical CPU cores 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_processor_info_win(const char* base_ptr,
const unsigned long len,
const int _processors,
int& _sockets,
int& _cores,
std::vector<std::vector<int>>& _proc_type_table,
std::vector<std::vector<int>>& _cpu_mapping_table);
#endif
} // namespace InferenceEngine
@@ -15,6 +15,7 @@
#include "ie_common.h"
#include "ie_system_conf.h"
#include "streams_executor.hpp"
#include "threading/ie_parallel_custom_arena.hpp"
namespace InferenceEngine {
@@ -12,6 +12,7 @@
#include <vector>
#include "ie_system_conf.h"
#include "streams_executor.hpp"
#include "threading/ie_parallel_custom_arena.hpp"
namespace InferenceEngine {
+58
View File
@@ -0,0 +1,58 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief A header file that provides a set minimal required Streams Executor API.
* @file streams_executor.hpp
*/
#pragma once
#include <string>
#include <vector>
namespace InferenceEngine {
#ifdef __linux__
/**
* @brief Parse processors infomation on Linux
* @ingroup ie_dev_api_system_conf
* @param[in] _processors total number for processors in system.
* @param[in] _system_info_table system information for this platform.
* @param[out] _sockets total number for sockets in system
* @param[out] _cores total number for physical CPU cores 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_processor_info_linux(const int _processors,
const std::vector<std::vector<std::string>> _system_info_table,
int& _sockets,
int& _cores,
std::vector<std::vector<int>>& _proc_type_table,
std::vector<std::vector<int>>& _cpu_mapping_table);
#endif
#if (defined(_WIN32) || defined(_WIN64))
/**
* @brief Parse processors infomation on Windows
* @ingroup ie_dev_api_system_conf
* @param[in] base_ptr buffer object pointer of Windows system infomation
* @param[in] len buffer object length of Windows system infomation
* @param[in] _processors total number for processors in system.
* @param[out] _sockets total number for sockets in system
* @param[out] _cores total number for physical CPU cores 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_processor_info_win(const char* base_ptr,
const unsigned long len,
const int _processors,
int& _sockets,
int& _cores,
std::vector<std::vector<int>>& _proc_type_table,
std::vector<std::vector<int>>& _cpu_mapping_table);
#endif
} // namespace InferenceEngine
@@ -7,6 +7,7 @@
#include <common_test_utils/test_common.hpp>
#include "ie_system_conf.h"
#include "streams_executor.hpp"
using namespace testing;
using namespace InferenceEngine;