aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/cpu_id.cpp
diff options
context:
space:
mode:
authoreivanov89 <eivanov89@ydb.tech>2024-08-26 22:18:55 +0300
committereivanov89 <eivanov89@ydb.tech>2024-08-26 22:30:33 +0300
commit3b9d4493cea2c6bc1906ce9871aef82f389984a6 (patch)
treee74631083a82b8858e5b6a675bf136dc297018af /util/system/cpu_id.cpp
parent3c4a6a8a3c937c9788a0fb983ac1ad28473065fc (diff)
downloadydb-3b9d4493cea2c6bc1906ce9871aef82f389984a6.tar.gz
KIKIMR-21908: fix a bug in CPUID/AVX512F call
f5e4678c0171915199008af5bb54f47adf0b34d4
Diffstat (limited to 'util/system/cpu_id.cpp')
-rw-r--r--util/system/cpu_id.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/util/system/cpu_id.cpp b/util/system/cpu_id.cpp
index 598c71f4d9..ad7299ddbc 100644
--- a/util/system/cpu_id.cpp
+++ b/util/system/cpu_id.cpp
@@ -169,11 +169,11 @@ bool NX86::HaveBMI2() noexcept {
bool NX86::HaveAVX512F() noexcept {
#if defined(_x86_)
// https://software.intel.com/en-us/articles/how-to-detect-knl-instruction-support
- return HaveOSXSAVE() // implies HaveXSAVE()
- && (_xgetbv(0) & 6u) == 6u // XMM state and YMM state are enabled by OS
- && ((_xgetbv(0) >> 5) & 7u) == 7u // ZMM state is enabled by OS
- && TX86CpuInfo(0x0).EAX >= 0x7 // leaf 7 is present
- && ((TX86CpuInfo(0x7).EBX >> 16) & 1u); // AVX512F bit
+ return HaveOSXSAVE() // implies HaveXSAVE()
+ && (_xgetbv(0) & 6u) == 6u // XMM state and YMM state are enabled by OS
+ && ((_xgetbv(0) >> 5) & 7u) == 7u // ZMM state is enabled by OS
+ && TX86CpuInfo(0x0).EAX >= 0x7 // leaf 7 is present
+ && ((TX86CpuInfo(0x7, 0).EBX >> 16) & 1u); // AVX512F bit
#else
return false;
#endif