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

[arm-linux] arm linux support FT2000PLUS CPU, test=develop #2751

Merged
merged 1 commit into from Jan 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 23 additions & 3 deletions lite/core/device_info.cc
Expand Up @@ -79,7 +79,7 @@ const int DEFAULT_L3_CACHE_SIZE = 0;
int get_cpu_num() {
#ifdef LITE_WITH_LINUX
// get cpu count from /sys/devices/system/cpu/cpunum/uevent
int max_cpu_num = 20;
int max_cpu_num = 128;
int cpu_num = 0;
for (int i = 0; i < max_cpu_num; ++i) {
char path[256];
Expand Down Expand Up @@ -227,19 +227,24 @@ void get_cpu_arch(std::vector<ARMArch>* archs, const int cpu_num) {
#ifdef LITE_WITH_LINUX

std::string get_cpu_name() {
std::string cpu_name;
std::string cpu_name = "";
FILE* fp = fopen("/proc/cpuinfo", "rb");
if (!fp) {
return "";
}
char line[1024];
bool first_model_name = true;
while (!feof(fp)) {
char* s = fgets(line, 1024, fp);
if (!s) {
break;
}
if (strstr(line, "Hardware") != NULL) {
cpu_name = std::string(line);
cpu_name += std::string(line);
}
if (strstr(line, "model name") != NULL && first_model_name) {
cpu_name += std::string(line);
first_model_name = false;
}
}
#ifdef LITE_WITH_ANDROID
Expand Down Expand Up @@ -816,6 +821,21 @@ bool DeviceInfo::SetCPUInfoByName() {
SetFP16Info(1, 1);
SetDotInfo(1, 1);
return true;
} else if (dev_name_.find("FT2000PLUS") != std::string::npos) {
core_num_ = 64;
core_ids_.resize(core_num_);
big_core_ids_.resize(core_num_);
cluster_ids_.resize(core_num_);
for (int i = 0; i < core_num_; ++i) {
core_ids_[i] = i;
big_core_ids_[i] = i;
cluster_ids_[i] = 0;
}
little_core_ids_ = {};
SetCacheInfo(0, 1, 64 * 1024);
SetCacheInfo(1, 1, 32 * 1024 * 1024);
SetCacheInfo(2, 1, 128 * 1024 * 1024);
return true;
}
return false;
}
Expand Down