Skip to content

Commit

Permalink
using single numa node for CNN model
Browse files Browse the repository at this point in the history
  • Loading branch information
wangleis committed Dec 23, 2024
1 parent cc357c5 commit 13ce056
Show file tree
Hide file tree
Showing 3 changed files with 307 additions and 11 deletions.
38 changes: 27 additions & 11 deletions src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ std::vector<std::vector<int>> get_streams_info_table(
const int input_threads,
const int input_infer_requests,
const int model_prefer_threads,
const Config::ModelType model_type,
const std::string input_perf_hint,
const std::set<ov::hint::ModelDistributionPolicy> hint_model_distribution_policy,
const std::vector<std::vector<int>>& proc_type_table) {
Expand Down Expand Up @@ -252,13 +253,20 @@ std::vector<std::vector<int>> get_streams_info_table(
n_threads_per_stream = proc_type_table[0][ALL_PROC];
}
} else {
size_t socket_index = 0;
for (socket_index = 0; socket_index < proc_socket_table.size(); socket_index++) {
if (proc_socket_table[socket_index][PROC_SOCKET_ID] == current_socket_id) {
break;
std::vector<int> current_socket_info;

if (model_type == Config::ModelType::CNN) {
current_socket_info = proc_type_table.size() == 1 ? proc_type_table[0] : proc_type_table[1];
} else {
size_t socket_index = 0;
for (socket_index = 0; socket_index < proc_socket_table.size(); socket_index++) {
if (proc_socket_table[socket_index][PROC_SOCKET_ID] == current_socket_id) {
break;
}
}
current_socket_info = socket_index < proc_socket_table.size() ? proc_socket_table[socket_index] : proc_socket_table[0];
}
const std::vector<int>& current_socket_info = proc_socket_table[socket_index];

n_threads_per_stream = model_prefer_threads == 0
? current_socket_info[ALL_PROC]
: std::min(current_socket_info[ALL_PROC], model_prefer_threads);
Expand All @@ -271,11 +279,19 @@ std::vector<std::vector<int>> get_streams_info_table(
update_streams_per_node(EFFICIENT_CORE_PROC, current_socket_info);
} else {
stream_info[PROC_TYPE] = ALL_PROC;
update_mix_stream_info(current_socket_info,
proc_type_table,
n_threads_per_stream,
IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,
ALL_PROC);
if (model_type == Config::ModelType::CNN) {
update_mix_stream_info(current_socket_info,
{current_socket_info},
n_threads_per_stream,
IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,
ALL_PROC);
} else {
update_mix_stream_info(current_socket_info,
proc_type_table,
n_threads_per_stream,
IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,
ALL_PROC);
}
}
update_ids_method(current_socket_info);
}
Expand Down Expand Up @@ -702,10 +718,10 @@ std::vector<std::vector<int>> generate_stream_info(const int streams,
config.threads,
config.hintNumRequests,
model_prefer_threads,
config.modelType,
ov::util::to_string(config.hintPerfMode),
config.modelDistributionPolicy,
proc_type_table);
// streams_info_table = {{1, 1, 56, 1, 1}, {-1, 1, 28, 1, 1}, {-1, 1, 28, 0, 0}};
if (config.modelDistributionPolicy.find(ov::hint::ModelDistributionPolicy::TENSOR_PARALLEL) !=
config.modelDistributionPolicy.end()) {
config.streamsRankTable =
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/intel_cpu/src/cpu_streams_calculation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace intel_cpu {
* function.
* - input "0" indicates that the function generates the optimal number of threads per stream based on
* processors type information.
* @param[in] model_type is model type of current model.
* @param[in] input_perf_hint is performance hint set by user via ov::hint::performance_mode or the default value.
* @param[in] hint_llm_distribution_policy is the distribution policy for Large language models
* @param[in] proc_type_table is currently available candidate processors.
Expand All @@ -48,6 +49,7 @@ std::vector<std::vector<int>> get_streams_info_table(
const int input_threads,
const int input_infer_requests,
const int model_prefer_threads,
const Config::ModelType model_type,
const std::string input_perf_hint,
const std::set<ov::hint::ModelDistributionPolicy> hint_llm_distribution_policy,
const std::vector<std::vector<int>>& proc_type_table);
Expand Down
Loading

0 comments on commit 13ce056

Please sign in to comment.