Skip to content

Commit

Permalink
[CPU] Change default number of streams in latency mode to 1 (#22216)
Browse files Browse the repository at this point in the history
Previous behavior was to create number of streams equal number of CPU sockets
  • Loading branch information
wangleis authored Jan 23, 2024
1 parent c28647e commit 7052c23
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 71 deletions.
20 changes: 5 additions & 15 deletions src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ std::vector<std::vector<int>> get_streams_info_table(const int input_streams,
stream_info[PROC_TYPE] = ALL_PROC;
}
}
} else if (((input_streams_changed == false) &&
} else if ((((input_streams_changed == false) || ((input_streams_changed == true) && (input_streams == 1))) &&
(latencyThreadingMode == Config::LatencyThreadingMode::PER_PLATFORM)) ||
(proc_type_table.size() == 1) || ((input_streams_changed == true) && (input_streams == 1))) {
(proc_type_table.size() == 1)) {
n_streams = 1;
if ((proc_type_table.size() == 1) && (model_prefer_threads > 0)) {
stream_info[NUMBER_OF_STREAMS] = n_streams;
Expand All @@ -183,27 +183,17 @@ std::vector<std::vector<int>> get_streams_info_table(const int input_streams,
} else {
n_threads_per_stream = proc_type_table[0][ALL_PROC];
}
} else if ((input_streams_changed == false) &&
} else if (((input_streams_changed == false) || ((input_streams_changed == true) && (input_streams == 1))) &&
(latencyThreadingMode == Config::LatencyThreadingMode::PER_SOCKET)) {
for (auto& row : proc_socket_table) {
n_threads_per_stream = std::max(n_threads_per_stream, row[ALL_PROC]);
}
for (auto& row : proc_socket_table) {
if (n_threads_per_stream <= row[ALL_PROC]) {
n_streams++;
}
}
n_streams = input_infer_requests > 0 ? std::min(input_infer_requests, n_streams) : n_streams;
n_streams = 1;
} else {
for (size_t i = 1; i < proc_type_table.size(); i++) {
n_threads_per_stream = std::max(n_threads_per_stream, proc_type_table[i][ALL_PROC]);
}
for (size_t i = 1; i < proc_type_table.size(); i++) {
if (n_threads_per_stream <= proc_type_table[i][ALL_PROC]) {
n_streams++;
}
}
n_streams = input_infer_requests > 0 ? std::min(input_infer_requests, n_streams) : n_streams;
n_streams = 1;
}
} else {
n_threads =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ StreamGenerateionTestCase generation_latency_2sockets_48cores_6 = {
false,
ov::hint::PerformanceMode::LATENCY,
{{48, 48, 0, 0, -1, -1}, {24, 24, 0, 0, 0, 0}, {24, 24, 0, 0, 1, 1}},
{{1, MAIN_CORE_PROC, 24, 0, 0}, {1, MAIN_CORE_PROC, 24, 1, 1}},
{{1, MAIN_CORE_PROC, 24, 0, 0}},
};

StreamGenerateionTestCase generation_latency_2sockets_48cores_7 = {
Expand All @@ -325,7 +325,7 @@ StreamGenerateionTestCase generation_latency_2sockets_48cores_7 = {
false,
ov::hint::PerformanceMode::LATENCY,
{{48, 48, 0, 0, -1, -1}, {24, 24, 0, 0, 0, 0}, {24, 24, 0, 0, 1, 1}},
{{1, MAIN_CORE_PROC, 24, 0, 0}, {1, MAIN_CORE_PROC, 24, 1, 1}},
{{1, MAIN_CORE_PROC, 24, 0, 0}},
};

StreamGenerateionTestCase generation_latency_2sockets_48cores_8 = {
Expand All @@ -347,7 +347,7 @@ StreamGenerateionTestCase generation_latency_2sockets_48cores_8 = {
false,
ov::hint::PerformanceMode::LATENCY,
{{48, 48, 0, 0, -1, -1}, {24, 24, 0, 0, 0, 0}, {24, 24, 0, 0, 1, 1}},
{{1, ALL_PROC, 48, -1, -1}, {0, MAIN_CORE_PROC, 24, 0, 0}, {0, MAIN_CORE_PROC, 24, 1, 1}},
{{1, MAIN_CORE_PROC, 24, 0, 0}},
};

StreamGenerateionTestCase generation_latency_2sockets_48cores_9 = {
Expand All @@ -369,7 +369,7 @@ StreamGenerateionTestCase generation_latency_2sockets_48cores_9 = {
false,
ov::hint::PerformanceMode::LATENCY,
{{48, 48, 0, 0, -1, -1}, {24, 24, 0, 0, 0, 0}, {24, 24, 0, 0, 1, 1}},
{{1, ALL_PROC, 48, -1, -1}, {0, MAIN_CORE_PROC, 24, 0, 0}, {0, MAIN_CORE_PROC, 24, 1, 1}},
{{1, MAIN_CORE_PROC, 24, 0, 0}},
};

StreamGenerateionTestCase generation_tput_1sockets_14cores_2 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_socket_1 = {
"LATENCY",
ov::intel_cpu::Config::LatencyThreadingMode::PER_SOCKET,
{{208, 104, 0, 104, -1, -1}, {104, 52, 0, 52, 0, 0}, {104, 52, 0, 52, 1, 1}},
{{1, ALL_PROC, 104, 0, 0},
{0, MAIN_CORE_PROC, 52, 0, 0},
{0, HYPER_THREADING_PROC, 52, 0, 0},
{1, ALL_PROC, 104, 1, 1},
{0, MAIN_CORE_PROC, 52, 1, 1},
{0, HYPER_THREADING_PROC, 52, 1, 1}},
{{1, ALL_PROC, 104, 0, 0}, {0, MAIN_CORE_PROC, 52, 0, 0}, {0, HYPER_THREADING_PROC, 52, 0, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_socket_2 = {
1,
Expand All @@ -142,7 +137,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_socket_2 = {
"LATENCY",
ov::intel_cpu::Config::LatencyThreadingMode::PER_SOCKET,
{{104, 104, 0, 0, -1, -1}, {52, 52, 0, 0, 0, 0}, {52, 52, 0, 0, 1, 1}},
{{1, MAIN_CORE_PROC, 52, 0, 0}, {1, MAIN_CORE_PROC, 52, 1, 1}},
{{1, MAIN_CORE_PROC, 52, 0, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_socket_3 = {
1,
Expand All @@ -161,12 +156,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_socket_3 = {
{0, MAIN_CORE_PROC, 26, 0, 0},
{0, MAIN_CORE_PROC, 26, 1, 0},
{0, HYPER_THREADING_PROC, 26, 0, 0},
{0, HYPER_THREADING_PROC, 26, 1, 0},
{1, ALL_PROC, 104, -1, 1},
{0, MAIN_CORE_PROC, 26, 2, 1},
{0, MAIN_CORE_PROC, 26, 3, 1},
{0, HYPER_THREADING_PROC, 26, 2, 1},
{0, HYPER_THREADING_PROC, 26, 3, 1}},
{0, HYPER_THREADING_PROC, 26, 1, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_socket_4 = {
1,
Expand All @@ -177,12 +167,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_socket_4 = {
"LATENCY",
ov::intel_cpu::Config::LatencyThreadingMode::PER_SOCKET,
{{104, 104, 0, 0, -1, -1}, {26, 26, 0, 0, 0, 0}, {26, 26, 0, 0, 1, 0}, {26, 26, 0, 0, 2, 1}, {26, 26, 0, 0, 3, 1}},
{{1, ALL_PROC, 52, -1, 0},
{0, MAIN_CORE_PROC, 26, 0, 0},
{0, MAIN_CORE_PROC, 26, 1, 0},
{1, ALL_PROC, 52, -1, 1},
{0, MAIN_CORE_PROC, 26, 2, 1},
{0, MAIN_CORE_PROC, 26, 3, 1}},
{{1, ALL_PROC, 52, -1, 0}, {0, MAIN_CORE_PROC, 26, 0, 0}, {0, MAIN_CORE_PROC, 26, 1, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_socket_5 = {
1,
Expand Down Expand Up @@ -215,11 +200,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_socket_7 = {
"LATENCY",
ov::intel_cpu::Config::LatencyThreadingMode::PER_SOCKET,
{{104, 104, 0, 0, -1, -1}, {26, 26, 0, 0, 0, 0}, {26, 26, 0, 0, 1, 0}, {26, 26, 0, 0, 2, 1}, {26, 26, 0, 0, 3, 1}},
{{1, ALL_PROC, 104, -1, -1},
{0, MAIN_CORE_PROC, 26, 0, 0},
{0, MAIN_CORE_PROC, 26, 1, 0},
{0, MAIN_CORE_PROC, 26, 2, 1},
{0, MAIN_CORE_PROC, 26, 3, 1}},
{{1, ALL_PROC, 52, -1, 0}, {0, MAIN_CORE_PROC, 26, 0, 0}, {0, MAIN_CORE_PROC, 26, 1, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_socket_8 = {
1,
Expand Down Expand Up @@ -267,12 +248,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_node_1 = {
"LATENCY",
ov::intel_cpu::Config::LatencyThreadingMode::PER_NUMA_NODE,
{{208, 104, 0, 104, -1, -1}, {104, 52, 0, 52, 0, 0}, {104, 52, 0, 52, 1, 1}},
{{1, ALL_PROC, 104, 0, 0},
{0, MAIN_CORE_PROC, 52, 0, 0},
{0, HYPER_THREADING_PROC, 52, 0, 0},
{1, ALL_PROC, 104, 1, 1},
{0, MAIN_CORE_PROC, 52, 1, 1},
{0, HYPER_THREADING_PROC, 52, 1, 1}},
{{1, ALL_PROC, 104, 0, 0}, {0, MAIN_CORE_PROC, 52, 0, 0}, {0, HYPER_THREADING_PROC, 52, 0, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_node_2 = {
1,
Expand All @@ -283,7 +259,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_node_2 = {
"LATENCY",
ov::intel_cpu::Config::LatencyThreadingMode::PER_NUMA_NODE,
{{104, 104, 0, 0, -1, -1}, {52, 52, 0, 0, 0, 0}, {52, 52, 0, 0, 1, 1}},
{{1, MAIN_CORE_PROC, 52, 0, 0}, {1, MAIN_CORE_PROC, 52, 1, 1}},
{{1, MAIN_CORE_PROC, 52, 0, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_node_3 = {
1,
Expand All @@ -298,18 +274,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_node_3 = {
{52, 26, 0, 26, 1, 0},
{52, 26, 0, 26, 2, 1},
{52, 26, 0, 26, 3, 1}},
{{1, ALL_PROC, 52, -1, 0},
{0, MAIN_CORE_PROC, 26, 0, 0},
{0, MAIN_CORE_PROC, 26, 1, 0},
{1, ALL_PROC, 52, -1, 1},
{0, MAIN_CORE_PROC, 26, 2, 1},
{0, MAIN_CORE_PROC, 26, 3, 1},
{1, ALL_PROC, 52, -1, 0},
{0, HYPER_THREADING_PROC, 26, 0, 0},
{0, HYPER_THREADING_PROC, 26, 1, 0},
{1, ALL_PROC, 52, -1, 1},
{0, HYPER_THREADING_PROC, 26, 2, 1},
{0, HYPER_THREADING_PROC, 26, 3, 1}},
{{1, ALL_PROC, 52, -1, 0}, {0, MAIN_CORE_PROC, 26, 0, 0}, {0, MAIN_CORE_PROC, 26, 1, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_node_4 = {
1,
Expand All @@ -320,10 +285,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_node_4 = {
"LATENCY",
ov::intel_cpu::Config::LatencyThreadingMode::PER_NUMA_NODE,
{{104, 104, 0, 0, -1, -1}, {26, 26, 0, 0, 0, 0}, {26, 26, 0, 0, 1, 0}, {26, 26, 0, 0, 2, 1}, {26, 26, 0, 0, 3, 1}},
{{1, MAIN_CORE_PROC, 26, 0, 0},
{1, MAIN_CORE_PROC, 26, 1, 0},
{1, MAIN_CORE_PROC, 26, 2, 1},
{1, MAIN_CORE_PROC, 26, 3, 1}},
{{1, MAIN_CORE_PROC, 26, 0, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_node_5 = {
1,
Expand All @@ -334,11 +296,7 @@ StreamsCalculationTestCase _2sockets_104cores_latency_node_5 = {
"LATENCY",
ov::intel_cpu::Config::LatencyThreadingMode::PER_NUMA_NODE,
{{104, 104, 0, 0, -1, -1}, {26, 26, 0, 0, 0, 0}, {26, 26, 0, 0, 1, 0}, {26, 26, 0, 0, 2, 1}, {26, 26, 0, 0, 3, 1}},
{{1, ALL_PROC, 104, -1, -1},
{0, MAIN_CORE_PROC, 26, 0, 0},
{0, MAIN_CORE_PROC, 26, 1, 0},
{0, MAIN_CORE_PROC, 26, 2, 1},
{0, MAIN_CORE_PROC, 26, 3, 1}},
{{1, MAIN_CORE_PROC, 26, 0, 0}},
};
StreamsCalculationTestCase _2sockets_104cores_latency_node_6 = {
1,
Expand Down

0 comments on commit 7052c23

Please sign in to comment.