Add AMXINT8 cpu detect

sde -spr -- libyuv_test -- --gunit_filter=*Cpu*
Note: Google Test filter = *Cpu*
[==========] Running 4 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 3 tests from LibYUVBaseTest
[ RUN      ] LibYUVBaseTest.TestCpuHas
Cpu Flags 0x57fff9
Has X86 0x8
Has SSE2 0x10
Has SSSE3 0x20
Has SSE41 0x40
Has SSE42 0x80
Has AVX 0x100
Has AVX2 0x200
Has ERMS 0x400
Has FMA3 0x800
Has F16C 0x1000
Has AVX512BW 0x2000
Has AVX512VL 0x4000
Has AVX512VNNI 0x8000
Has AVX512VBMI 0x10000
Has AVX512VBMI2 0x20000
Has AVX512VBITALG 0x40000
Has AVX10 0x0
HAS AVXVNNI 0x100000
Has AVXVNNIINT8 0x0
Has AMXINT8 0x400000
[       OK ] LibYUVBaseTest.TestCpuHas (34 ms)

Bug: b/324356616
Change-Id: I5129b8946363a501bdd570e6dba3936c54aacd6c
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5283433
Reviewed-by: richard winterton <rrwinterton@gmail.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Frank Barchard 2024-02-12 11:11:06 -08:00 committed by libyuv LUCI CQ
parent 2f2c04c157
commit a6a2ec654b
9 changed files with 35 additions and 26 deletions

View File

@ -1,6 +1,6 @@
Name: libyuv
URL: https://chromium.googlesource.com/libyuv/libyuv/
Version: 1886
Version: 1887
License: BSD
License File: LICENSE
Shipped: yes

View File

@ -26,8 +26,10 @@ By default the cpu is detected and the most advanced form of SIMD is used. But
LIBYUV_DISABLE_AVX512VBMI
LIBYUV_DISABLE_AVX512VBMI2
LIBYUV_DISABLE_AVX512VBITALG
LIBYUV_DISABLE_AVX512VPOPCNTDQ
LIBYUV_DISABLE_GFNI
LIBYUV_DISABLE_AVX10
LIBYUV_DISABLE_AVXVNNI
LIBYUV_DISABLE_AVXVNNIINT8
LIBYUV_DISABLE_AMXINT8
## ARM CPUs

View File

@ -24,28 +24,28 @@ static const int kCpuInitialized = 0x1;
// These flags are only valid on ARM processors.
static const int kCpuHasARM = 0x2;
static const int kCpuHasNEON = 0x4;
// 0x8 reserved for future ARM flag.
// These flags are only valid on x86 processors.
static const int kCpuHasX86 = 0x10;
static const int kCpuHasSSE2 = 0x20;
static const int kCpuHasSSSE3 = 0x40;
static const int kCpuHasSSE41 = 0x80;
static const int kCpuHasSSE42 = 0x100;
static const int kCpuHasAVX = 0x200;
static const int kCpuHasAVX2 = 0x400;
static const int kCpuHasERMS = 0x800;
static const int kCpuHasFMA3 = 0x1000;
static const int kCpuHasF16C = 0x2000;
static const int kCpuHasAVX512BW = 0x4000;
static const int kCpuHasAVX512VL = 0x8000;
static const int kCpuHasAVX512VNNI = 0x10000;
static const int kCpuHasAVX512VBMI = 0x20000;
static const int kCpuHasAVX512VBMI2 = 0x40000;
static const int kCpuHasAVX512VBITALG = 0x80000;
static const int kCpuHasAVX10 = 0x100000;
static const int kCpuHasAVXVNNI = 0x200000;
static const int kCpuHasAVXVNNIINT8 = 0x400000;
static const int kCpuHasX86 = 0x8;
static const int kCpuHasSSE2 = 0x10;
static const int kCpuHasSSSE3 = 0x20;
static const int kCpuHasSSE41 = 0x40;
static const int kCpuHasSSE42 = 0x80;
static const int kCpuHasAVX = 0x100;
static const int kCpuHasAVX2 = 0x200;
static const int kCpuHasERMS = 0x400;
static const int kCpuHasFMA3 = 0x800;
static const int kCpuHasF16C = 0x1000;
static const int kCpuHasAVX512BW = 0x2000;
static const int kCpuHasAVX512VL = 0x4000;
static const int kCpuHasAVX512VNNI = 0x8000;
static const int kCpuHasAVX512VBMI = 0x10000;
static const int kCpuHasAVX512VBMI2 = 0x20000;
static const int kCpuHasAVX512VBITALG = 0x40000;
static const int kCpuHasAVX10 = 0x80000;
static const int kCpuHasAVXVNNI = 0x100000;
static const int kCpuHasAVXVNNIINT8 = 0x200000;
static const int kCpuHasAMXINT8 = 0x400000;
// These flags are only valid on MIPS processors.
static const int kCpuHasMIPS = 0x800000;

View File

@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1886
#define LIBYUV_VERSION 1887
#endif // INCLUDE_LIBYUV_VERSION_H_

View File

@ -323,6 +323,7 @@ static SAFEBUFFERS int GetCpuFlags(void) {
cpu_info |= (cpu_info7[2] & 0x00000800) ? kCpuHasAVX512VNNI : 0;
cpu_info |= (cpu_info7[2] & 0x00001000) ? kCpuHasAVX512VBITALG : 0;
cpu_info |= (cpu_einfo7[3] & 0x00080000) ? kCpuHasAVX10 : 0;
cpu_info |= (cpu_info7[3] & 0x02000000) ? kCpuHasAMXINT8 : 0;
}
}
#endif

View File

@ -13,8 +13,7 @@
#ifdef HAVE_JPEG
#include <assert.h>
#if !defined(__pnacl__) && !defined(__CLR_VER) && \
!defined(COVERAGE_ENABLED)
#if !defined(__pnacl__) && !defined(__CLR_VER) && !defined(COVERAGE_ENABLED)
// Must be included before jpeglib.
#include <setjmp.h>
#define HAVE_SETJMP

View File

@ -56,6 +56,7 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
int has_avx10 = TestCpuFlag(kCpuHasAVX10);
int has_avxvnni = TestCpuFlag(kCpuHasAVXVNNI);
int has_avxvnniint8 = TestCpuFlag(kCpuHasAVXVNNIINT8);
int has_amxint8 = TestCpuFlag(kCpuHasAMXINT8);
printf("Has X86 0x%x\n", has_x86);
printf("Has SSE2 0x%x\n", has_sse2);
printf("Has SSSE3 0x%x\n", has_ssse3);
@ -75,6 +76,7 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
printf("Has AVX10 0x%x\n", has_avx10);
printf("HAS AVXVNNI 0x%x\n", has_avxvnni);
printf("Has AVXVNNIINT8 0x%x\n", has_avxvnniint8);
printf("Has AMXINT8 0x%x\n", has_amxint8);
#endif
#if defined(__mips__)
int has_mips = TestCpuFlag(kCpuHasMIPS);

View File

@ -153,6 +153,9 @@ int TestCpuEnv(int cpu_info) {
if (TestEnv("LIBYUV_DISABLE_AVXVNNIINT8")) {
cpu_info &= ~libyuv::kCpuHasAVXVNNIINT8;
}
if (TestEnv("LIBYUV_DISABLE_AMXINT8")) {
cpu_info &= ~libyuv::kCpuHasAMXINT8;
}
#endif
if (TestEnv("LIBYUV_DISABLE_ASM")) {
cpu_info = libyuv::kCpuInitialized;

View File

@ -134,6 +134,7 @@ int main(int argc, const char* argv[]) {
int has_avx10 = TestCpuFlag(kCpuHasAVX10);
int has_avxvnni = TestCpuFlag(kCpuHasAVXVNNI);
int has_avxvnniint8 = TestCpuFlag(kCpuHasAVXVNNIINT8);
int has_amxint8 = TestCpuFlag(kCpuHasAMXINT8);
printf("Has X86 0x%x\n", has_x86);
printf("Has SSE2 0x%x\n", has_sse2);
printf("Has SSSE3 0x%x\n", has_ssse3);
@ -153,6 +154,7 @@ int main(int argc, const char* argv[]) {
printf("Has AVX10 0x%x\n", has_avx10);
printf("HAS AVXVNNI 0x%x\n", has_avxvnni);
printf("Has AVXVNNIINT8 0x%x\n", has_avxvnniint8);
printf("Has AMXINT8 0x%x\n", has_amxint8);
}
return 0;
}