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

combine test for stream_info_table #17930

Merged
Show file tree
Hide file tree
Changes from 3 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
35 changes: 25 additions & 10 deletions src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,13 @@ int get_model_prefer_threads(const int num_streams,
return model_prefer;
}

void get_num_streams(const int streams,
const std::shared_ptr<ngraph::Function>& ngraphFunc,
Config& config) {
void generate_stream_info(const int streams,
const std::shared_ptr<ngraph::Function>& ngraphFunc,
Config& config,
int model_prefer_init) {
int model_prefer = model_prefer_init;
InferenceEngine::IStreamsExecutor::Config& executor_config = config.streamExecutorConfig;
std::vector<int> stream_ids;
std::string log = "[ streams info ]";
std::vector<std::string> core_type_str = {" Any core: ", " PCore: ", " ECore: ", " Logical core: "};

std::vector<std::vector<int>> orig_proc_type_table = get_proc_type_table();
executor_config._orig_proc_type_table = orig_proc_type_table;
auto& orig_proc_type_table = executor_config._orig_proc_type_table;
std::vector<std::vector<int>> proc_type_table =
apply_scheduling_core_type(config.schedulingCoreType, orig_proc_type_table);
proc_type_table = apply_hyper_threading(config.enableHyperThreading,
Expand All @@ -291,12 +288,30 @@ void get_num_streams(const int streams,
streams,
executor_config._threadBindingType,
proc_type_table);
const int model_prefer = get_model_prefer_threads(streams, proc_type_table, ngraphFunc, executor_config);
if (-1 == model_prefer_init) {
model_prefer = get_model_prefer_threads(streams, proc_type_table, ngraphFunc, executor_config);
}

executor_config._streams_info_table = get_streams_info_table(streams,
executor_config._threads,
config.perfHintsConfig.ovPerfHintNumRequests,
model_prefer,
proc_type_table);
}

void get_num_streams(const int streams,
const std::shared_ptr<ngraph::Function>& ngraphFunc,
Config& config) {
InferenceEngine::IStreamsExecutor::Config& executor_config = config.streamExecutorConfig;
std::vector<int> stream_ids;
std::string log = "[ streams info ]";
std::vector<std::string> core_type_str = {" Any core: ", " PCore: ", " ECore: ", " Logical core: "};

std::vector<std::vector<int>> orig_proc_type_table = get_proc_type_table();

executor_config._orig_proc_type_table = orig_proc_type_table;
generate_stream_info(streams, ngraphFunc, config);

executor_config._stream_core_ids = reserve_available_cpus(executor_config._streams_info_table);
executor_config._threadsPerStream = executor_config._streams_info_table[0][THREADS_PER_STREAM];
executor_config._streams = 0;
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/intel_cpu/src/cpu_streams_calculation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ int get_model_prefer_threads(const int num_streams,
const std::shared_ptr<ngraph::Function>& ngraphFunc,
const InferenceEngine::IStreamsExecutor::Config streamExecutorConfig);

/**
* @brief Generate streams information according to processors type table
* @param[in] streams number of streams
* @param[in] ngraphFunc graph handle
* @param[in] config intel cpu configuration
* @param[in] model_perfer_init is initial preferred number of threads per stream
*/
void generate_stream_info(const int streams,
const std::shared_ptr<ngraph::Function>& ngraphFunc,
Config& config,
int model_perfer_init = -1);
dmitry-gorokhov marked this conversation as resolved.
Show resolved Hide resolved

struct StreamCfg {
int num_streams; // Number of streams
int num_threads; // Number of threads
Expand Down
Loading