diff options
author | Frank Barchard <fbarchard@google.com> | 2022-01-11 14:49:18 -0800 |
---|---|---|
committer | libyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-01-12 07:08:20 +0000 |
commit | cdd62da6703947d29f471d6d0a92d1b4f325df79 (patch) | |
tree | 467218fed30609d566f9be267855d6e7ccf63607 | |
parent | b91df1a02ea2737eddaa6c7e9bd5b6e58c527ea6 (diff) | |
download | libyuv-cdd62da6703947d29f471d6d0a92d1b4f325df79.tar.gz |
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>
-rw-r--r-- | README.chromium | 2 | ||||
-rw-r--r-- | docs/environment_variables.md | 1 | ||||
-rw-r--r-- | include/libyuv/cpu_id.h | 15 | ||||
-rw-r--r-- | include/libyuv/version.h | 2 | ||||
-rw-r--r-- | source/cpu_id.cc | 1 | ||||
-rw-r--r-- | unit_test/cpu_test.cc | 2 | ||||
-rw-r--r-- | unit_test/unit_test.cc | 3 | ||||
-rw-r--r-- | util/cpuid.c | 2 |
8 files changed, 19 insertions, 9 deletions
diff --git a/README.chromium b/README.chromium index 6c39cd21..f7d3a455 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1807 +Version: 1808 License: BSD License File: LICENSE diff --git a/docs/environment_variables.md b/docs/environment_variables.md index cd8159ad..614bc388 100644 --- a/docs/environment_variables.md +++ b/docs/environment_variables.md @@ -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 diff --git a/include/libyuv/cpu_id.h b/include/libyuv/cpu_id.h index 3e27cc10..943dde12 100644 --- a/include/libyuv/cpu_id.h +++ b/include/libyuv/cpu_id.h @@ -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. diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 7de6448e..422f7352 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -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_
\ No newline at end of file diff --git a/source/cpu_id.cc b/source/cpu_id.cc index 588168d6..25b91012 100644 --- a/source/cpu_id.cc +++ b/source/cpu_id.cc @@ -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; diff --git a/unit_test/cpu_test.cc b/unit_test/cpu_test.cc index e5285581..bf465716 100644 --- a/unit_test/cpu_test.cc +++ b/unit_test/cpu_test.cc @@ -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); diff --git a/unit_test/unit_test.cc b/unit_test/unit_test.cc index e6dbc3ee..6965f3e1 100644 --- a/unit_test/unit_test.cc +++ b/unit_test/unit_test.cc @@ -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; } diff --git a/util/cpuid.c b/util/cpuid.c index 46f9c1bf..048d42c8 100644 --- a/util/cpuid.c +++ b/util/cpuid.c @@ -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); |