Skip to content

Commit

Permalink
Enable AMX using pytorch/cpuinfo cpuinfo_has_x86_amx_int8()
Browse files Browse the repository at this point in the history
- Updated pytorch/cpuinfo adds AMX detect.
- Remove fp16 hack that inferred AMX from having fp16

PiperOrigin-RevId: 641751226
  • Loading branch information
fbarchard authored and xnnpack-bot committed Jun 10, 2024
1 parent ebfa0da commit bb1650b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/configs/hardware-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ static void init_hardware_config(void) {
hardware_config.use_x86_avx512vnni = hardware_config.use_x86_avx512skx && cpuinfo_has_x86_avx512vnni();
hardware_config.use_x86_avx512vnnigfni = hardware_config.use_x86_avx512vnni && cpuinfo_has_x86_gfni();
#if XNN_ENABLE_AVX512FP16
hardware_config.use_x86_avx512fp16 = hardware_config.use_x86_avx512vnnigfni && cpuinfo_has_x86_avx512fp16();
hardware_config.use_x86_avx512fp16 = cpuinfo_has_x86_avx512fp16();
#else
hardware_config.use_x86_avx512fp16 = 0;
#endif
#if XNN_ENABLE_AVX512AMX
// TODO(fbarchard): Use cpuinfo_has_x86_amx_int8 when available.
// Infer AMX support from Sapphire Rapids having fp16 and amx.
hardware_config.use_x86_avx512amx = hardware_config.use_x86_avx512vnnigfni && cpuinfo_has_x86_avx512fp16();
hardware_config.use_x86_avx512amx = hardware_config.use_x86_avx512vnnigfni && cpuinfo_has_x86_amx_int8();
#if XNN_ARCH_X86_64 && defined(__linux__) && !defined(CHROMIUM)
if (hardware_config.use_x86_avx512amx) {
size_t status = xnn_syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA, 0);
Expand Down

0 comments on commit bb1650b

Please sign in to comment.