From df78d39504e09d47ad332856c8268827ed7e06bc Mon Sep 17 00:00:00 2001 From: "richard.winterton" Date: Mon, 9 Dec 2024 18:01:11 -0700 Subject: [PATCH 1/5] Added changes to cpuinfo.h, isa.c and isa-info.c detect AVX10.1 ISA --- include/cpuinfo.h | 9 +++++++++ src/x86/isa.c | 5 +++++ tools/isa-info.c | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/include/cpuinfo.h b/include/cpuinfo.h index 9ed5d924..6eb4b8c3 100644 --- a/include/cpuinfo.h +++ b/include/cpuinfo.h @@ -820,6 +820,7 @@ struct cpuinfo_x86_isa { bool avx512vp2intersect; bool avx512_4vnniw; bool avx512_4fmaps; + bool avx10_1; bool amx_bf16; bool amx_tile; bool amx_int8; @@ -1435,6 +1436,14 @@ static inline bool cpuinfo_has_x86_avx_ne_convert(void) { #endif } +static inline bool cpuinfo_has_x86_avx10_1(void) { +#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64 + return cpuinfo_isa.avx10_1; +#else + return false; +#endif +} + static inline bool cpuinfo_has_x86_hle(void) { #if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64 return cpuinfo_isa.hle; diff --git a/src/x86/isa.c b/src/x86/isa.c index bfd5e776..10da3dc3 100644 --- a/src/x86/isa.c +++ b/src/x86/isa.c @@ -429,6 +429,11 @@ struct cpuinfo_x86_isa cpuinfo_x86_detect_isa( */ isa.avx512f = avx512_regs && !!(structured_feature_info0.ebx & UINT32_C(0x00010000)); + /* + * AVX 10.1 instructions: + */ + isa.avx10_1 = (structured_feature_info1.edx & UINT32_C(1 << 19)); + /* * AVX512PF instructions: * - Intel: ebx[bit 26] in structured feature info (ecx = 0). diff --git a/tools/isa-info.c b/tools/isa-info.c index 2c40a5ec..afb82a0e 100644 --- a/tools/isa-info.c +++ b/tools/isa-info.c @@ -70,6 +70,10 @@ int main(int argc, char** argv) { printf("\tAVX512VP2INTERSECT: %s\n", cpuinfo_has_x86_avx512vp2intersect() ? "yes" : "no"); printf("\tAVX512_4VNNIW: %s\n", cpuinfo_has_x86_avx512_4vnniw() ? "yes" : "no"); printf("\tAVX512_4FMAPS: %s\n", cpuinfo_has_x86_avx512_4fmaps() ? "yes" : "no"); + + //avx10.1 (in future will add other avx10 version) + printf("\tAVX10_1: %s\n", cpuinfo_has_x86_avx10_1() ? "yes" : "no"); + printf("\tAMX_BF16: %s\n", cpuinfo_has_x86_amx_bf16() ? "yes" : "no"); printf("\tAMX_TILE: %s\n", cpuinfo_has_x86_amx_tile() ? "yes" : "no"); printf("\tAMX_INT8: %s\n", cpuinfo_has_x86_amx_int8() ? "yes" : "no"); From 7215904fd2a29f6771af6b6e81822641fff3ded2 Mon Sep 17 00:00:00 2001 From: "richard.winterton" Date: Wed, 11 Dec 2024 18:19:28 -0700 Subject: [PATCH 2/5] added check for avx512_regs and hex representation change per request --- src/x86/isa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/x86/isa.c b/src/x86/isa.c index 10da3dc3..0a10be74 100644 --- a/src/x86/isa.c +++ b/src/x86/isa.c @@ -432,7 +432,7 @@ struct cpuinfo_x86_isa cpuinfo_x86_detect_isa( /* * AVX 10.1 instructions: */ - isa.avx10_1 = (structured_feature_info1.edx & UINT32_C(1 << 19)); + isa.avx10_1 = avx512_regs && !!(structured_feature_info1.edx & UINT32_C(0x00080000)); /* * AVX512PF instructions: From 9f62392cc7ac476c73b5f25a28d7c3deb029b5ab Mon Sep 17 00:00:00 2001 From: rrwinterton Date: Tue, 7 Jan 2025 16:06:55 -0700 Subject: [PATCH 3/5] change spaces to tab and fix int to bool for RISC. --- src/x86/isa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/x86/isa.c b/src/x86/isa.c index 0a10be74..ee65f83e 100644 --- a/src/x86/isa.c +++ b/src/x86/isa.c @@ -429,10 +429,10 @@ struct cpuinfo_x86_isa cpuinfo_x86_detect_isa( */ isa.avx512f = avx512_regs && !!(structured_feature_info0.ebx & UINT32_C(0x00010000)); - /* + /* * AVX 10.1 instructions: */ - isa.avx10_1 = avx512_regs && !!(structured_feature_info1.edx & UINT32_C(0x00080000)); + isa.avx10_1 = avx512_regs && !!(structured_feature_info1.edx & UINT32_C(0x00080000)); /* * AVX512PF instructions: From a404fffd832205b1b0b087947bd50270da75b846 Mon Sep 17 00:00:00 2001 From: Nikita Shulga <2453524+malfet@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:39:28 -0800 Subject: [PATCH 4/5] Update tools/isa-info.c --- tools/isa-info.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/isa-info.c b/tools/isa-info.c index afb82a0e..96bcdd7a 100644 --- a/tools/isa-info.c +++ b/tools/isa-info.c @@ -70,10 +70,7 @@ int main(int argc, char** argv) { printf("\tAVX512VP2INTERSECT: %s\n", cpuinfo_has_x86_avx512vp2intersect() ? "yes" : "no"); printf("\tAVX512_4VNNIW: %s\n", cpuinfo_has_x86_avx512_4vnniw() ? "yes" : "no"); printf("\tAVX512_4FMAPS: %s\n", cpuinfo_has_x86_avx512_4fmaps() ? "yes" : "no"); - - //avx10.1 (in future will add other avx10 version) printf("\tAVX10_1: %s\n", cpuinfo_has_x86_avx10_1() ? "yes" : "no"); - printf("\tAMX_BF16: %s\n", cpuinfo_has_x86_amx_bf16() ? "yes" : "no"); printf("\tAMX_TILE: %s\n", cpuinfo_has_x86_amx_tile() ? "yes" : "no"); printf("\tAMX_INT8: %s\n", cpuinfo_has_x86_amx_int8() ? "yes" : "no"); From 4786c8af141d0e889d4dad7c969ac58366dc61ef Mon Sep 17 00:00:00 2001 From: Nikita Shulga <2453524+malfet@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:45:17 -0800 Subject: [PATCH 5/5] Update src/x86/isa.c --- src/x86/isa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/x86/isa.c b/src/x86/isa.c index ee65f83e..47a6afa3 100644 --- a/src/x86/isa.c +++ b/src/x86/isa.c @@ -433,7 +433,7 @@ struct cpuinfo_x86_isa cpuinfo_x86_detect_isa( * AVX 10.1 instructions: */ isa.avx10_1 = avx512_regs && !!(structured_feature_info1.edx & UINT32_C(0x00080000)); - + /* * AVX512PF instructions: * - Intel: ebx[bit 26] in structured feature info (ecx = 0).