Skip to content

Commit

Permalink
identify arm cpu isa and update model prefer threads for tput (#28207)
Browse files Browse the repository at this point in the history
### Details:
 - *identify arm cpu isa and update model prefer threads for tput*

### Tickets:
 - *CVS-148164*
  • Loading branch information
wangleis authored Jan 8, 2025
1 parent b13ea4b commit 45b719b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 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,12 @@ 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::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 +588,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 +599,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 +621,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 +640,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

0 comments on commit 45b719b

Please sign in to comment.