Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

identify arm cpu isa and update model prefer threads for tput #28207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#include <numeric>
#include <unordered_set>

#if (defined(OPENVINO_ARCH_ARM64) && defined(__linux__))
# include "cpu/aarch64/cpu_isa_traits.hpp"
#endif
#include "cpu_map_scheduling.hpp"
#include "graph.h"
#include "openvino/op/fake_quantize.hpp"
Expand Down Expand Up @@ -552,6 +555,16 @@ int get_model_prefer_threads(const int num_streams,
const int sockets = get_num_sockets();
auto model_prefer = 0;
if (-1 == config.modelPreferThreads) {
#if (defined(OPENVINO_ARCH_ARM64) && defined(__linux__))
config.modelPreferThreads = 8;
if (dnnl::impl::cpu::aarch64::mayiuse(dnnl::impl::cpu::aarch64::cpu_isa_t::isa_all) ||
dnnl::impl::cpu::aarch64::mayiuse(dnnl::impl::cpu::aarch64::cpu_isa_t::sve_512) ||
dnnl::impl::cpu::aarch64::mayiuse(dnnl::impl::cpu::aarch64::cpu_isa_t::sve_384) ||
dnnl::impl::cpu::aarch64::mayiuse(dnnl::impl::cpu::aarch64::cpu_isa_t::sve_256) ||
dnnl::impl::cpu::aarch64::mayiuse(dnnl::impl::cpu::aarch64::cpu_isa_t::sve_128)) {
config.modelPreferThreads = 16;
}
#else
const auto isa = dnnl::get_effective_cpu_isa();
float isaSpecificThreshold = 1.0f;
switch (isa) {
Expand Down Expand Up @@ -579,7 +592,7 @@ int get_model_prefer_threads(const int num_streams,
ov::MemBandwidthPressure networkToleranceForLowCache =
ov::mem_bandwidth_pressure_tolerance(model, L2_cache_size, memThresholdAssumeLimitedForISA);

#if ((defined(OPENVINO_ARCH_ARM) || defined(OPENVINO_ARCH_ARM64)) && defined(__linux__))
# if (defined(OPENVINO_ARCH_ARM) && defined(__linux__))
config.modelPreferThreads = 4;
if (networkToleranceForLowCache.max_mem_tolerance == ov::MemBandwidthPressure::UNKNOWN) {
if (networkToleranceForLowCache.ratio_compute_convs == ov::MemBandwidthPressure::ALL) {
Expand All @@ -590,7 +603,7 @@ int get_model_prefer_threads(const int num_streams,
(networkToleranceForLowCache.ratio_mem_limited_gemms > ov::MemBandwidthPressure::LIMITED))) {
config.modelPreferThreads = 8;
}
#elif ((defined(OPENVINO_ARCH_ARM) || defined(OPENVINO_ARCH_ARM64)) && defined(__APPLE__))
# elif ((defined(OPENVINO_ARCH_ARM) || defined(OPENVINO_ARCH_ARM64)) && defined(__APPLE__))
config.modelPreferThreads = 1;
if (networkToleranceForLowCache.max_mem_tolerance == ov::MemBandwidthPressure::UNKNOWN) {
if ((networkToleranceForLowCache.ratio_compute_convs == ov::MemBandwidthPressure::ALL) ||
Expand All @@ -612,7 +625,7 @@ int get_model_prefer_threads(const int num_streams,
networkToleranceForLowCache.ratio_compute_convs > ov::MemBandwidthPressure::LIMITED) {
config.modelPreferThreads = 2;
}
#else
# else
config.modelPreferThreads = 0;
if (networkToleranceForLowCache.max_mem_tolerance == ov::MemBandwidthPressure::UNKNOWN) {
if ((networkToleranceForLowCache.ratio_compute_convs == ov::MemBandwidthPressure::ALL) ||
Expand All @@ -631,6 +644,7 @@ int get_model_prefer_threads(const int num_streams,
(proc_type_table[0][HYPER_THREADING_PROC] == proc_type_table[0][MAIN_CORE_PROC])) {
config.modelPreferThreads = 2;
}
# endif
#endif
}

Expand Down
Loading