diff options
author | Marat Dukhan <marat@fb.com> | 2018-12-26 20:20:23 -0800 |
---|---|---|
committer | Marat Dukhan <marat@fb.com> | 2018-12-26 20:20:23 -0800 |
commit | c82f5e3d28f0e617b232c34173f0a07ef95e2b04 (patch) | |
tree | 00cf07c640c8acb1429cbe90369c1c24ce6d3fce | |
parent | 44dafc5adce7edc8770d41414bbe1a73f52e7e45 (diff) | |
download | cpuinfo-c82f5e3d28f0e617b232c34173f0a07ef95e2b04.tar.gz |
Detect ARMv8.1 Atomics and FP16 compute on iOS
-rw-r--r-- | src/arm/mach/init.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/arm/mach/init.c b/src/arm/mach/init.c index 3cca223..91d0353 100644 --- a/src/arm/mach/init.c +++ b/src/arm/mach/init.c @@ -316,6 +316,25 @@ void cpuinfo_arm_mach_init(void) { break; #endif } + /* + * Support for ARMv8.1 Atomics & FP16 arithmetic instructions is supposed to be detected via + * sysctlbyname calls with "hw.optional.armv8_1_atomics" and "hw.optional.neon_fp16" arguments + * (see https://devstreaming-cdn.apple.com/videos/wwdc/2018/409t8zw7rumablsh/409/409_whats_new_in_llvm.pdf), + * but on new iOS versions these calls just fail with EPERM. + * + * Thus, we whitelist CPUs known to support these instructions. + */ + switch (cpu_family) { + case CPUFAMILY_ARM_MONSOON_MISTRAL: +#ifdef CPUFAMILY_ARM_VORTEX_TEMPEST + case CPUFAMILY_ARM_VORTEX_TEMPEST: +#else + case 0xe81e7ef6: + /* Hard-coded value for older SDKs which do not define CPUFAMILY_ARM_VORTEX_TEMPEST */ +#endif + cpuinfo_isa.atomics = true; + cpuinfo_isa.fp16arith = true; + } uint32_t num_clusters = 1; for (uint32_t i = 0; i < mach_topology.cores; i++) { |