[CPU] [Snippets] Fix performance regression in calling parallel_nt (#24832)

### Details:
- *This PR fixes geomean level performance issue caused by
https://github.com/openvinotoolkit/openvino/pull/23180 on platforms with
sufficient cores.*
- *In the PR mensioned above, `parallel_nt` is used for executing
subgraph instead of `parallel_for5d`, becuase the former has performance
advantage for the case where #tasks is more than #threads*. That is
becuase using `parallel_nt`, we can initilize parameters for each
thread, while parameters are initilized for each task in using
`parallel_for5d`. So `parallel_nt` has less overheads.
- *However, for the case where #tasks is less than #threads,
`parallel_nt` brings performance regression. Because compared with
`parallel_for5d`, `parallel_nt` doesn't apply the argument
`tbb::static_partitioner{}` when calling `tbb::parallel_for`. Here we
use `parallel_nt_static` instead to fix the performance regression.*
This commit is contained in:
Chen Xu 2024-06-05 15:27:36 +08:00 committed by GitHub
parent f952f73d6b
commit dd0846b8d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -879,7 +879,7 @@ void Subgraph::SubgraphExecutor::parallel_for6d(const std::function<void(jit_sni
segfault_detector();
#endif
parallel_nt(m_nthreads, [&](const int ithr, const int nthr) {
parallel_nt_static(m_nthreads, [&](const int ithr, const int nthr) {
jit_snippets_call_args call_args;
initializer(call_args);
@ -903,7 +903,7 @@ void Subgraph::SubgraphExecutor::parallel_forNd(const std::function<void(jit_sni
segfault_detector();
#endif
parallel_nt(m_nthreads, [&](const int ithr, const int nthr) {
parallel_nt_static(m_nthreads, [&](const int ithr, const int nthr) {
jit_snippets_call_args call_args;
initializer(call_args);