VNNI detect

Bug: libyuv:911
Change-Id: Ic4e7720b4d5c20010470f06a7021d1a2426e765f
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3381495
Reviewed-by: richard winterton <rrwinterton@gmail.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Frank Barchard 2022-01-11 14:49:18 -08:00 committed by libyuv LUCI CQ
parent b91df1a02e
commit cdd62da670
8 changed files with 19 additions and 9 deletions

View File

@ -1,6 +1,6 @@
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1807
Version: 1808
License: BSD
License File: LICENSE

View File

@ -22,6 +22,7 @@ By default the cpu is detected and the most advanced form of SIMD is used. But
LIBYUV_DISABLE_F16C
LIBYUV_DISABLE_AVX512BW
LIBYUV_DISABLE_AVX512VL
LIBYUV_DISABLE_AVX512VNNI
LIBYUV_DISABLE_AVX512VBMI
LIBYUV_DISABLE_AVX512VBMI2
LIBYUV_DISABLE_AVX512VBITALG

View File

@ -40,15 +40,16 @@ static const int kCpuHasF16C = 0x2000;
static const int kCpuHasGFNI = 0x4000;
static const int kCpuHasAVX512BW = 0x8000;
static const int kCpuHasAVX512VL = 0x10000;
static const int kCpuHasAVX512VBMI = 0x20000;
static const int kCpuHasAVX512VBMI2 = 0x40000;
static const int kCpuHasAVX512VBITALG = 0x80000;
static const int kCpuHasAVX512VPOPCNTDQ = 0x100000;
static const int kCpuHasAVX512VNNI = 0x20000;
static const int kCpuHasAVX512VBMI = 0x40000;
static const int kCpuHasAVX512VBMI2 = 0x80000;
static const int kCpuHasAVX512VBITALG = 0x100000;
static const int kCpuHasAVX512VPOPCNTDQ = 0x200000;
// These flags are only valid on MIPS processors.
static const int kCpuHasMIPS = 0x200000;
static const int kCpuHasMSA = 0x400000;
static const int kCpuHasMMI = 0x800000;
static const int kCpuHasMIPS = 0x400000;
static const int kCpuHasMSA = 0x800000;
static const int kCpuHasMMI = 0x1000000;
// Optional init function. TestCpuFlag does an auto-init.
// Returns cpu_info flags.

View File

@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1807
#define LIBYUV_VERSION 1808
#endif // INCLUDE_LIBYUV_VERSION_H_

View File

@ -229,6 +229,7 @@ static SAFEBUFFERS int GetCpuFlags(void) {
cpu_info |= (cpu_info7[1] & 0x80000000) ? kCpuHasAVX512VL : 0;
cpu_info |= (cpu_info7[2] & 0x00000002) ? kCpuHasAVX512VBMI : 0;
cpu_info |= (cpu_info7[2] & 0x00000040) ? kCpuHasAVX512VBMI2 : 0;
cpu_info |= (cpu_info7[2] & 0x00000800) ? kCpuHasAVX512VNNI : 0;
cpu_info |= (cpu_info7[2] & 0x00001000) ? kCpuHasAVX512VBITALG : 0;
cpu_info |= (cpu_info7[2] & 0x00004000) ? kCpuHasAVX512VPOPCNTDQ : 0;
cpu_info |= (cpu_info7[2] & 0x00000100) ? kCpuHasGFNI : 0;

View File

@ -40,6 +40,7 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
int has_gfni = TestCpuFlag(kCpuHasGFNI);
int has_avx512bw = TestCpuFlag(kCpuHasAVX512BW);
int has_avx512vl = TestCpuFlag(kCpuHasAVX512VL);
int has_avx512vnni = TestCpuFlag(kCpuHasAVX512VNNI);
int has_avx512vbmi = TestCpuFlag(kCpuHasAVX512VBMI);
int has_avx512vbmi2 = TestCpuFlag(kCpuHasAVX512VBMI2);
int has_avx512vbitalg = TestCpuFlag(kCpuHasAVX512VBITALG);
@ -57,6 +58,7 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
printf("Has GFNI %d\n", has_gfni);
printf("Has AVX512BW %d\n", has_avx512bw);
printf("Has AVX512VL %d\n", has_avx512vl);
printf("Has AVX512VNNI %d\n", has_avx512vnni);
printf("Has AVX512VBMI %d\n", has_avx512vbmi);
printf("Has AVX512VBMI2 %d\n", has_avx512vbmi2);
printf("Has AVX512VBITALG %d\n", has_avx512vbitalg);

View File

@ -120,6 +120,9 @@ int TestCpuEnv(int cpu_info) {
if (TestEnv("LIBYUV_DISABLE_AVX512VL")) {
cpu_info &= ~libyuv::kCpuHasAVX512VL;
}
if (TestEnv("LIBYUV_DISABLE_AVX512VNNI")) {
cpu_info &= ~libyuv::kCpuHasAVX512VNNI;
}
if (TestEnv("LIBYUV_DISABLE_AVX512VBMI")) {
cpu_info &= ~libyuv::kCpuHasAVX512VBMI;
}

View File

@ -88,6 +88,7 @@ int main(int argc, const char* argv[]) {
int has_gfni = TestCpuFlag(kCpuHasGFNI);
int has_avx512bw = TestCpuFlag(kCpuHasAVX512BW);
int has_avx512vl = TestCpuFlag(kCpuHasAVX512VL);
int has_avx512vnni = TestCpuFlag(kCpuHasAVX512VNNI);
int has_avx512vbmi = TestCpuFlag(kCpuHasAVX512VBMI);
int has_avx512vbmi2 = TestCpuFlag(kCpuHasAVX512VBMI2);
int has_avx512vbitalg = TestCpuFlag(kCpuHasAVX512VBITALG);
@ -104,6 +105,7 @@ int main(int argc, const char* argv[]) {
printf("Has GFNI %x\n", has_gfni);
printf("Has AVX512BW %x\n", has_avx512bw);
printf("Has AVX512VL %x\n", has_avx512vl);
printf("Has AVX512VNNI %x\n", has_avx512vnni);
printf("Has AVX512VBMI %x\n", has_avx512vbmi);
printf("Has AVX512VBMI2 %x\n", has_avx512vbmi2);
printf("Has AVX512VBITALG %x\n", has_avx512vbitalg);