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
Refactors the get_streams_info_table function and support LP ECORE only case (#35054)
Wanglei Shen9f3a15ec7af7
diff --git a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp b/src/plugins/intel_cpu/src/cpu_streams_calculation.cppindex 410b7fc7385..9ca3ae3357f 100644--- a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp+++ b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp@@ -316,19 +316,20 @@ void sort_table_by_numa_node_id(int current_numa_node, std::vector<std::vector<i}}}-};+}-std::vector<std::vector<int>> get_streams_info_table(- int input_streams,- bool input_streams_changed,- int input_threads,- int input_infer_requests,- int model_prefer_threads,- bool enable_tensor_parallel,- 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) {- std::vector<int> stream_info(CPU_STREAMS_TABLE_SIZE, INIT_VAL);+struct StreamsInfoBuilder {+ const int input_streams;+ const bool input_streams_changed;+ const int input_threads;+ const int input_infer_requests;+ const int model_prefer_threads;+ const bool enable_tensor_parallel;+ 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;++ std::vector<int> stream_info;std::vector<std::vector<int>> streams_info_table;std::vector<std::vector<int>> proc_socket_table;@@ -337,111 +338,114 @@ std::vector<std::vector<int>> get_streams_info_table(int n_threads_per_stream = 0;int current_socket_id = -1;- auto update_ids_method = [&](const std::vector<int>& one_proc_info) {+ void set_ids(const std::vector<int>& one_proc_info) {stream_info[STREAM_NUMA_NODE_ID] = one_proc_info[PROC_NUMA_NODE_ID];stream_info[STREAM_SOCKET_ID] = one_proc_info[PROC_SOCKET_ID];- };+ }- auto update_mix_stream_info = [&](const std::vector<int>& one_proc_info,- const std::vector<std::vector<int>>& one_proc_table,- const int num_threads,- const IStreamsExecutor::Config::StreamsMode sub_streams_model,- const int& target_proc) {+ /**+ * Socket selection priority (when current_socket_id >= 0):+ * n_mode 3 → same socket as current_socket_id+ * n_mode 2 → other sockets+ * n_mode 1 → any socket+ */+ void add_mixed_stream(const std::vector<int>& one_proc_info,+ const std::vector<std::vector<int>>& one_proc_table,+ int num_threads,+ IStreamsExecutor::Config::StreamsMode sub_streams_model,+ int target_proc) {stream_info[PROC_TYPE] = ALL_PROC;stream_info[NUMBER_OF_STREAMS] =sub_streams_model == IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL ? 1 : -1;stream_info[THREADS_PER_STREAM] = num_threads;- update_ids_method(one_proc_info);+ set_ids(one_proc_info);streams_info_table.push_back(stream_info);+stream_info[NUMBER_OF_STREAMS] = 0;int total_threads = stream_info[THREADS_PER_STREAM];int socket_id = stream_info[STREAM_SOCKET_ID];int node_start = one_proc_table.size() == 1 ? 0 : 1;- int node_end = one_proc_table.size() == 1 ? 1 : one_proc_table.size();- // When n_mode is 3, the following loop only selects CPUs on socket with the same id as current_socket_id.- // When n_mode is 2, the following loop only selects CPUs on sockets with id different from current_socket_id.- // When n_mode is 1, the following loop selects CPUs on all sockets.+ auto node_end = static_cast<int>(one_proc_table.size() == 1 ? 1 : one_proc_table.size());+for (int n_mode = current_socket_id < 0 ? 1 : 3; (n_mode > 0) && (total_threads > 0); n_mode--) {for (int n = MAIN_CORE_PROC; (n <= HYPER_THREADING_PROC) && (total_threads > 0); n++) {for (int index = node_start; (index < node_end) && (total_threads > 0); index++) {- if (((n_mode == 1) && ((socket_id < 0) || (socket_id == one_proc_table[index][PROC_SOCKET_ID]))) ||- ((n_mode == 2) && (current_socket_id != one_proc_table[index][PROC_SOCKET_ID]) &&- ((socket_id < 0) || (socket_id == one_proc_table[index][PROC_SOCKET_ID]))) ||- ((n_mode == 3) && (current_socket_id == one_proc_table[index][PROC_SOCKET_ID]) &&- ((socket_id < 0) || (socket_id == one_proc_table[index][PROC_SOCKET_ID])))) {- if ((0 != one_proc_table[index][n]) && any_of(target_proc, ALL_PROC, n)) {- stream_info[PROC_TYPE] = n;- stream_info[STREAM_NUMA_NODE_ID] = one_proc_table[index][PROC_NUMA_NODE_ID];- stream_info[STREAM_SOCKET_ID] = one_proc_table[index][PROC_SOCKET_ID];- if (total_threads <= one_proc_table[index][n]) {- stream_info[THREADS_PER_STREAM] = total_threads;- streams_info_table.push_back(stream_info);- total_threads -= stream_info[THREADS_PER_STREAM];- return;- }- stream_info[THREADS_PER_STREAM] = one_proc_table[index][n];- streams_info_table.push_back(stream_info);- total_threads -= stream_info[THREADS_PER_STREAM];- }+ if (!matches_socket_mode(n_mode, socket_id, one_proc_table[index][PROC_SOCKET_ID])) {+ continue;+ }+ if ((0 == one_proc_table[index][n]) || !any_of(target_proc, ALL_PROC, n)) {+ continue;+ }+ stream_info[PROC_TYPE] = n;+ stream_info[STREAM_NUMA_NODE_ID] = one_proc_table[index][PROC_NUMA_NODE_ID];+ stream_info[STREAM_SOCKET_ID] = one_proc_table[index][PROC_SOCKET_ID];+ if (total_threads <= one_proc_table[index][n]) {+ stream_info[THREADS_PER_STREAM] = total_threads;+ streams_info_table.push_back(stream_info);+ return;}+ stream_info[THREADS_PER_STREAM] = one_proc_table[index][n];+ streams_info_table.push_back(stream_info);+ total_threads -= stream_info[THREADS_PER_STREAM];}}}- };-- auto create_one_stream = [&](const std::vector<int>& one_proc_info,- const std::vector<std::vector<int>>& one_proc_table,- [[maybe_unused]] const int num_threads,- const IStreamsExecutor::Config::StreamsMode sub_streams_model) {- if ((one_proc_info[PROC_NUMA_NODE_ID] < 0) || (one_proc_info[PROC_SOCKET_ID] < 0) ||- (((one_proc_info[MAIN_CORE_PROC] > 0) &&- (one_proc_info[MAIN_CORE_PROC] < stream_info[THREADS_PER_STREAM])) ||- ((one_proc_info[MAIN_CORE_PROC] == 0) && (one_proc_info[EFFICIENT_CORE_PROC] > 0) &&- (one_proc_info[EFFICIENT_CORE_PROC] < stream_info[THREADS_PER_STREAM])))) {- update_mix_stream_info(one_proc_info,- one_proc_table,- stream_info[THREADS_PER_STREAM],- sub_streams_model,- ALL_PROC);+ }++ void add_single_stream(const std::vector<int>& one_proc_info,+ const std::vector<std::vector<int>>& one_proc_table,+ [[maybe_unused]] int num_threads,+ IStreamsExecutor::Config::StreamsMode sub_streams_model) {+ bool needs_mix = (one_proc_info[PROC_NUMA_NODE_ID] < 0) || (one_proc_info[PROC_SOCKET_ID] < 0) ||+ ((one_proc_info[MAIN_CORE_PROC] > 0) &&+ (one_proc_info[MAIN_CORE_PROC] < stream_info[THREADS_PER_STREAM])) ||+ ((one_proc_info[MAIN_CORE_PROC] == 0) && (one_proc_info[EFFICIENT_CORE_PROC] > 0) &&+ (one_proc_info[EFFICIENT_CORE_PROC] < stream_info[THREADS_PER_STREAM]));++ if (needs_mix) {+ add_mixed_stream(one_proc_info,+ one_proc_table,+ stream_info[THREADS_PER_STREAM],+ sub_streams_model,+ ALL_PROC);} else {stream_info[PROC_TYPE] =one_proc_info[MAIN_CORE_PROC] >= stream_info[THREADS_PER_STREAM] ? MAIN_CORE_PROC : EFFICIENT_CORE_PROC;stream_info[NUMBER_OF_STREAMS] =sub_streams_model == IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL ? 1 : -1;- update_ids_method(one_proc_info);+ set_ids(one_proc_info);streams_info_table.push_back(stream_info);}- };+ }- auto update_streams_per_node = [&](const int& proc_type, const std::vector<int>& one_proc_info) {+ void distribute_streams_per_node(int proc_type, const std::vector<int>& one_proc_info) {if ((one_proc_info[PROC_NUMA_NODE_ID] < 0) && (stream_info[NUMBER_OF_STREAMS] == 1)) {- update_mix_stream_info(one_proc_info,- proc_type_table,- one_proc_info[ALL_PROC],- IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,- proc_type);- } else {- if (0 != one_proc_info[proc_type]) {- if (n_threads_per_stream == -1) {- stream_info[THREADS_PER_STREAM] =- any_of(proc_type, EFFICIENT_CORE_PROC, LP_EFFICIENT_CORE_PROC) ? 2 : 1;- }- stream_info[PROC_TYPE] = proc_type;- update_ids_method(one_proc_info);- stream_info[NUMBER_OF_STREAMS] =- static_cast<int>(one_proc_info[proc_type] / stream_info[THREADS_PER_STREAM]);- if (n_streams < stream_info[NUMBER_OF_STREAMS]) {- stream_info[NUMBER_OF_STREAMS] = n_streams;- }- if (stream_info[NUMBER_OF_STREAMS] > 0) {- streams_info_table.push_back(stream_info);- n_streams -= stream_info[NUMBER_OF_STREAMS];- }- }+ add_mixed_stream(one_proc_info,+ proc_type_table,+ one_proc_info[ALL_PROC],+ IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,+ proc_type);+ return;+ }+ if (0 == one_proc_info[proc_type]) {+ return;+ }+ if (n_threads_per_stream == -1) {+ stream_info[THREADS_PER_STREAM] = any_of(proc_type, EFFICIENT_CORE_PROC, LP_EFFICIENT_CORE_PROC) ? 2 : 1;+ }+ stream_info[PROC_TYPE] = proc_type;+ set_ids(one_proc_info);+ stream_info[NUMBER_OF_STREAMS] = static_cast<int>(one_proc_info[proc_type] / stream_info[THREADS_PER_STREAM]);+ if (n_streams < stream_info[NUMBER_OF_STREAMS]) {+ stream_info[NUMBER_OF_STREAMS] = n_streams;+ }+ if (stream_info[NUMBER_OF_STREAMS] > 0) {+ streams_info_table.push_back(stream_info);+ n_streams -= stream_info[NUMBER_OF_STREAMS];}- };+ }- auto check_threads_per_stream = [&]() {+ void adjust_threads_per_stream() {int count = 0;while (true) {for (int n_type = MAIN_CORE_PROC; n_type <= HYPER_THREADING_PROC; n_type++) {@@ -458,11 +462,13 @@ std::vector<std::vector<int>> get_streams_info_table(return;}}- };+ }- if (proc_type_table.size() == 1) {- proc_socket_table.push_back(proc_type_table[0]);- } else {+ void build_socket_table() {+ if (proc_type_table.size() == 1) {+ proc_socket_table.push_back(proc_type_table[0]);+ return;+ }std::unordered_set<int> socket_id_list(proc_type_table.size());for (size_t i = 1; i < proc_type_table.size(); i++) {if (!socket_id_list.count(proc_type_table[i][PROC_SOCKET_ID])) {@@ -483,347 +489,403 @@ std::vector<std::vector<int>> get_streams_info_table(}}- if (((!input_streams_changed) && (input_perf_hint == ov::util::to_string(ov::hint::PerformanceMode::LATENCY))) ||- ((input_streams_changed) && (input_streams == 1))) {+ [[nodiscard]] bool has_tensor_parallel_policy() const {+ return hint_model_distribution_policy.find(ov::hint::ModelDistributionPolicy::TENSOR_PARALLEL) !=+ hint_model_distribution_policy.end();+ }++ [[nodiscard]] bool is_latency_mode() const {+ return ((!input_streams_changed) &&+ (input_perf_hint == ov::util::to_string(ov::hint::PerformanceMode::LATENCY))) ||+ ((input_streams_changed) && (input_streams == 1));+ }++ void handle_latency_with_explicit_threads() {+ if (hint_model_distribution_policy.empty()) {+ n_threads_per_stream = std::min(input_threads, proc_type_table[0][ALL_PROC]);+ } else {+ for (auto& row : proc_socket_table) {+ if (current_socket_id == row[PROC_SOCKET_ID]) {+ n_threads_per_stream = std::min(input_threads, row[ALL_PROC]);+ }+ }+ }+ if (proc_type_table.size() == 1) {+ if ((n_threads_per_stream > proc_type_table[0][MAIN_CORE_PROC]) &&+ (proc_type_table[0][MAIN_CORE_PROC] > 0)) {+ stream_info[PROC_TYPE] = ALL_PROC;+ }+ }+ }++ void handle_latency_tensor_parallel_or_single_socket() {+ if ((proc_type_table.size() == 1) && (model_prefer_threads > 0)) {+ if ((model_prefer_threads == proc_type_table[0][MAIN_CORE_PROC]) &&+ (proc_type_table[0][MAIN_CORE_PROC] > 0)) {+ stream_info[PROC_TYPE] = MAIN_CORE_PROC;+ n_threads_per_stream = proc_type_table[0][MAIN_CORE_PROC] + proc_type_table[0][HYPER_THREADING_PROC];+ stream_info[THREADS_PER_STREAM] = n_threads_per_stream;+ set_ids(proc_type_table[0]);+ } else if (proc_type_table[0][MAIN_CORE_PROC] == 0) {+ if (proc_type_table[0][EFFICIENT_CORE_PROC] > 0) {+ stream_info[PROC_TYPE] = EFFICIENT_CORE_PROC;+ n_threads_per_stream = proc_type_table[0][EFFICIENT_CORE_PROC];+ } else {+ stream_info[PROC_TYPE] = LP_EFFICIENT_CORE_PROC;+ n_threads_per_stream = proc_type_table[0][LP_EFFICIENT_CORE_PROC];+ }+ stream_info[THREADS_PER_STREAM] = n_threads_per_stream;+ set_ids(proc_type_table[0]);+ } else {+ stream_info[PROC_TYPE] = ALL_PROC;+ n_threads_per_stream = proc_type_table[0][ALL_PROC] - proc_type_table[0][LP_EFFICIENT_CORE_PROC];+ if (proc_type_table[0][LP_EFFICIENT_CORE_PROC] > 0 && proc_type_table[0][EFFICIENT_CORE_PROC] == 0) {+ n_threads_per_stream = std::max(model_prefer_threads, n_threads_per_stream);+ n_threads_per_stream = std::min(n_threads_per_stream, proc_type_table[0][ALL_PROC]);+ }+ }+ } else {+ // Fallback for single-socket or tensor-parallel when model_prefer_threads == 0.+ // Ensure n_threads_per_stream is always positive, even on LP-only systems where+ // ALL_PROC == LP_EFFICIENT_CORE_PROC and the original difference would be zero.+ n_threads_per_stream = proc_type_table[0][ALL_PROC] - proc_type_table[0][LP_EFFICIENT_CORE_PROC];+ if (n_threads_per_stream <= 0) {+ n_threads_per_stream = std::max(1, proc_type_table[0][ALL_PROC]);+ }+ }+ }++ void handle_latency_multi_socket() {+ 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;+ }+ }+ 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);+ stream_info[THREADS_PER_STREAM] = n_threads_per_stream;+ if (current_socket_info[ALL_PROC] == current_socket_info[MAIN_CORE_PROC]) {+ stream_info[PROC_TYPE] = MAIN_CORE_PROC;+ distribute_streams_per_node(MAIN_CORE_PROC, current_socket_info);+ } else if (current_socket_info[ALL_PROC] == current_socket_info[EFFICIENT_CORE_PROC]) {+ stream_info[PROC_TYPE] = EFFICIENT_CORE_PROC;+ distribute_streams_per_node(EFFICIENT_CORE_PROC, current_socket_info);+ } else {+ stream_info[PROC_TYPE] = ALL_PROC;+ add_mixed_stream(current_socket_info,+ proc_type_table,+ n_threads_per_stream,+ IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,+ ALL_PROC);+ }+ set_ids(current_socket_info);+ }++ void handle_latency_mode() {n_streams = 1;stream_info[NUMBER_OF_STREAMS] = n_streams;+for (auto& n : proc_socket_table) {if (n[ALL_PROC] > 0) {current_socket_id = n[PROC_SOCKET_ID];break;}}+if (input_threads > 0) {- if (hint_model_distribution_policy.empty()) {- n_threads_per_stream = std::min(input_threads, proc_type_table[0][ALL_PROC]);- } else {- for (auto& row : proc_socket_table) {- if (current_socket_id == row[PROC_SOCKET_ID]) {- n_threads_per_stream = std::min(input_threads, row[ALL_PROC]);- }- }+ handle_latency_with_explicit_threads();+ } else if (has_tensor_parallel_policy() || (proc_type_table.size() == 1)) {+ handle_latency_tensor_parallel_or_single_socket();+ } else {+ handle_latency_multi_socket();+ }+ }++ void handle_throughput_explicit_streams() {+ n_streams = input_infer_requests > 0 ? std::min(input_infer_requests, input_streams) : input_streams;+ if (n_streams >= n_threads) {+ n_streams = n_threads;+ n_threads_per_stream = 1;+ } else {+ n_threads_per_stream =+ std::min((n_threads / n_streams),+ proc_type_table[0][MAIN_CORE_PROC] == 0 ? proc_type_table[0][EFFICIENT_CORE_PROC]+ : proc_type_table[0][MAIN_CORE_PROC]);+ adjust_threads_per_stream();+ }+ }++ void handle_throughput_auto_no_preference() {+ int base_type = (proc_type_table[0][MAIN_CORE_PROC] == 0) ? EFFICIENT_CORE_PROC : MAIN_CORE_PROC;+ int n_proc = 0;++ if (proc_type_table.size() == 1) {+ n_proc = std::min(n_threads, proc_type_table[0][base_type]);+ } else {+ for (size_t i = 1; i < proc_type_table.size(); i++) {+ n_proc = std::max(n_proc, proc_type_table[i][base_type]);}- if (proc_type_table.size() == 1) {- if ((n_threads_per_stream > proc_type_table[0][MAIN_CORE_PROC]) &&- (proc_type_table[0][MAIN_CORE_PROC] > 0)) {- stream_info[PROC_TYPE] = ALL_PROC;- }+ n_proc = std::min(n_threads, n_proc);+ }++ if (0 == n_proc % 4) {+ n_threads_per_stream = 4;+ } else if (0 == n_proc % 5) {+ n_threads_per_stream = 5;+ } else if (0 == n_proc % 3) {+ n_threads_per_stream = 3;+ } else if ((proc_type_table[0][EFFICIENT_CORE_PROC] > 0 &&+ proc_type_table[0][EFFICIENT_CORE_PROC] != proc_type_table[0][ALL_PROC]) ||+ (proc_type_table[0][LP_EFFICIENT_CORE_PROC] > 0)) {+ n_threads_per_stream = n_proc;+ } else {+ n_threads_per_stream = (n_proc > 16) ? 4 : std::max(1, (n_proc / 4));+ }++ if (input_threads > 0) {+ n_streams = n_threads / n_threads_per_stream;+ } else {+ n_streams = 0;+ for (size_t i = MAIN_CORE_PROC; i <= HYPER_THREADING_PROC; i++) {+ n_streams += proc_type_table[0][i] / n_threads_per_stream;}- } else if ((hint_model_distribution_policy.find(ov::hint::ModelDistributionPolicy::TENSOR_PARALLEL) !=- hint_model_distribution_policy.end()) ||- (proc_type_table.size() == 1)) {- if ((proc_type_table.size() == 1) && (model_prefer_threads > 0)) {- if ((model_prefer_threads == proc_type_table[0][MAIN_CORE_PROC]) &&- (proc_type_table[0][MAIN_CORE_PROC] > 0)) {- stream_info[PROC_TYPE] = MAIN_CORE_PROC;- n_threads_per_stream =- proc_type_table[0][MAIN_CORE_PROC] + proc_type_table[0][HYPER_THREADING_PROC];- stream_info[THREADS_PER_STREAM] = n_threads_per_stream;- update_ids_method(proc_type_table[0]);- } else if (proc_type_table[0][MAIN_CORE_PROC] == 0) {- stream_info[PROC_TYPE] = EFFICIENT_CORE_PROC;- n_threads_per_stream = proc_type_table[0][EFFICIENT_CORE_PROC];- stream_info[THREADS_PER_STREAM] = n_threads_per_stream;- update_ids_method(proc_type_table[0]);- } else {- stream_info[PROC_TYPE] = ALL_PROC;- n_threads_per_stream = proc_type_table[0][ALL_PROC] - proc_type_table[0][LP_EFFICIENT_CORE_PROC];- if (proc_type_table[0][LP_EFFICIENT_CORE_PROC] > 0 &&- proc_type_table[0][EFFICIENT_CORE_PROC] == 0) {- n_threads_per_stream = std::max(model_prefer_threads, n_threads_per_stream);- n_threads_per_stream = std::min(n_threads_per_stream, proc_type_table[0][ALL_PROC]);- }- }+ }++ if ((input_infer_requests > 0) && (n_streams > input_infer_requests)) {+ n_streams = input_infer_requests;+ if (proc_type_table.size() == 1) {+ n_threads_per_stream = std::min((n_threads / n_streams), n_proc);} else {- n_threads_per_stream = proc_type_table[0][ALL_PROC] - proc_type_table[0][LP_EFFICIENT_CORE_PROC];+ n_threads_per_stream = (n_threads / n_streams);}} 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;- }+ while ((n_streams * 2 <= n_threads_per_stream) && (n_threads_per_stream > 1)) {+ n_threads_per_stream = (n_threads_per_stream / 2);+ n_streams = (n_threads / n_threads_per_stream);}- 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);- stream_info[THREADS_PER_STREAM] = n_threads_per_stream;- if (current_socket_info[ALL_PROC] == current_socket_info[MAIN_CORE_PROC]) {- stream_info[PROC_TYPE] = MAIN_CORE_PROC;- update_streams_per_node(MAIN_CORE_PROC, current_socket_info);- } else if (current_socket_info[ALL_PROC] == current_socket_info[EFFICIENT_CORE_PROC]) {- stream_info[PROC_TYPE] = EFFICIENT_CORE_PROC;- 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);+ }+ }++ void handle_throughput_hybrid_single_thread_prefer() {+ n_streams = (n_threads >= proc_type_table[0][MAIN_CORE_PROC] + proc_type_table[0][EFFICIENT_CORE_PROC] ++ proc_type_table[0][LP_EFFICIENT_CORE_PROC])+ ? (n_threads - proc_type_table[0][EFFICIENT_CORE_PROC] / 2 -+ proc_type_table[0][LP_EFFICIENT_CORE_PROC] / 2)+ : static_cast<int>(proc_type_table[0][MAIN_CORE_PROC] ++ (n_threads - proc_type_table[0][MAIN_CORE_PROC]) / 2);+ n_streams = input_infer_requests > 0 ? std::min(n_streams, input_infer_requests) : n_streams;+ n_threads_per_stream = -1;+ }++ void handle_throughput_general_model_prefer() {+ int model_threads = [&]() {+ if (n_threads == 1) {+ return 1;+ }+ if (model_prefer_threads > n_threads) {+ return n_threads / 2;}- update_ids_method(current_socket_info);+ return model_prefer_threads;+ }();+ n_streams = ((n_threads + model_threads - 1) / model_threads);+ if ((input_infer_requests > 0) && (n_streams > input_infer_requests)) {+ n_streams = input_infer_requests;+ n_threads_per_stream = (n_threads / n_streams);+ adjust_threads_per_stream();+ } else {+ n_threads_per_stream = model_threads > 0 ? model_threads : (n_threads / n_streams);}- } else {+ }++ void handle_throughput_mode() {n_threads =input_threads > 0 ? std::min(proc_type_table[0][ALL_PROC], input_threads) : proc_type_table[0][ALL_PROC];+if ((input_streams_changed) && (input_streams > 0)) {- n_streams = input_infer_requests > 0 ? std::min(input_infer_requests, input_streams) : input_streams;- if (n_streams >= n_threads) {- n_streams = n_threads;- n_threads_per_stream = 1;- } else {- n_threads_per_stream =- std::min((n_threads / n_streams),- proc_type_table[0][MAIN_CORE_PROC] == 0 ? proc_type_table[0][EFFICIENT_CORE_PROC]- : proc_type_table[0][MAIN_CORE_PROC]);- check_threads_per_stream();- }+ handle_throughput_explicit_streams();+ } else if (0 == model_prefer_threads) {+ handle_throughput_auto_no_preference();+ } else if ((1 == model_prefer_threads) &&+ ((proc_type_table[0][EFFICIENT_CORE_PROC] > 0) ||+ (proc_type_table[0][LP_EFFICIENT_CORE_PROC] > 0)) &&+ (proc_type_table[0][MAIN_CORE_PROC] > 0) && (n_threads > proc_type_table[0][MAIN_CORE_PROC])) {+ handle_throughput_hybrid_single_thread_prefer();} else {- int base_type = (proc_type_table[0][MAIN_CORE_PROC] == 0) ? EFFICIENT_CORE_PROC : MAIN_CORE_PROC;- if (0 == model_prefer_threads) {- int n_proc = 0;+ handle_throughput_general_model_prefer();+ }+ }- if (proc_type_table.size() == 1) {- n_proc = std::min(n_threads, proc_type_table[0][base_type]);- } else {- for (size_t i = 1; i < proc_type_table.size(); i++) {- n_proc = std::max(n_proc, proc_type_table[i][base_type]);- }- n_proc = std::min(n_threads, n_proc);+ void populate_table_tensor_parallel() {+ for (auto& row : proc_socket_table) {+ stream_info[THREADS_PER_STREAM] = std::min(TP_CPU_LIMIT, n_threads_per_stream);+ for (size_t i = 1; i < proc_type_table.size(); i++) {+ if ((proc_type_table[i][PROC_SOCKET_ID] == row[PROC_SOCKET_ID]) &&+ (proc_type_table[i][MAIN_CORE_PROC] >= stream_info[THREADS_PER_STREAM])) {+ add_single_stream(proc_type_table[i],+ {proc_type_table[i]},+ stream_info[THREADS_PER_STREAM],+ IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_FOR_SOCKET);+ break;}+ }+ if (stream_info[STREAM_SOCKET_ID] == row[PROC_SOCKET_ID]) {+ continue;+ }+ stream_info[THREADS_PER_STREAM] = std::min(stream_info[THREADS_PER_STREAM], row[ALL_PROC]);+ add_single_stream(row,+ proc_type_table,+ stream_info[THREADS_PER_STREAM],+ IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_FOR_SOCKET);+ }- if (0 == n_proc % 4) {- n_threads_per_stream = 4;- } else if (0 == n_proc % 5) {- n_threads_per_stream = 5;- } else if (0 == n_proc % 3) {- n_threads_per_stream = 3;- } else if ((proc_type_table[0][EFFICIENT_CORE_PROC] > 0 &&- proc_type_table[0][EFFICIENT_CORE_PROC] != proc_type_table[0][ALL_PROC]) ||- (proc_type_table[0][LP_EFFICIENT_CORE_PROC] > 0)) {- n_threads_per_stream = n_proc;- } else {- n_threads_per_stream = (n_proc > 16) ? 4 : std::max(1, (n_proc / 4));- }- if (input_threads > 0) {- n_streams = n_threads / n_threads_per_stream;- } else {- n_streams = 0;- for (size_t i = MAIN_CORE_PROC; i <= HYPER_THREADING_PROC; i++) {- n_streams += proc_type_table[0][i] / n_threads_per_stream;- }+ stream_info = streams_info_table[0];+ stream_info[NUMBER_OF_STREAMS] = 1;+ for (size_t n = 1; n < streams_info_table.size(); n++) {+ if (streams_info_table[n][NUMBER_OF_STREAMS] == -1) {+ if (stream_info[PROC_TYPE] != streams_info_table[n][PROC_TYPE]) {+ stream_info[PROC_TYPE] = ALL_PROC;}- if ((input_infer_requests > 0) && (n_streams > input_infer_requests)) {- n_streams = input_infer_requests;- if (proc_type_table.size() == 1) {- n_threads_per_stream = std::min((n_threads / n_streams), n_proc);- } else {- n_threads_per_stream = (n_threads / n_streams);- }- } else {- while ((n_streams * 2 <= n_threads_per_stream) && (n_threads_per_stream > 1)) {- n_threads_per_stream = (n_threads_per_stream / 2);- n_streams = (n_threads / n_threads_per_stream);- }+ stream_info[THREADS_PER_STREAM] += streams_info_table[n][THREADS_PER_STREAM];+ if (stream_info[STREAM_NUMA_NODE_ID] != streams_info_table[n][STREAM_NUMA_NODE_ID]) {+ stream_info[STREAM_NUMA_NODE_ID] = -1;}- } else if ((1 == model_prefer_threads) &&- ((proc_type_table[0][EFFICIENT_CORE_PROC] > 0) ||- (proc_type_table[0][LP_EFFICIENT_CORE_PROC] > 0)) &&- (proc_type_table[0][MAIN_CORE_PROC] > 0) && (n_threads > proc_type_table[0][MAIN_CORE_PROC])) {- n_streams = (n_threads >= proc_type_table[0][MAIN_CORE_PROC] + proc_type_table[0][EFFICIENT_CORE_PROC] +- proc_type_table[0][LP_EFFICIENT_CORE_PROC])- ? (n_threads - proc_type_table[0][EFFICIENT_CORE_PROC] / 2 -- proc_type_table[0][LP_EFFICIENT_CORE_PROC] / 2)- : static_cast<int>(proc_type_table[0][MAIN_CORE_PROC] +- (n_threads - proc_type_table[0][MAIN_CORE_PROC]) / 2);- n_streams = input_infer_requests > 0 ? std::min(n_streams, input_infer_requests) : n_streams;- n_threads_per_stream = -1;- } else {- int model_threads = [&]() {- if (n_threads == 1) {- return 1;- }- if (model_prefer_threads > n_threads) {- return n_threads / 2;- }- return model_prefer_threads;- }();- n_streams = ((n_threads + model_threads - 1) / model_threads);- if ((input_infer_requests > 0) && (n_streams > input_infer_requests)) {- n_streams = input_infer_requests;- n_threads_per_stream = (n_threads / n_streams);- check_threads_per_stream();- } else {- n_threads_per_stream = model_threads > 0 ? model_threads : (n_threads / n_streams);+ if (stream_info[STREAM_SOCKET_ID] != streams_info_table[n][STREAM_SOCKET_ID]) {+ stream_info[STREAM_SOCKET_ID] = -1;}}}+ streams_info_table.insert(streams_info_table.begin(), stream_info);}- int total_streams = n_streams;-- if (stream_info[PROC_TYPE] == INIT_VAL) {- if ((n_streams == 1) && (proc_type_table.size() > 1) &&- (hint_model_distribution_policy.find(ov::hint::ModelDistributionPolicy::TENSOR_PARALLEL) !=- hint_model_distribution_policy.end())) {- for (auto& row : proc_socket_table) {- stream_info[THREADS_PER_STREAM] = std::min(TP_CPU_LIMIT, n_threads_per_stream);- for (size_t i = 1; i < proc_type_table.size(); i++) {- if ((proc_type_table[i][PROC_SOCKET_ID] == row[PROC_SOCKET_ID]) &&- (proc_type_table[i][MAIN_CORE_PROC] >= stream_info[THREADS_PER_STREAM])) {- create_one_stream(proc_type_table[i],- {proc_type_table[i]},- stream_info[THREADS_PER_STREAM],- IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_FOR_SOCKET);- break;- }- }- if (stream_info[STREAM_SOCKET_ID] == row[PROC_SOCKET_ID]) {- continue;- }- stream_info[THREADS_PER_STREAM] = std::min(stream_info[THREADS_PER_STREAM], row[ALL_PROC]);- create_one_stream(row,- proc_type_table,- stream_info[THREADS_PER_STREAM],- IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_FOR_SOCKET);+ static void subtract_allocated_from(std::vector<std::vector<int>>& remain,+ const std::vector<std::vector<int>>& table,+ size_t begin,+ size_t end) {+ for (size_t i = begin; i < end; i++) {+ if ((table[i][STREAM_NUMA_NODE_ID] < 0) || (table[i][STREAM_SOCKET_ID] < 0)) {+ continue;}- stream_info = streams_info_table[0];- stream_info[NUMBER_OF_STREAMS] = 1;- for (size_t n = 1; n < streams_info_table.size(); n++) {- if (streams_info_table[n][NUMBER_OF_STREAMS] == -1) {- if (stream_info[PROC_TYPE] != streams_info_table[n][PROC_TYPE]) {- stream_info[PROC_TYPE] = ALL_PROC;- }- stream_info[THREADS_PER_STREAM] += streams_info_table[n][THREADS_PER_STREAM];- if (stream_info[STREAM_NUMA_NODE_ID] != streams_info_table[n][STREAM_NUMA_NODE_ID]) {- stream_info[STREAM_NUMA_NODE_ID] = -1;- }- if (stream_info[STREAM_SOCKET_ID] != streams_info_table[n][STREAM_SOCKET_ID]) {- stream_info[STREAM_SOCKET_ID] = -1;- }+ for (auto& row : remain) {+ if ((table[i][STREAM_NUMA_NODE_ID] == row[PROC_NUMA_NODE_ID]) &&+ (table[i][STREAM_SOCKET_ID] == row[PROC_SOCKET_ID])) {+ row[table[i][PROC_TYPE]] -= (table[i][NUMBER_OF_STREAMS] == 0 ? 1 : table[i][NUMBER_OF_STREAMS]) *+ table[i][THREADS_PER_STREAM];}}- streams_info_table.insert(streams_info_table.begin(), stream_info);- } else {- stream_info[THREADS_PER_STREAM] = n_threads_per_stream;+ }+ }- for (int n_type = MAIN_CORE_PROC; (n_type <= HYPER_THREADING_PROC) && (n_streams > 0); n_type++) {- if (proc_type_table.size() == 1) {- if (proc_type_table[0][n_type] >= stream_info[THREADS_PER_STREAM]) {- update_streams_per_node(n_type, proc_type_table[0]);- }- } else {- for (size_t n_node = 1; (n_node < proc_type_table.size()) && (n_streams > 0); n_node++) {- if ((proc_type_table[n_node][n_type] >= stream_info[THREADS_PER_STREAM]) &&- ((current_socket_id < 0) ||- (proc_type_table[n_node][PROC_SOCKET_ID] == current_socket_id))) {- update_streams_per_node(n_type, proc_type_table[n_node]);- }+ void populate_table_normal(int total_streams) {+ stream_info[THREADS_PER_STREAM] = n_threads_per_stream;++ // Pass 1: allocate streams to homogeneous core types per node.+ for (int n_type = MAIN_CORE_PROC; (n_type <= HYPER_THREADING_PROC) && (n_streams > 0); n_type++) {+ if (proc_type_table.size() == 1) {+ if (proc_type_table[0][n_type] >= stream_info[THREADS_PER_STREAM]) {+ distribute_streams_per_node(n_type, proc_type_table[0]);+ }+ } else {+ for (size_t n_node = 1; (n_node < proc_type_table.size()) && (n_streams > 0); n_node++) {+ if ((proc_type_table[n_node][n_type] >= stream_info[THREADS_PER_STREAM]) &&+ ((current_socket_id < 0) || (proc_type_table[n_node][PROC_SOCKET_ID] == current_socket_id))) {+ distribute_streams_per_node(n_type, proc_type_table[n_node]);}}}+ }- if (total_streams == n_streams) {- if (proc_type_table.size() == 1) {- if (proc_type_table[0][ALL_PROC] >= stream_info[THREADS_PER_STREAM]) {- update_mix_stream_info(proc_type_table[0],- proc_type_table,- n_threads_per_stream,- IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,- ALL_PROC);+ // Pass 2: if nothing was allocated yet, try mixed streams.+ if (total_streams == n_streams) {+ if (proc_type_table.size() == 1) {+ if (proc_type_table[0][ALL_PROC] >= stream_info[THREADS_PER_STREAM]) {+ add_mixed_stream(proc_type_table[0],+ proc_type_table,+ n_threads_per_stream,+ IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,+ ALL_PROC);+ n_streams--;+ }+ } else {+ for (size_t n_node = 0; (n_node < proc_socket_table.size()) && (n_streams > 0); n_node++) {+ if ((proc_socket_table[n_node][ALL_PROC] >= stream_info[THREADS_PER_STREAM]) &&+ ((current_socket_id < 0) || (proc_socket_table[n_node][PROC_SOCKET_ID] == current_socket_id))) {+ add_mixed_stream(proc_socket_table[n_node],+ proc_type_table,+ n_threads_per_stream,+ IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,+ ALL_PROC);n_streams--;}- } else {- for (size_t n_node = 0; (n_node < proc_socket_table.size()) && (n_streams > 0); n_node++) {- if ((proc_socket_table[n_node][ALL_PROC] >= stream_info[THREADS_PER_STREAM]) &&- ((current_socket_id < 0) ||- (proc_socket_table[n_node][PROC_SOCKET_ID] == current_socket_id))) {- update_mix_stream_info(proc_socket_table[n_node],- proc_type_table,- n_threads_per_stream,- IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,- ALL_PROC);- n_streams--;- }- }}}+ }- if (n_streams > 0) {- std::vector<std::vector<int>> remain_proc_type_table(proc_type_table);- size_t stream_table_size = streams_info_table.size();-- for (size_t i = 0; i < stream_table_size; i++) {- if ((streams_info_table[i][STREAM_NUMA_NODE_ID] >= 0) &&- (streams_info_table[i][STREAM_SOCKET_ID] >= 0)) {- for (auto& row : remain_proc_type_table) {- if ((streams_info_table[i][STREAM_NUMA_NODE_ID] == row[PROC_NUMA_NODE_ID]) &&- (streams_info_table[i][STREAM_SOCKET_ID] == row[PROC_SOCKET_ID])) {- row[streams_info_table[i][PROC_TYPE]] -=- (streams_info_table[i][NUMBER_OF_STREAMS] == 0- ? 1- : streams_info_table[i][NUMBER_OF_STREAMS]) *- streams_info_table[i][THREADS_PER_STREAM];- }- }- }- }+ // Pass 3: overflow — pack remaining streams into whatever capacity is left.+ if (n_streams > 0) {+ std::vector<std::vector<int>> remain_proc_type_table(proc_type_table);+ size_t stream_table_size = streams_info_table.size();- while (n_streams > 0) {- update_mix_stream_info(proc_type_table[0],- remain_proc_type_table,- n_threads_per_stream,- IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,- ALL_PROC);+ subtract_allocated_from(remain_proc_type_table, streams_info_table, 0, stream_table_size);- if (stream_table_size == streams_info_table.size()) {- break;- }- n_streams--;- int numa_node_id = streams_info_table[stream_table_size + 1][STREAM_NUMA_NODE_ID];- int socket_id = streams_info_table[stream_table_size + 1][STREAM_SOCKET_ID];- for (size_t i = stream_table_size + 1; i < streams_info_table.size(); i++) {- numa_node_id = numa_node_id == streams_info_table[i][STREAM_NUMA_NODE_ID] ? numa_node_id : -1;- socket_id = socket_id == streams_info_table[i][STREAM_SOCKET_ID] ? socket_id : -1;- for (auto& row : remain_proc_type_table) {- if ((streams_info_table[i][STREAM_NUMA_NODE_ID] == row[PROC_NUMA_NODE_ID]) &&- (streams_info_table[i][STREAM_SOCKET_ID] == row[PROC_SOCKET_ID])) {- row[streams_info_table[i][PROC_TYPE]] -=- (streams_info_table[i][NUMBER_OF_STREAMS] == 0- ? 1- : streams_info_table[i][NUMBER_OF_STREAMS]) *- streams_info_table[i][THREADS_PER_STREAM];- }+ while (n_streams > 0) {+ add_mixed_stream(proc_type_table[0],+ remain_proc_type_table,+ n_threads_per_stream,+ IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,+ ALL_PROC);++ if (stream_table_size == streams_info_table.size()) {+ break;+ }+ n_streams--;+ int numa_node_id = streams_info_table[stream_table_size + 1][STREAM_NUMA_NODE_ID];+ int socket_id = streams_info_table[stream_table_size + 1][STREAM_SOCKET_ID];+ for (size_t i = stream_table_size + 1; i < streams_info_table.size(); i++) {+ numa_node_id = numa_node_id == streams_info_table[i][STREAM_NUMA_NODE_ID] ? numa_node_id : -1;+ socket_id = socket_id == streams_info_table[i][STREAM_SOCKET_ID] ? socket_id : -1;+ for (auto& row : remain_proc_type_table) {+ if ((streams_info_table[i][STREAM_NUMA_NODE_ID] == row[PROC_NUMA_NODE_ID]) &&+ (streams_info_table[i][STREAM_SOCKET_ID] == row[PROC_SOCKET_ID])) {+ row[streams_info_table[i][PROC_TYPE]] -= (streams_info_table[i][NUMBER_OF_STREAMS] == 0+ ? 1+ : streams_info_table[i][NUMBER_OF_STREAMS]) *+ streams_info_table[i][THREADS_PER_STREAM];}}- streams_info_table[stream_table_size][STREAM_NUMA_NODE_ID] = numa_node_id;- streams_info_table[stream_table_size][STREAM_SOCKET_ID] = socket_id;- stream_table_size = streams_info_table.size();}+ streams_info_table[stream_table_size][STREAM_NUMA_NODE_ID] = numa_node_id;+ streams_info_table[stream_table_size][STREAM_SOCKET_ID] = socket_id;+ stream_table_size = streams_info_table.size();}+ }- if ((total_streams == 1) && (proc_type_table.size() == 1) && enable_tensor_parallel &&- (hint_model_distribution_policy.find(ov::hint::ModelDistributionPolicy::TENSOR_PARALLEL) !=- hint_model_distribution_policy.end())) {- streams_info_table.push_back(streams_info_table[0]);- streams_info_table.push_back(streams_info_table[0]);- streams_info_table[0][THREADS_PER_STREAM] = streams_info_table[0][THREADS_PER_STREAM] * 2;- streams_info_table[1][NUMBER_OF_STREAMS] = -1;- streams_info_table[2][NUMBER_OF_STREAMS] = -1;- }+ if ((total_streams == 1) && (proc_type_table.size() == 1) && enable_tensor_parallel &&+ has_tensor_parallel_policy()) {+ streams_info_table.push_back(streams_info_table[0]);+ streams_info_table.push_back(streams_info_table[0]);+ streams_info_table[0][THREADS_PER_STREAM] = streams_info_table[0][THREADS_PER_STREAM] * 2;+ streams_info_table[1][NUMBER_OF_STREAMS] = -1;+ streams_info_table[2][NUMBER_OF_STREAMS] = -1;}- } else if (proc_type_table.size() == 1) {+ }++ /**+ * Handle the case where latency mode already pre-set stream_info[PROC_TYPE]+ * and we have a single-socket configuration.+ */+ void populate_table_single_socket_preset() {if (stream_info[PROC_TYPE] == ALL_PROC) {- update_mix_stream_info(proc_socket_table[0],- proc_type_table,- n_threads_per_stream,- IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,- ALL_PROC);+ add_mixed_stream(proc_socket_table[0],+ proc_type_table,+ n_threads_per_stream,+ IStreamsExecutor::Config::StreamsMode::SUB_STREAMS_NULL,+ ALL_PROC);} else if (stream_info[PROC_TYPE] == MAIN_CORE_PROC) {if (stream_info[THREADS_PER_STREAM] == proc_socket_table[0][MAIN_CORE_PROC]) {- streams_info_table.push_back(std::move(stream_info));+ streams_info_table.push_back(stream_info);} else {stream_info[PROC_TYPE] = ALL_PROC;streams_info_table.push_back(stream_info);@@ -833,14 +895,97 @@ std::vector<std::vector<int>> get_streams_info_table(streams_info_table.push_back(stream_info);stream_info[PROC_TYPE] = HYPER_THREADING_PROC;stream_info[THREADS_PER_STREAM] = proc_socket_table[0][HYPER_THREADING_PROC];- streams_info_table.push_back(std::move(stream_info));+ streams_info_table.push_back(stream_info);+ }+ } else {+ streams_info_table.push_back(stream_info);+ }+ }++ /**+ * Phase 3: populate the streams_info_table based on the n_streams,+ * n_threads_per_stream, and (optionally pre-set) stream_info[PROC_TYPE]+ * computed in earlier phases.+ */+ void populate_streams_info_table() {+ int total_streams = n_streams;++ if (stream_info[PROC_TYPE] == INIT_VAL) {+ bool is_multi_socket_tp = (n_streams == 1) && (proc_type_table.size() > 1) && has_tensor_parallel_policy();++ if (is_multi_socket_tp) {+ populate_table_tensor_parallel();+ } else {+ populate_table_normal(total_streams);}+ } else if (proc_type_table.size() == 1) {+ populate_table_single_socket_preset();+ }+ }++ // ── top-level entry point ───────────────────────────────────────────++ std::vector<std::vector<int>> build() {+ stream_info.assign(CPU_STREAMS_TABLE_SIZE, INIT_VAL);++ build_socket_table();++ if (is_latency_mode()) {+ handle_latency_mode();} else {- streams_info_table.push_back(std::move(stream_info));+ handle_throughput_mode();+ }++ populate_streams_info_table();++ return streams_info_table;+ }++private:+ /**+ * Check whether a NUMA-node row's socket matches the current socket-+ * selection mode used by add_mixed_stream.+ *+ * @param n_mode 3 = same as current_socket_id,+ * 2 = different from current_socket_id,+ * 1 = any socket.+ * @param socket_id The stream's target socket (-1 means any).+ * @param row_socket The socket id of the row being tested.+ */+ [[nodiscard]] bool matches_socket_mode(int n_mode, int socket_id, int row_socket) const {+ switch (n_mode) {+ case 3:+ return (current_socket_id == row_socket) && ((socket_id < 0) || (socket_id == row_socket));+ case 2:+ return (current_socket_id != row_socket) && ((socket_id < 0) || (socket_id == row_socket));+ case 1:+ return (socket_id < 0) || (socket_id == row_socket);+ default:+ return false;}}+};- return streams_info_table;+std::vector<std::vector<int>> get_streams_info_table(+ int input_streams,+ bool input_streams_changed,+ int input_threads,+ int input_infer_requests,+ int model_prefer_threads,+ bool enable_tensor_parallel,+ 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) {+ StreamsInfoBuilder builder{input_streams,+ input_streams_changed,+ input_threads,+ input_infer_requests,+ model_prefer_threads,+ enable_tensor_parallel,+ input_perf_hint,+ hint_model_distribution_policy,+ proc_type_table};+ return builder.build();}std::vector<std::vector<int>> get_streams_rank_table(const std::vector<std::vector<int>>& streams_info_table,diff --git a/src/plugins/intel_cpu/tests/unit/streams_info/streams_info_table_test.cpp b/src/plugins/intel_cpu/tests/unit/streams_info/streams_info_table_test.cppindex 0cef080e60a..0a20045f7dd 100644--- a/src/plugins/intel_cpu/tests/unit/streams_info/streams_info_table_test.cpp+++ b/src/plugins/intel_cpu/tests/unit/streams_info/streams_info_table_test.cpp@@ -30,7 +30,7 @@ class StreamsCalculationTests : public ov::test::TestsCommon,public testing::WithParamInterface<std::tuple<StreamsCalculationTestCase>> {public:void SetUp() override {- const auto& test_data = std::get<0>(GetParam());+ auto test_data = std::get<0>(GetParam());std::vector<std::vector<int>> test_stream_info_table =ov::intel_cpu::get_streams_info_table(test_data.input_streams,@@ -2530,9 +2530,7 @@ StreamsCalculationTestCase _1sockets_mock_latency_11 = {"LATENCY",{},{{6, 2, 0, 4, 0, 0, 0}},- {{1, ALL_PROC, 6, 0, 0},- {0, MAIN_CORE_PROC, 2, 0, 0},- {0, LP_EFFICIENT_CORE_PROC, 4, 0, 0}},+ {{1, ALL_PROC, 6, 0, 0}, {0, MAIN_CORE_PROC, 2, 0, 0}, {0, LP_EFFICIENT_CORE_PROC, 4, 0, 0}},};StreamsCalculationTestCase _1sockets_mock_latency_12 = {1,@@ -2543,9 +2541,18 @@ StreamsCalculationTestCase _1sockets_mock_latency_12 = {"LATENCY",{},{{6, 2, 0, 4, 0, 0, 0}},- {{1, ALL_PROC, 4, 0, 0},- {0, MAIN_CORE_PROC, 2, 0, 0},- {0, LP_EFFICIENT_CORE_PROC, 2, 0, 0}},+ {{1, ALL_PROC, 4, 0, 0}, {0, MAIN_CORE_PROC, 2, 0, 0}, {0, LP_EFFICIENT_CORE_PROC, 2, 0, 0}},+};+StreamsCalculationTestCase _1sockets_mock_latency_13 = {+ 1,+ false,+ 0,+ 0,+ 4,+ "LATENCY",+ {},+ {{4, 0, 0, 4, 0, 0, 0}},+ {{1, LP_EFFICIENT_CORE_PROC, 4, 0, 0}},};StreamsCalculationTestCase _2sockets_mock_latency_35 = {1,@@ -2798,9 +2805,7 @@ StreamsCalculationTestCase _2sockets_mock_latency_49 = {{104, 52, 0, 0, 52, 0, 0},{104, 52, 0, 0, 52, 1, 0},{104, 52, 0, 0, 52, 2, 1}},- {{1, ALL_PROC, 80, -1, 1},- {0, MAIN_CORE_PROC, 52, 3, 1},- {0, MAIN_CORE_PROC, 28, 2, 1}},+ {{1, ALL_PROC, 80, -1, 1}, {0, MAIN_CORE_PROC, 52, 3, 1}, {0, MAIN_CORE_PROC, 28, 2, 1}},};StreamsCalculationTestCase _2sockets_mock_latency_50 = {1,@@ -2837,9 +2842,7 @@ StreamsCalculationTestCase _1sockets_mock_TP_1 = {"LATENCY",{ov::hint::ModelDistributionPolicy::TENSOR_PARALLEL},{{8, 8, 0, 0, 0, 0, 0}},- {{1, MAIN_CORE_PROC, 16, 0, 0},- {-1, MAIN_CORE_PROC, 8, 0, 0},- {-1, MAIN_CORE_PROC, 8, 0, 0}},+ {{1, MAIN_CORE_PROC, 16, 0, 0}, {-1, MAIN_CORE_PROC, 8, 0, 0}, {-1, MAIN_CORE_PROC, 8, 0, 0}},};StreamsCalculationTestCase _1sockets_mock_TP_2 = {1,@@ -2850,9 +2853,7 @@ StreamsCalculationTestCase _1sockets_mock_TP_2 = {"LATENCY",{ov::hint::ModelDistributionPolicy::TENSOR_PARALLEL},{{8, 8, 0, 0, 0, 0, 0}},- {{1, MAIN_CORE_PROC, 2, 0, 0},- {-1, MAIN_CORE_PROC, 1, 0, 0},- {-1, MAIN_CORE_PROC, 1, 0, 0}},+ {{1, MAIN_CORE_PROC, 2, 0, 0}, {-1, MAIN_CORE_PROC, 1, 0, 0}, {-1, MAIN_CORE_PROC, 1, 0, 0}},};TEST_P(StreamsCalculationTests, StreamsCalculation) {}@@ -3066,6 +3067,7 @@ INSTANTIATE_TEST_SUITE_P(StreamsInfoTable,_1sockets_mock_latency_10,_1sockets_mock_latency_11,_1sockets_mock_latency_12,+ _1sockets_mock_latency_13,_1sockets_mock_TP_1,_1sockets_mock_TP_2));