aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-11-25 02:24:11 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-11-25 02:24:11 +0000
commitfdf3ab8e43e75543ee092f5e456e298da59b98e0 (patch)
treef1771e2731ad33a40f00fff88df7173c2d903dc8
parentd2c515860e2449d9edfab79206f490db52da7241 (diff)
parent5a5f91e7392a1c2eb20419e91fe6a48145d5bd3a (diff)
downloadcpuinfo-fdf3ab8e43e75543ee092f5e456e298da59b98e0.tar.gz
Upgrade cpuinfo to ed8b86a253800bafdb7b25c5c399f91bff9cb1f3 am: 5a5f91e739
Original change: https://android-review.googlesource.com/c/platform/external/cpuinfo/+/1505252 Change-Id: Iba58d6acf18d9dd4655e3feb9ed8c1eaa36f1374
-rw-r--r--CMakeLists.txt8
-rw-r--r--METADATA6
-rw-r--r--include/cpuinfo.h4
-rw-r--r--src/arm/mach/init.c7
-rw-r--r--src/init.c2
-rw-r--r--tools/cpu-info.c4
6 files changed, 24 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b85620f..06aee4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,7 +67,7 @@ IF(NOT CMAKE_SYSTEM_PROCESSOR)
"cpuinfo will compile, but cpuinfo_initialize() will always fail.")
SET(CPUINFO_SUPPORTED_PLATFORM FALSE)
ENDIF()
-ELSEIF(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?|armv[5-8].*|aarch64)$")
+ELSEIF(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?|armv[5-8].*|aarch64|arm64)$")
MESSAGE(WARNING
"Target processor architecture \"${CMAKE_SYSTEM_PROCESSOR}\" is not supported in cpuinfo. "
"cpuinfo will compile, but cpuinfo_initialize() will always fail.")
@@ -146,7 +146,7 @@ IF(CPUINFO_SUPPORTED_PLATFORM)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$")
LIST(APPEND CPUINFO_SRCS src/x86/windows/init.c)
ENDIF()
- ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv[5-8].*|aarch64)$" OR IOS_ARCH MATCHES "^(armv7.*|arm64.*)$")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv[5-8].*|aarch64|arm64)$" OR IOS_ARCH MATCHES "^(armv7.*|arm64.*)$")
LIST(APPEND CPUINFO_SRCS
src/arm/uarch.c
src/arm/cache.c)
@@ -163,10 +163,10 @@ IF(CPUINFO_SUPPORTED_PLATFORM)
IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND ANDROID_ABI STREQUAL "armeabi")
SET_SOURCE_FILES_PROPERTIES(src/arm/linux/aarch32-isa.c PROPERTIES COMPILE_FLAGS -marm)
ENDIF()
- ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)$")
LIST(APPEND CPUINFO_SRCS src/arm/linux/aarch64-isa.c)
ENDIF()
- ELSEIF(IOS)
+ ELSEIF(IOS OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64"))
LIST(APPEND CPUINFO_SRCS src/arm/mach/init.c)
ENDIF()
IF(CMAKE_SYSTEM_NAME STREQUAL "Android")
diff --git a/METADATA b/METADATA
index 4193ad0..2ba3f67 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@ third_party {
type: GIT
value: "https://github.com/pytorch/cpuinfo"
}
- version: "63b254577ed77a8004a9be6ac707f3dccc4e1fd9"
+ version: "ed8b86a253800bafdb7b25c5c399f91bff9cb1f3"
license_type: NOTICE
last_upgrade_date {
year: 2020
- month: 8
- day: 6
+ month: 11
+ day: 19
}
}
diff --git a/include/cpuinfo.h b/include/cpuinfo.h
index 85ce174..e2e6564 100644
--- a/include/cpuinfo.h
+++ b/include/cpuinfo.h
@@ -484,6 +484,10 @@ enum cpuinfo_uarch {
cpuinfo_uarch_lightning = 0x00700109,
/** Apple A13 processor (little cores). */
cpuinfo_uarch_thunder = 0x0070010A,
+ /** Apple M1 processor (big cores). */
+ cpuinfo_uarch_firestorm = 0x0070010B,
+ /** Apple M1 processor (little cores). */
+ cpuinfo_uarch_icestorm = 0x0070010C,
/** Cavium ThunderX. */
cpuinfo_uarch_thunderx = 0x00800100,
diff --git a/src/arm/mach/init.c b/src/arm/mach/init.c
index e912de6..d820744 100644
--- a/src/arm/mach/init.c
+++ b/src/arm/mach/init.c
@@ -25,6 +25,10 @@
#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504D2
#endif
+#ifndef CPUFAMILY_ARM_FIRESTORM_ICESTORM
+ #define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1B588BB3
+#endif
+
struct cpuinfo_arm_isa cpuinfo_isa = {
#if CPUINFO_ARCH_ARM
.thumb = true,
@@ -101,6 +105,9 @@ static enum cpuinfo_uarch decode_uarch(uint32_t cpu_family, uint32_t cpu_subtype
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
/* Hexa-core: 2x Lightning + 4x Thunder; Octa-core (presumed): 4x Lightning + 4x Thunder */
return core_index + 4 < core_count ? cpuinfo_uarch_lightning : cpuinfo_uarch_thunder;
+ case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
+ /* Hexa-core: 2x Firestorm + 4x Icestorm; Octa-core: 4x Firestorm + 4x Icestorm */
+ return core_index + 4 < core_count ? cpuinfo_uarch_firestorm : cpuinfo_uarch_icestorm;
default:
/* Use hw.cpusubtype for detection */
break;
diff --git a/src/init.c b/src/init.c
index 0d8cc3b..f703e8e 100644
--- a/src/init.c
+++ b/src/init.c
@@ -37,6 +37,8 @@ bool CPUINFO_ABI cpuinfo_initialize(void) {
pthread_once(&init_guard, &cpuinfo_arm_linux_init);
#elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
pthread_once(&init_guard, &cpuinfo_arm_mach_init);
+ #elif defined(__MACH__) && defined(__APPLE__)
+ pthread_once(&init_guard, &cpuinfo_arm_mach_init);
#else
cpuinfo_log_error("operating system is not supported in cpuinfo");
#endif
diff --git a/tools/cpu-info.c b/tools/cpu-info.c
index 429bbfa..55d654f 100644
--- a/tools/cpu-info.c
+++ b/tools/cpu-info.c
@@ -233,6 +233,10 @@ static const char* uarch_to_string(enum cpuinfo_uarch uarch) {
return "Lightning";
case cpuinfo_uarch_thunder:
return "Thunder";
+ case cpuinfo_uarch_firestorm:
+ return "Firestorm";
+ case cpuinfo_uarch_icestorm:
+ return "Icestorm";
case cpuinfo_uarch_thunderx:
return "ThunderX";
case cpuinfo_uarch_thunderx2: