[v1.02][ARM] Updating M1/M2 peak performance calculations according to the discussion in #155

This commit is contained in:
Dr-Noob
2022-09-14 11:07:26 +02:00
parent 61a1ad8a2b
commit 9f7204d43d

View File

@@ -81,12 +81,23 @@ int64_t get_peak_performance(struct cpuInfo* cpu) {
}
int64_t flops = 0;
ptr = cpu;
if(cpu->cpu_vendor == SOC_VENDOR_APPLE) {
// Special case for M1/M2
// First we find the E cores, then the P
// M1 have 2 (E cores) or 4 (P cores) FMA units
// Source: https://dougallj.github.io/applecpu/firestorm-simd.html
flops += ptr->topo->total_cores * (get_freq(ptr->freq) * 1000000) * 2 * 4 * 2;
ptr = ptr->next_cpu;
flops += ptr->topo->total_cores * (get_freq(ptr->freq) * 1000000) * 2 * 4 * 4;
}
else {
for(int i=0; i < cpu->num_cpus; ptr = ptr->next_cpu, i++) {
flops += ptr->topo->total_cores * (get_freq(ptr->freq) * 1000000);
}
if(cpu->feat->NEON) flops = flops * 4;
}
return flops;
}