Skip to content

Commit 6481e8b

Browse files
committed
Detect AVX512-FP16 extension
1 parent 5fd22ca commit 6481e8b

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

include/cpuinfo.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ void CPUINFO_ABI cpuinfo_deinitialize(void);
740740
bool avx512vpopcntdq;
741741
bool avx512vnni;
742742
bool avx512bf16;
743+
bool avx512fp16;
743744
bool avx512vp2intersect;
744745
bool avx512_4vnniw;
745746
bool avx512_4fmaps;
@@ -1219,6 +1220,14 @@ static inline bool cpuinfo_has_x86_avx512bf16(void) {
12191220
#endif
12201221
}
12211222

1223+
static inline bool cpuinfo_has_x86_avx512fp16(void) {
1224+
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
1225+
return cpuinfo_isa.avx512fp16;
1226+
#else
1227+
return false;
1228+
#endif
1229+
}
1230+
12221231
static inline bool cpuinfo_has_x86_avx512vp2intersect(void) {
12231232
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
12241233
return cpuinfo_isa.avx512vp2intersect;

src/x86/isa.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,12 @@ struct cpuinfo_x86_isa cpuinfo_x86_detect_isa(
490490
*/
491491
isa.avx512vp2intersect = avx512_regs && !!(structured_feature_info0.edx & UINT32_C(0x00000100));
492492

493+
/*
494+
* AVX512_FP16 instructions:
495+
* - Intel: edx[bit 23] in structured feature info (ecx = 0).
496+
*/
497+
isa.avx512fp16 = avx512_regs && !!(structured_feature_info0.edx & UINT32_C(0x00800000));
498+
493499
/*
494500
* AVX512_BF16 instructions:
495501
* - Intel: eax[bit 5] in structured feature info (ecx = 1).

tools/isa-info.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ int main(int argc, char** argv) {
6868
printf("\tAVX512VPOPCNTDQ: %s\n", cpuinfo_has_x86_avx512vpopcntdq() ? "yes" : "no");
6969
printf("\tAVX512VNNI: %s\n", cpuinfo_has_x86_avx512vnni() ? "yes" : "no");
7070
printf("\tAVX512BF16: %s\n", cpuinfo_has_x86_avx512bf16() ? "yes" : "no");
71+
printf("\tAVX512FP16: %s\n", cpuinfo_has_x86_avx512fp16() ? "yes" : "no");
7172
printf("\tAVX512VP2INTERSECT: %s\n", cpuinfo_has_x86_avx512vp2intersect() ? "yes" : "no");
7273
printf("\tAVX512_4VNNIW: %s\n", cpuinfo_has_x86_avx512_4vnniw() ? "yes" : "no");
7374
printf("\tAVX512_4FMAPS: %s\n", cpuinfo_has_x86_avx512_4fmaps() ? "yes" : "no");

0 commit comments

Comments
 (0)