Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[CPU][ARM] Support 2D parallel in ACL scheduler and upgrade ACL to 25.03 (#28669)

Aleksandr Vorona2edcedd47c3
diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_ie_scheduler.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_ie_scheduler.cpp
index 2d0b7669291..2afc0247c09 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_ie_scheduler.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_ie_scheduler.cpp
@@ -8,6 +8,7 @@
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Helpers.h"
#include "openvino/core/parallel.hpp"
+#include "src/runtime/SchedulerUtils.h"
namespace ov::intel_cpu {
@@ -22,15 +23,16 @@ unsigned int ACLScheduler::num_threads() const {
void ACLScheduler::set_num_threads(unsigned int num_threads) {}
void ACLScheduler::schedule_custom(ICPPKernel* kernel, const Hints& hints, const Window& window, ITensorPack& tensors) {
- const Window& max_window = window;
- const unsigned int num_iterations = max_window.num_iterations(hints.split_dimension());
+ auto get_num_threads = [](unsigned int num_iterations) {
#if OV_THREAD == OV_THREAD_OMP
- // In OpenMP case parallel_get_num_threads() method returns 1 here because it's called outside parallel section
- // This is the reason why this method isn't used to initialize _num_threads
- const auto _num_threads = num_iterations;
+ // In OpenMP case parallel_get_num_threads() method returns 1 here because it's called outside parallel section
+ // This is the reason why this method isn't used to initialize _num_threads
+ return num_iterations;
#else
- const auto _num_threads = std::min(num_iterations, static_cast<unsigned int>(parallel_get_num_threads()));
+ return std::min(num_iterations, static_cast<unsigned int>(parallel_get_num_threads()));
#endif
+ };
+
std::function<void(const Window& window, const ThreadInfo& info)> main_run;
if (tensors.empty()) {
main_run = [&](const Window& window, const ThreadInfo& info) {
@@ -42,19 +44,46 @@ void ACLScheduler::schedule_custom(ICPPKernel* kernel, const Hints& hints, const
};
}
- if (!kernel->is_parallelisable() || _num_threads == 1) {
- ThreadInfo info;
- info.cpu_info = &cpu_info();
- main_run(max_window, info);
- } else {
- const auto num_windows = _num_threads;
- const auto hints_split_dimension = hints.split_dimension();
+ const Window& max_window = window;
+ if (hints.split_dimension() == IScheduler::split_dimensions_all) {
+ const unsigned int m = max_window.num_iterations(Window::DimX);
+ const unsigned int n = max_window.num_iterations(Window::DimY);
+ const unsigned int num_iterations = m * n;
+ const auto num_threads = get_num_threads(num_iterations);
- ov::parallel_for(num_windows, [&](int wid) {
- Window win = max_window.split_window(hints_split_dimension, wid, num_windows);
+ unsigned m_threads, n_threads;
+ std::tie(m_threads, n_threads) = scheduler_utils::split_2d(num_threads, m, n);
+ unsigned int max_parallelism = std::min<unsigned int>(m, m_threads) * std::min<unsigned int>(n, n_threads);
+ if (max_parallelism < num_threads) {
+ m_threads = std::min<unsigned int>(m, m_threads);
+ n_threads = std::min<unsigned int>(n, n_threads);
+ }
+
+ ov::parallel_for(m_threads * n_threads, [&](int wid) {
+ int mi = wid / n_threads;
+ int ni = wid % n_threads;
+ Window win = max_window.split_window(Window::DimX, mi, m_threads).split_window(Window::DimY, ni, n_threads);
win.validate();
- main_run(win, {wid, static_cast<int>(_num_threads), &cpu_info()});
+ main_run(win, {wid, static_cast<int>(num_threads), &cpu_info()});
});
+ } else {
+ const unsigned int num_iterations = max_window.num_iterations(hints.split_dimension());
+ const auto _num_threads = get_num_threads(num_iterations);
+
+ if (!kernel->is_parallelisable() || _num_threads == 1) {
+ ThreadInfo info;
+ info.cpu_info = &cpu_info();
+ main_run(max_window, info);
+ } else {
+ const auto num_windows = _num_threads;
+ const auto hints_split_dimension = hints.split_dimension();
+
+ ov::parallel_for(num_windows, [&](int wid) {
+ Window win = max_window.split_window(hints_split_dimension, wid, num_windows);
+ win.validate();
+ main_run(win, {wid, static_cast<int>(_num_threads), &cpu_info()});
+ });
+ }
}
}
diff --git a/src/plugins/intel_cpu/thirdparty/ACLConfig.cmake b/src/plugins/intel_cpu/thirdparty/ACLConfig.cmake
index 580db7640f3..617be73dfdd 100644
--- a/src/plugins/intel_cpu/thirdparty/ACLConfig.cmake
+++ b/src/plugins/intel_cpu/thirdparty/ACLConfig.cmake
@@ -234,7 +234,7 @@ elseif(NOT TARGET arm_compute::arm_compute)
list(APPEND ARM_COMPUTE_OPTIONS
compiler_prefix="${ANDROID_TOOLCHAIN_ROOT}/bin/")
- set(extra_flags "${extra_flags} --target=${ANDROID_LLVM_TRIPLE}")
+ set(extra_cc_flags "--target=${ANDROID_LLVM_TRIPLE}")
set(extra_flags "${extra_flags} --gcc-toolchain=${ANDROID_TOOLCHAIN_ROOT}")
set(extra_flags "${extra_flags} --sysroot=${CMAKE_SYSROOT}")
@@ -338,6 +338,9 @@ elseif(NOT TARGET arm_compute::arm_compute)
if(extra_cxx_flags)
list(APPEND ARM_COMPUTE_OPTIONS extra_cxx_flags=${extra_cxx_flags})
endif()
+ if(extra_cc_flags)
+ list(APPEND ARM_COMPUTE_OPTIONS extra_cc_flags=${extra_cc_flags})
+ endif()
if(NOT CMAKE_VERBOSE_MAKEFILE)
list(APPEND ARM_COMPUTE_OPTIONS --silent)
diff --git a/src/plugins/intel_cpu/thirdparty/ComputeLibrary b/src/plugins/intel_cpu/thirdparty/ComputeLibrary
index c61bd338740..94f2a2cf17f 160000
--- a/src/plugins/intel_cpu/thirdparty/ComputeLibrary
+++ b/src/plugins/intel_cpu/thirdparty/ComputeLibrary
@@ -1 +1 @@
-Subproject commit c61bd3387403b76d618915ccebf5e9585f52a071
+Subproject commit 94f2a2cf17fb81c85e7eec2ed859355cf91d8b11