diff options
author | Ashkan Aliabadi <ashkanaliabadi@fb.com> | 2020-03-19 19:34:26 -0700 |
---|---|---|
committer | Ashkan Aliabadi <ashkanaliabadi@fb.com> | 2020-03-19 19:34:26 -0700 |
commit | dcf8e1896b8b0df6ad9a02e2a8765b6630557e0c (patch) | |
tree | 8ed9c44333fc3994ae11ea3426e68784417338a0 /include/cpuinfo.h | |
parent | d6c0f915ee737f961915c9d17f1679b6777af207 (diff) | |
download | cpuinfo-dcf8e1896b8b0df6ad9a02e2a8765b6630557e0c.tar.gz |
Upstream cpuinfo updates in XNNPACK as of XNNPACK:c58bd3486d52db9c6b9934912790db741bc366f6.
Diffstat (limited to 'include/cpuinfo.h')
-rw-r--r-- | include/cpuinfo.h | 64 |
1 files changed, 56 insertions, 8 deletions
diff --git a/include/cpuinfo.h b/include/cpuinfo.h index 9938d2b..e4d2d0c 100644 --- a/include/cpuinfo.h +++ b/include/cpuinfo.h @@ -34,10 +34,6 @@ #define CPUINFO_ARCH_PPC64 1 #endif -#if defined(__pnacl__) - #define CPUINFO_ARCH_PNACL 1 -#endif - #if defined(__asmjs__) #define CPUINFO_ARCH_ASMJS 1 #endif @@ -80,10 +76,6 @@ #define CPUINFO_ARCH_PPC64 0 #endif -#ifndef CPUINFO_ARCH_PNACL - #define CPUINFO_ARCH_PNACL 0 -#endif - #ifndef CPUINFO_ARCH_ASMJS #define CPUINFO_ARCH_ASMJS 0 #endif @@ -190,6 +182,12 @@ enum cpuinfo_vendor { * Processors are designed by HiSilicon, a subsidiary of Huawei. */ cpuinfo_vendor_huawei = 15, + /** + * Hygon (Chengdu Haiguang Integrated Circuit Design Co., Ltd), Vendor of x86-64 processor microarchitectures. + * + * Processors are variants of AMD cores. + */ + cpuinfo_vendor_hygon = 16, /* Active vendors of embedded CPUs */ @@ -401,6 +399,8 @@ enum cpuinfo_uarch { cpuinfo_uarch_cortex_a35 = 0x00300335, /** ARM Cortex-A53. */ cpuinfo_uarch_cortex_a53 = 0x00300353, + /** ARM Cortex-A55 revision 0 (restricted dual-issue capabilities compared to revision 1+). */ + cpuinfo_uarch_cortex_a55r0 = 0x00300354, /** ARM Cortex-A55. */ cpuinfo_uarch_cortex_a55 = 0x00300355, /** ARM Cortex-A57. */ @@ -478,6 +478,10 @@ enum cpuinfo_uarch { cpuinfo_uarch_vortex = 0x00700107, /** Apple A12 processor (little cores). */ cpuinfo_uarch_tempest = 0x00700108, + /** Apple A13 processor (big cores). */ + cpuinfo_uarch_lightning = 0x00700109, + /** Apple A13 processor (little cores). */ + cpuinfo_uarch_thunder = 0x0070010A, /** Cavium ThunderX. */ cpuinfo_uarch_thunderx = 0x00800100, @@ -494,6 +498,9 @@ enum cpuinfo_uarch { /** Applied Micro X-Gene. */ cpuinfo_uarch_xgene = 0x00B00100, + + /* Hygon Dhyana (a modification of AMD Zen for Chinese market). */ + cpuinfo_uarch_dhyana = 0x01000100, }; struct cpuinfo_processor { @@ -613,6 +620,22 @@ struct cpuinfo_package { uint32_t cluster_count; }; +struct cpuinfo_uarch_info { + /** Type of CPU microarchitecture */ + enum cpuinfo_uarch uarch; +#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64 + /** Value of CPUID leaf 1 EAX register for the microarchitecture */ + uint32_t cpuid; +#elif CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 + /** Value of Main ID Register (MIDR) for the microarchitecture */ + uint32_t midr; +#endif + /** Number of logical processors with the microarchitecture */ + uint32_t processor_count; + /** Number of cores with the microarchitecture */ + uint32_t core_count; +}; + #ifdef __cplusplus extern "C" { #endif @@ -1721,6 +1744,7 @@ const struct cpuinfo_processor* CPUINFO_ABI cpuinfo_get_processors(void); const struct cpuinfo_core* CPUINFO_ABI cpuinfo_get_cores(void); const struct cpuinfo_cluster* CPUINFO_ABI cpuinfo_get_clusters(void); const struct cpuinfo_package* CPUINFO_ABI cpuinfo_get_packages(void); +const struct cpuinfo_uarch_info* CPUINFO_ABI cpuinfo_get_uarchs(void); const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1i_caches(void); const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1d_caches(void); const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l2_caches(void); @@ -1731,6 +1755,7 @@ const struct cpuinfo_processor* CPUINFO_ABI cpuinfo_get_processor(uint32_t index const struct cpuinfo_core* CPUINFO_ABI cpuinfo_get_core(uint32_t index); const struct cpuinfo_cluster* CPUINFO_ABI cpuinfo_get_cluster(uint32_t index); const struct cpuinfo_package* CPUINFO_ABI cpuinfo_get_package(uint32_t index); +const struct cpuinfo_uarch_info* CPUINFO_ABI cpuinfo_get_uarch(uint32_t index); const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1i_cache(uint32_t index); const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1d_cache(uint32_t index); const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l2_cache(uint32_t index); @@ -1741,6 +1766,7 @@ uint32_t CPUINFO_ABI cpuinfo_get_processors_count(void); uint32_t CPUINFO_ABI cpuinfo_get_cores_count(void); uint32_t CPUINFO_ABI cpuinfo_get_clusters_count(void); uint32_t CPUINFO_ABI cpuinfo_get_packages_count(void); +uint32_t CPUINFO_ABI cpuinfo_get_uarchs_count(void); uint32_t CPUINFO_ABI cpuinfo_get_l1i_caches_count(void); uint32_t CPUINFO_ABI cpuinfo_get_l1d_caches_count(void); uint32_t CPUINFO_ABI cpuinfo_get_l2_caches_count(void); @@ -1752,9 +1778,31 @@ uint32_t CPUINFO_ABI cpuinfo_get_l4_caches_count(void); */ uint32_t CPUINFO_ABI cpuinfo_get_max_cache_size(void); +/** + * Identify the logical processor that executes the current thread. + * + * There is no guarantee that the thread will stay on the same logical processor for any time. + * Callers should treat the result as only a hint, and be prepared to handle NULL return value. + */ const struct cpuinfo_processor* CPUINFO_ABI cpuinfo_get_current_processor(void); + +/** + * Identify the core that executes the current thread. + * + * There is no guarantee that the thread will stay on the same core for any time. + * Callers should treat the result as only a hint, and be prepared to handle NULL return value. + */ const struct cpuinfo_core* CPUINFO_ABI cpuinfo_get_current_core(void); +/** + * Identify the microarchitecture index of the core that executes the current thread. + * If the system does not support such identification, the function return 0. + * + * There is no guarantee that the thread will stay on the same type of core for any time. + * Callers should treat the result as only a hint. + */ +uint32_t CPUINFO_ABI cpuinfo_get_current_uarch_index(void); + #ifdef __cplusplus } /* extern "C" */ #endif |