未验证 提交 2da739da 编写于 作者: H HappyAngel 提交者: GitHub

[arm] fix xiaodu a53 crash problem (#4437)

* set a53 use or no_use, test=develop

* fix xiaodu a53 crash . test=develop

* fix Mac OS build error. test=develop

* fix build error. test=develop
上级 b2c14f01
...@@ -355,7 +355,7 @@ void sgemm_prepack(bool is_transB, ...@@ -355,7 +355,7 @@ void sgemm_prepack(bool is_transB,
(has_act == false) || (has_act == false) ||
(has_act == true && act_type == lite_api::ActivationType::kRelu); (has_act == true && act_type == lite_api::ActivationType::kRelu);
bool has_beta = fabsf(beta) > 1e-8f ? true : false; 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) { if (a53_sgemm) {
sgemm_prepacked_6x8_a53(is_transB, sgemm_prepacked_6x8_a53(is_transB,
M, M,
......
...@@ -217,6 +217,7 @@ class Context<TargetType::kARM> { ...@@ -217,6 +217,7 @@ class Context<TargetType::kARM> {
int llc_size() const { return DeviceInfo::Global().llc_size(); } int llc_size() const { return DeviceInfo::Global().llc_size(); }
bool has_dot() const { return DeviceInfo::Global().has_dot(); } bool has_dot() const { return DeviceInfo::Global().has_dot(); }
bool has_fp16() const { return DeviceInfo::Global().has_fp16(); } bool has_fp16() const { return DeviceInfo::Global().has_fp16(); }
bool has_a53_valid() const { return DeviceInfo::Global().set_a53_valid(); }
template <typename T> template <typename T>
T* workspace_data() { T* workspace_data() {
......
...@@ -1026,6 +1026,20 @@ void DeviceInfo::RequestPowerRandLowMode(int shift_num, int thread_num) { ...@@ -1026,6 +1026,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() { int DeviceInfo::Setup() {
core_num_ = get_cpu_num(); core_num_ = get_cpu_num();
mem_size_ = get_mem_size(); mem_size_ = get_mem_size();
......
...@@ -58,6 +58,7 @@ class DeviceInfo { ...@@ -58,6 +58,7 @@ class DeviceInfo {
} }
int Setup(); int Setup();
bool set_a53_valid();
void SetRunMode(lite_api::PowerMode mode, int thread_num); void SetRunMode(lite_api::PowerMode mode, int thread_num);
void SetCache(int l1size, int l2size, int l3size); void SetCache(int l1size, int l2size, int l3size);
...@@ -69,6 +70,7 @@ class DeviceInfo { ...@@ -69,6 +70,7 @@ class DeviceInfo {
int l1_cache_size() const { return L1_cache_[active_ids_[0]]; } int l1_cache_size() const { return L1_cache_[active_ids_[0]]; }
int l2_cache_size() const { return L2_cache_[active_ids_[0]]; } int l2_cache_size() const { return L2_cache_[active_ids_[0]]; }
int l3_cache_size() const { return L3_cache_[active_ids_[0]]; } int l3_cache_size() const { return L3_cache_[active_ids_[0]]; }
// Methods for allocating L3Cache on Arm platform // Methods for allocating L3Cache on Arm platform
// Enum class L3CacheSetMethod is declared in `lite/api/paddle_api.h` // Enum class L3CacheSetMethod is declared in `lite/api/paddle_api.h`
void SetArmL3CacheSize( void SetArmL3CacheSize(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册