Skip to content

Commit

Permalink
identify arm64 and thoughput setting
Browse files Browse the repository at this point in the history
  • Loading branch information
wangleis committed Dec 27, 2024
1 parent c14134a commit cfb4e34
Showing 1 changed file with 17 additions and 3 deletions.
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

0 comments on commit cfb4e34

Please sign in to comment.