From f1885896856f8211d9f9d4d07148c41e37a80002 Mon Sep 17 00:00:00 2001 From: Malcolm Jestadt Date: Thu, 6 Aug 2020 15:37:10 -0400 Subject: [PATCH] Utils: Add detection for Icelake-client tier AVX-512 - Implies support for everything that Skylake-X supports as well as AVX512IFMA, AVX512VBMI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, AVX512VPCLMULQDQ, AVX512GFNI, AVX512VAES --- Utilities/sysinfo.cpp | 21 ++++++++++++++++----- Utilities/sysinfo.h | 2 ++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Utilities/sysinfo.cpp b/Utilities/sysinfo.cpp index 485625d980..852f4d9e54 100755 --- a/Utilities/sysinfo.cpp +++ b/Utilities/sysinfo.cpp @@ -64,6 +64,13 @@ bool utils::has_avx512() return g_value; } +bool utils::has_avx512_icl() +{ + // Check AVX512IFMA, AVX512VBMI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, AVX512VPCLMULQDQ, AVX512GFNI, AVX512VAES (Icelake-client level support) + static const bool g_value = has_avx512() && (get_cpuid(7, 0)[1] & 0x00200000) == 0x00200000 && (get_cpuid(7, 0)[2] & 0x00005f42) == 0x00005f42; + return g_value; +} + bool utils::has_xop() { static const bool g_value = has_avx() && get_cpuid(0x80000001, 0)[2] & 0x800; @@ -145,12 +152,16 @@ std::string utils::get_system_info() { result += " | AVX"; - if (has_avx2()) - { - result += '+'; - } - if (has_avx512()) + { + result += "-512"; + + if (has_avx512_icl()) + { + result += '+'; + } + } + else if (has_avx2()) { result += '+'; } diff --git a/Utilities/sysinfo.h b/Utilities/sysinfo.h index eeef740303..c202fb2264 100755 --- a/Utilities/sysinfo.h +++ b/Utilities/sysinfo.h @@ -43,6 +43,8 @@ namespace utils bool has_avx512(); + bool has_avx512_icl(); + bool has_xop(); bool has_clwb();