From ab1416563ca3c08af2e671c1f854959eb7265e6c Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Mon, 31 Aug 2020 18:27:32 +0200 Subject: [PATCH] Fix PP in Ice Lake --- src/cpuid.c | 5 ++++- src/main.c | 2 +- src/uarch.c | 4 ++++ src/uarch.h | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cpuid.c b/src/cpuid.c index 428a219..f7181a5 100644 --- a/src/cpuid.c +++ b/src/cpuid.c @@ -638,7 +638,10 @@ char* get_str_peak_performance(struct cpuInfo* cpu, struct topology* topo, int64 if(cpu->FMA3 || cpu->FMA4) flops = flops*2; - if(cpu->AVX512) + // Ice Lake has AVX512, but it has 1 VPU for AVX512, while + // it has 2 for AVX2. If this is a Ice Lake CPU, we are computing + // the peak performance supposing AVX2, not AVX512 + if(cpu->AVX512 && vpus_are_AVX512(cpu)) flops = flops*16; else if(cpu->AVX || cpu->AVX2) flops = flops*8; diff --git a/src/main.c b/src/main.c index 8d8ec6a..7be112f 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ #include "cpuid.h" #include "global.h" -static const char* VERSION = "0.62"; +static const char* VERSION = "0.63"; void print_help(char *argv[]) { printf("Usage: %s [--version] [--help] [--levels] [--style fancy|retro|legacy] [--color 'R,G,B:R,G,B:R,G,B:R,G,B']\n\ diff --git a/src/uarch.c b/src/uarch.c index 1923f97..e92b5d1 100644 --- a/src/uarch.c +++ b/src/uarch.c @@ -346,6 +346,10 @@ struct uarch* get_uarch_from_cpuid(struct cpuInfo* cpu, uint32_t ef, uint32_t f, return get_uarch_from_cpuid_amd(ef, f, em, m, s); } +bool vpus_are_AVX512(struct cpuInfo* cpu) { + return cpu->arch->uarch != UARCH_ICE_LAKE; +} + int get_number_of_vpus(struct cpuInfo* cpu) { if(cpu->cpu_vendor == VENDOR_AMD) return 1; diff --git a/src/uarch.h b/src/uarch.h index 6f40862..6258399 100644 --- a/src/uarch.h +++ b/src/uarch.h @@ -8,6 +8,7 @@ struct uarch; struct uarch* get_uarch_from_cpuid(struct cpuInfo* cpu, uint32_t ef, uint32_t f, uint32_t em, uint32_t m, int s); +bool vpus_are_AVX512(struct cpuInfo* cpu); int get_number_of_vpus(struct cpuInfo* cpu); #endif