diff --git a/lite/backends/arm/math/packed_sgemm.cc b/lite/backends/arm/math/packed_sgemm.cc index c431c5651db2208e03555217c3d8d89f55c4361a..20f9b12ccef8c17d9826b57e95d8e397a4a7686a 100644 --- a/lite/backends/arm/math/packed_sgemm.cc +++ b/lite/backends/arm/math/packed_sgemm.cc @@ -355,7 +355,7 @@ void sgemm_prepack(bool is_transB, (has_act == false) || (has_act == true && act_type == lite_api::ActivationType::kRelu); bool has_beta = fabsf(beta) > 1e-8f ? true : false; - bool a53_sgemm = act_flag && !has_beta; + bool a53_sgemm = act_flag && !has_beta && ctx->has_a53_valid(); if (a53_sgemm) { sgemm_prepacked_6x8_a53(is_transB, M, diff --git a/lite/core/context.h b/lite/core/context.h index 84742bf478c26e5609c507925c6d28805cb3a70c..f140e7575b82b264e27cec00ac8eb05fcd33eb2d 100644 --- a/lite/core/context.h +++ b/lite/core/context.h @@ -217,6 +217,7 @@ class Context { int llc_size() const { return DeviceInfo::Global().llc_size(); } bool has_dot() const { return DeviceInfo::Global().has_dot(); } bool has_fp16() const { return DeviceInfo::Global().has_fp16(); } + bool has_a53_valid() const { return DeviceInfo::Global().set_a53_valid(); } template T* workspace_data() { diff --git a/lite/core/device_info.cc b/lite/core/device_info.cc index cd135f85b3b55641ae1996b2d3b933e1da7870dc..3d07d65c2eb1f2dce823bf2fd1caac95180fc0f7 100644 --- a/lite/core/device_info.cc +++ b/lite/core/device_info.cc @@ -1009,6 +1009,20 @@ void DeviceInfo::RequestPowerRandLowMode(int shift_num, int thread_num) { } } +bool DeviceInfo::set_a53_valid() { + std::string dev_name = "null"; +#ifdef LITE_WITH_LINUX + dev_name = get_cpu_name(); +#endif + // xiaodu device_name + if (dev_name.find("MT8765WA") != std::string::npos || + dev_name.find("MT8167S") != std::string::npos) { + return false; + } else { + return true; + } +} + int DeviceInfo::Setup() { core_num_ = get_cpu_num(); mem_size_ = get_mem_size(); diff --git a/lite/core/device_info.h b/lite/core/device_info.h index 53d22ef90e44c9a8230df0e0cb2667e519405a71..82f686ba1133c53591c9999ce66ceecbef58c610 100644 --- a/lite/core/device_info.h +++ b/lite/core/device_info.h @@ -56,7 +56,7 @@ class DeviceInfo { } int Setup(); - + bool set_a53_valid(); void SetRunMode(lite_api::PowerMode mode, int thread_num); void SetCache(int l1size, int l2size, int l3size); void SetArch(ARMArch arch) { arch_ = arch; }