diff --git a/cpp/oneapi/dal/algo/subgraph_isomorphism/backend/cpu/matching.hpp b/cpp/oneapi/dal/algo/subgraph_isomorphism/backend/cpu/matching.hpp index 03b0d7f7751..60781fad24d 100755 --- a/cpp/oneapi/dal/algo/subgraph_isomorphism/backend/cpu/matching.hpp +++ b/cpp/oneapi/dal/algo/subgraph_isomorphism/backend/cpu/matching.hpp @@ -457,7 +457,6 @@ solution engine_bundle::run() { std::uint64_t max_threads_count = dal::detail::threader_get_max_threads(); std::uint64_t possible_first_states_count_per_thread = first_states_count / max_threads_count; if (possible_first_states_count_per_thread < 1) { - max_threads_count = first_states_count; possible_first_states_count_per_thread = 1; } else { @@ -465,7 +464,11 @@ solution engine_bundle::run() { static_cast(first_states_count % max_threads_count); } - const std::uint64_t array_size = max_threads_count; + const std::uint64_t array_size = (max_threads_count >= 64) ? max_threads_count * 2 / 10 + : (max_threads_count >= 24) ? max_threads_count * 4 / 10 + : (max_threads_count >= 8) ? 4 + : (max_threads_count >= 4) ? 2 + : 1; auto engine_array_ptr = allocator_.make_shared_memory>(array_size); matching_engine* engine_array = engine_array_ptr.get();