From 312e990c6f86f5da0c83a5ffd5aae405947c6549 Mon Sep 17 00:00:00 2001 From: Mykola Hohsadze Date: Thu, 14 Sep 2023 11:22:16 +0300 Subject: [PATCH] Add Intel AMX-FP16 detection (#332) --- include/cpuinfo_x86.h | 2 ++ src/impl_x86__base_implementation.inl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/cpuinfo_x86.h b/include/cpuinfo_x86.h index 6f24e4b..796d3f3 100644 --- a/include/cpuinfo_x86.h +++ b/include/cpuinfo_x86.h @@ -86,6 +86,7 @@ typedef struct { int amx_bf16 : 1; int amx_tile : 1; int amx_int8 : 1; + int amx_fp16 : 1; int pclmulqdq : 1; int smx : 1; @@ -254,6 +255,7 @@ typedef enum { X86_AMX_BF16, X86_AMX_TILE, X86_AMX_INT8, + X86_AMX_FP16, X86_PCLMULQDQ, X86_SMX, X86_SGX, diff --git a/src/impl_x86__base_implementation.inl b/src/impl_x86__base_implementation.inl index 11b2246..dfff46c 100644 --- a/src/impl_x86__base_implementation.inl +++ b/src/impl_x86__base_implementation.inl @@ -450,6 +450,7 @@ static void ParseCpuId(const Leaves* leaves, X86Info* info, features->amx_bf16 = IsBitSet(leaf_7.edx, 22); features->amx_tile = IsBitSet(leaf_7.edx, 24); features->amx_int8 = IsBitSet(leaf_7.edx, 25); + features->amx_fp16 = IsBitSet(leaf_7_1.eax, 21); } } else { // When XCR0 is not available (Atom based or older cpus) we need to defer to @@ -1976,6 +1977,7 @@ CacheInfo GetX86CacheInfo(void) { LINE(X86_AMX_BF16, amx_bf16, , , ) \ LINE(X86_AMX_TILE, amx_tile, , , ) \ LINE(X86_AMX_INT8, amx_int8, , , ) \ + LINE(X86_AMX_FP16, amx_fp16, , , ) \ LINE(X86_PCLMULQDQ, pclmulqdq, , , ) \ LINE(X86_SMX, smx, , , ) \ LINE(X86_SGX, sgx, , , ) \