github-actions[bot] commented on code in PR #25819: URL: https://github.com/apache/doris/pull/25819#discussion_r1369661579
########## be/src/gutil/cpu.cc: ########## @@ -200,6 +201,9 @@ void CPU::Initialize() { (xgetbv(0) & 6) == 6 /* XSAVE enabled by kernel */; has_aesni_ = (cpu_info[2] & 0x02000000) != 0; has_avx2_ = has_avx_ && (cpu_info7[1] & 0x00000020) != 0; + has_avx512_ = has_avx2_ && (xgetbv(0) & 0xe0) == 224 /*AVX-512 states are enabled*/ && Review Comment: warning: 0xe0 is a magic number; consider replacing it with a named constant [readability-magic-numbers] ```cpp has_avx512_ = has_avx2_ && (xgetbv(0) & 0xe0) == 224 /*AVX-512 states are enabled*/ && ^ ``` ########## be/src/gutil/cpu.cc: ########## @@ -200,6 +201,9 @@ void CPU::Initialize() { (xgetbv(0) & 6) == 6 /* XSAVE enabled by kernel */; has_aesni_ = (cpu_info[2] & 0x02000000) != 0; has_avx2_ = has_avx_ && (cpu_info7[1] & 0x00000020) != 0; + has_avx512_ = has_avx2_ && (xgetbv(0) & 0xe0) == 224 /*AVX-512 states are enabled*/ && + (cpu_info7[1] & 0x00010000) != 0 && (cpu_info7[1] & 0x40000000) != 0 && + (cpu_info7[1] & 0x80000000) != 0; Review Comment: warning: 0x80000000 is a magic number; consider replacing it with a named constant [readability-magic-numbers] ```cpp (cpu_info7[1] & 0x80000000) != 0; ^ ``` ########## be/src/gutil/cpu.cc: ########## @@ -200,6 +201,9 @@ void CPU::Initialize() { (xgetbv(0) & 6) == 6 /* XSAVE enabled by kernel */; has_aesni_ = (cpu_info[2] & 0x02000000) != 0; has_avx2_ = has_avx_ && (cpu_info7[1] & 0x00000020) != 0; + has_avx512_ = has_avx2_ && (xgetbv(0) & 0xe0) == 224 /*AVX-512 states are enabled*/ && Review Comment: warning: 224 is a magic number; consider replacing it with a named constant [readability-magic-numbers] ```cpp has_avx512_ = has_avx2_ && (xgetbv(0) & 0xe0) == 224 /*AVX-512 states are enabled*/ && ^ ``` ########## be/src/gutil/cpu.cc: ########## @@ -200,6 +201,9 @@ void CPU::Initialize() { (xgetbv(0) & 6) == 6 /* XSAVE enabled by kernel */; has_aesni_ = (cpu_info[2] & 0x02000000) != 0; has_avx2_ = has_avx_ && (cpu_info7[1] & 0x00000020) != 0; + has_avx512_ = has_avx2_ && (xgetbv(0) & 0xe0) == 224 /*AVX-512 states are enabled*/ && + (cpu_info7[1] & 0x00010000) != 0 && (cpu_info7[1] & 0x40000000) != 0 && Review Comment: warning: 0x40000000 is a magic number; consider replacing it with a named constant [readability-magic-numbers] ```cpp (cpu_info7[1] & 0x00010000) != 0 && (cpu_info7[1] & 0x40000000) != 0 && ^ ``` ########## be/src/gutil/cpu.cc: ########## @@ -200,6 +201,9 @@ void CPU::Initialize() { (xgetbv(0) & 6) == 6 /* XSAVE enabled by kernel */; has_aesni_ = (cpu_info[2] & 0x02000000) != 0; has_avx2_ = has_avx_ && (cpu_info7[1] & 0x00000020) != 0; + has_avx512_ = has_avx2_ && (xgetbv(0) & 0xe0) == 224 /*AVX-512 states are enabled*/ && + (cpu_info7[1] & 0x00010000) != 0 && (cpu_info7[1] & 0x40000000) != 0 && Review Comment: warning: 0x00010000 is a magic number; consider replacing it with a named constant [readability-magic-numbers] ```cpp (cpu_info7[1] & 0x00010000) != 0 && (cpu_info7[1] & 0x40000000) != 0 && ^ ``` ########## be/src/gutil/cpu.cc: ########## @@ -252,6 +256,7 @@ void CPU::Initialize() { #endif } CPU::IntelMicroArchitecture CPU::GetIntelMicroArchitecture() const { + if (has_avx512()) return AVX512; Review Comment: warning: statement should be inside braces [readability-braces-around-statements] ```suggestion if (has_avx512()) { return AVX512; } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org