aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2023-10-04 08:59:55 -0700
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-10-04 16:31:36 +0000
commit709d60e6eec7938a95102a5cb1d0812e35606487 (patch)
tree17371de230532c29174d8fac92b203498dfc2e40
parenta3b9c36eb96ee815c938716d7e9703604938f904 (diff)
downloadlibyuv-709d60e6eec7938a95102a5cb1d0812e35606487.tar.gz
VNNI-INT8 detect
- Add kCpuHasAVXVNNIINT8 flag - Move mips flags up a bit to make space. ~/intelsde/sde -srf -- blaze-bin/third_party/libyuv/libyuv_test --gunit_filter=*CpuHas Note: Google Test filter = *CpuHas [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from LibYUVBaseTest [ RUN ] LibYUVBaseTest.TestCpuHas Cpu Flags 0x403ff1 Has X86 0x10 Has SSE2 0x20 Has SSSE3 0x40 Has SSE41 0x80 Has SSE42 0x100 Has AVX 0x200 Has AVX2 0x400 Has ERMS 0x800 Has FMA3 0x1000 Has F16C 0x2000 Has AVX512BW 0x0 Has AVX512VL 0x0 Has AVX512VNNI 0x0 Has AVX512VBMI 0x0 Has AVX512VBMI2 0x0 Has AVX512VBITALG 0x0 Has AVX512VPOPCNTDQ 0x0 Has AVXVNNIINT8 0x400000 Has GFNI 0x0 [ OK ] LibYUVBaseTest.TestCpuHas (32 ms) INT8 supported on srf and grr -srf Set chip-check and CPUID for Intel(R) Sierra Forest CPU -grr Set chip-check and CPUID for Intel(R) Grand Ridge CPU Bug: b/303434603 Change-Id: I628007929ff0518b2b36e1469b4d9aed71a9fa8f Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4912015 Reviewed-by: richard winterton <rrwinterton@gmail.com> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
-rw-r--r--README.chromium2
-rw-r--r--include/libyuv/cpu_id.h7
-rw-r--r--include/libyuv/version.h2
-rw-r--r--source/cpu_id.cc5
-rw-r--r--unit_test/cpu_test.cc6
-rw-r--r--unit_test/unit_test.cc3
-rw-r--r--util/cpuid.c6
7 files changed, 21 insertions, 10 deletions
diff --git a/README.chromium b/README.chromium
index c68be174..8fac3d14 100644
--- a/README.chromium
+++ b/README.chromium
@@ -1,6 +1,6 @@
Name: libyuv
URL: https://chromium.googlesource.com/libyuv/libyuv/
-Version: 1875
+Version: 1877
License: BSD
License File: LICENSE
Shipped: yes
diff --git a/include/libyuv/cpu_id.h b/include/libyuv/cpu_id.h
index 203f7e0d..1f2f376a 100644
--- a/include/libyuv/cpu_id.h
+++ b/include/libyuv/cpu_id.h
@@ -37,7 +37,7 @@ static const int kCpuHasAVX2 = 0x400;
static const int kCpuHasERMS = 0x800;
static const int kCpuHasFMA3 = 0x1000;
static const int kCpuHasF16C = 0x2000;
-static const int kCpuHasGFNI = 0x4000;
+static const int kCpuHasGFNI = 0x4000; /* deprecated */
static const int kCpuHasAVX512BW = 0x8000;
static const int kCpuHasAVX512VL = 0x10000;
static const int kCpuHasAVX512VNNI = 0x20000;
@@ -45,10 +45,11 @@ static const int kCpuHasAVX512VBMI = 0x40000;
static const int kCpuHasAVX512VBMI2 = 0x80000;
static const int kCpuHasAVX512VBITALG = 0x100000;
static const int kCpuHasAVX512VPOPCNTDQ = 0x200000;
+static const int kCpuHasAVXVNNIINT8 = 0x400000;
// These flags are only valid on MIPS processors.
-static const int kCpuHasMIPS = 0x400000;
-static const int kCpuHasMSA = 0x800000;
+static const int kCpuHasMIPS = 0x800000;
+static const int kCpuHasMSA = 0x1000000;
// These flags are only valid on LOONGARCH processors.
static const int kCpuHasLOONGARCH = 0x2000000;
diff --git a/include/libyuv/version.h b/include/libyuv/version.h
index d45ef09d..0112faf9 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 1875
+#define LIBYUV_VERSION 1877
#endif // INCLUDE_LIBYUV_VERSION_H_
diff --git a/source/cpu_id.cc b/source/cpu_id.cc
index 0c4a1581..af614180 100644
--- a/source/cpu_id.cc
+++ b/source/cpu_id.cc
@@ -292,10 +292,12 @@ static SAFEBUFFERS int GetCpuFlags(void) {
int cpu_info0[4] = {0, 0, 0, 0};
int cpu_info1[4] = {0, 0, 0, 0};
int cpu_info7[4] = {0, 0, 0, 0};
+ int cpu_einfo7[4] = {0, 0, 0, 0};
CpuId(0, 0, cpu_info0);
CpuId(1, 0, cpu_info1);
if (cpu_info0[0] >= 7) {
CpuId(7, 0, cpu_info7);
+ CpuId(7, 1, cpu_einfo7);
}
cpu_info = kCpuHasX86 | ((cpu_info1[3] & 0x04000000) ? kCpuHasSSE2 : 0) |
((cpu_info1[2] & 0x00000200) ? kCpuHasSSSE3 : 0) |
@@ -308,7 +310,8 @@ static SAFEBUFFERS int GetCpuFlags(void) {
((GetXCR0() & 6) == 6)) { // Test OS saves YMM registers
cpu_info |= kCpuHasAVX | ((cpu_info7[1] & 0x00000020) ? kCpuHasAVX2 : 0) |
((cpu_info1[2] & 0x00001000) ? kCpuHasFMA3 : 0) |
- ((cpu_info1[2] & 0x20000000) ? kCpuHasF16C : 0);
+ ((cpu_info1[2] & 0x20000000) ? kCpuHasF16C : 0) |
+ ((cpu_einfo7[3] & 0x00000010) ? kCpuHasAVXVNNIINT8 : 0);
// Detect AVX512bw
if ((GetXCR0() & 0xe0) == 0xe0) {
diff --git a/unit_test/cpu_test.cc b/unit_test/cpu_test.cc
index 431343e3..cdc321cf 100644
--- a/unit_test/cpu_test.cc
+++ b/unit_test/cpu_test.cc
@@ -47,7 +47,6 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
int has_erms = TestCpuFlag(kCpuHasERMS);
int has_fma3 = TestCpuFlag(kCpuHasFMA3);
int has_f16c = TestCpuFlag(kCpuHasF16C);
- int has_gfni = TestCpuFlag(kCpuHasGFNI);
int has_avx512bw = TestCpuFlag(kCpuHasAVX512BW);
int has_avx512vl = TestCpuFlag(kCpuHasAVX512VL);
int has_avx512vnni = TestCpuFlag(kCpuHasAVX512VNNI);
@@ -55,6 +54,8 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
int has_avx512vbmi2 = TestCpuFlag(kCpuHasAVX512VBMI2);
int has_avx512vbitalg = TestCpuFlag(kCpuHasAVX512VBITALG);
int has_avx512vpopcntdq = TestCpuFlag(kCpuHasAVX512VPOPCNTDQ);
+ int has_avxvnniint8 = TestCpuFlag(kCpuHasAVXVNNIINT8);
+ int has_gfni = TestCpuFlag(kCpuHasGFNI);
printf("Has X86 0x%x\n", has_x86);
printf("Has SSE2 0x%x\n", has_sse2);
printf("Has SSSE3 0x%x\n", has_ssse3);
@@ -65,7 +66,6 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
printf("Has ERMS 0x%x\n", has_erms);
printf("Has FMA3 0x%x\n", has_fma3);
printf("Has F16C 0x%x\n", has_f16c);
- printf("Has GFNI 0x%x\n", has_gfni);
printf("Has AVX512BW 0x%x\n", has_avx512bw);
printf("Has AVX512VL 0x%x\n", has_avx512vl);
printf("Has AVX512VNNI 0x%x\n", has_avx512vnni);
@@ -73,6 +73,8 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
printf("Has AVX512VBMI2 0x%x\n", has_avx512vbmi2);
printf("Has AVX512VBITALG 0x%x\n", has_avx512vbitalg);
printf("Has AVX512VPOPCNTDQ 0x%x\n", has_avx512vpopcntdq);
+ printf("Has AVXVNNIINT8 0x%x\n", has_avxvnniint8);
+ printf("Has GFNI 0x%x\n", has_gfni);
#endif
#if defined(__mips__)
int has_mips = TestCpuFlag(kCpuHasMIPS);
diff --git a/unit_test/unit_test.cc b/unit_test/unit_test.cc
index b66ebfab..9d543dee 100644
--- a/unit_test/unit_test.cc
+++ b/unit_test/unit_test.cc
@@ -147,6 +147,9 @@ int TestCpuEnv(int cpu_info) {
if (TestEnv("LIBYUV_DISABLE_AVX512VPOPCNTDQ")) {
cpu_info &= ~libyuv::kCpuHasAVX512VPOPCNTDQ;
}
+ if (TestEnv("LIBYUV_DISABLE_AVXVNNIINT8")) {
+ cpu_info &= ~libyuv::kCpuHasAVXVNNIINT8;
+ }
if (TestEnv("LIBYUV_DISABLE_GFNI")) {
cpu_info &= ~libyuv::kCpuHasGFNI;
}
diff --git a/util/cpuid.c b/util/cpuid.c
index edc6a26e..0ff7acc8 100644
--- a/util/cpuid.c
+++ b/util/cpuid.c
@@ -96,7 +96,6 @@ int main(int argc, const char* argv[]) {
int has_erms = TestCpuFlag(kCpuHasERMS);
int has_fma3 = TestCpuFlag(kCpuHasFMA3);
int has_f16c = TestCpuFlag(kCpuHasF16C);
- int has_gfni = TestCpuFlag(kCpuHasGFNI);
int has_avx512bw = TestCpuFlag(kCpuHasAVX512BW);
int has_avx512vl = TestCpuFlag(kCpuHasAVX512VL);
int has_avx512vnni = TestCpuFlag(kCpuHasAVX512VNNI);
@@ -104,6 +103,8 @@ int main(int argc, const char* argv[]) {
int has_avx512vbmi2 = TestCpuFlag(kCpuHasAVX512VBMI2);
int has_avx512vbitalg = TestCpuFlag(kCpuHasAVX512VBITALG);
int has_avx512vpopcntdq = TestCpuFlag(kCpuHasAVX512VPOPCNTDQ);
+ int has_avxvnniint8 = TestCpuFlag(kCpuHasAVXVNNIINT8);
+ int has_gfni = TestCpuFlag(kCpuHasGFNI);
printf("Has X86 0x%x\n", has_x86);
printf("Has SSE2 0x%x\n", has_sse2);
printf("Has SSSE3 0x%x\n", has_ssse3);
@@ -114,7 +115,6 @@ int main(int argc, const char* argv[]) {
printf("Has ERMS 0x%x\n", has_erms);
printf("Has FMA3 0x%x\n", has_fma3);
printf("Has F16C 0x%x\n", has_f16c);
- printf("Has GFNI 0x%x\n", has_gfni);
printf("Has AVX512BW 0x%x\n", has_avx512bw);
printf("Has AVX512VL 0x%x\n", has_avx512vl);
printf("Has AVX512VNNI 0x%x\n", has_avx512vnni);
@@ -122,6 +122,8 @@ int main(int argc, const char* argv[]) {
printf("Has AVX512VBMI2 0x%x\n", has_avx512vbmi2);
printf("Has AVX512VBITALG 0x%x\n", has_avx512vbitalg);
printf("Has AVX512VPOPCNTDQ 0x%x\n", has_avx512vpopcntdq);
+ printf("Has AVXVNNIINT8 0x%x\n", has_avxvnniint8);
+ printf("Has GFNI 0x%x\n", has_gfni);
}
return 0;
}