From 32ffaa3de58981814342fe6d3556c03d41d121f8 Mon Sep 17 00:00:00 2001 From: Gvozden Neskovic Date: Fri, 1 Jul 2016 18:33:04 +0200 Subject: Add support for AVX-512 family of instruction sets This patch adds compiler and runtime tests (user and kernel) for following instruction sets: avx512f, avx512cd, avx512er, avx512pf, avx512bw, avx512dq, avx512vl, avx512ifma, avx512vbmi. note: Linux support for AVX-512F (Foundation) instruction set started with linux v3.15 Signed-off-by: Gvozden Neskovic Signed-off-by: Brian Behlendorf Issue #4952 --- config/toolchain-simd.m4 | 189 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) (limited to 'config') diff --git a/config/toolchain-simd.m4 b/config/toolchain-simd.m4 index 0f8c1f2d9..29abbbb5b 100644 --- a/config/toolchain-simd.m4 +++ b/config/toolchain-simd.m4 @@ -12,6 +12,15 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD], [ ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_2 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX2 + ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512F + ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512CD + ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512DQ + ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512BW + ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512IFMA + ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VBMI + ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512PF + ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512ER + ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VL ;; esac ]) @@ -170,3 +179,183 @@ AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX2], [ AC_MSG_RESULT([no]) ]) ]) + +dnl # +dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512F +dnl # +AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512F], [ + AC_MSG_CHECKING([whether host toolchain supports AVX512F]) + + AC_LINK_IFELSE([AC_LANG_SOURCE([ + [ + void main() + { + __asm__ __volatile__("vpandd %zmm0,%zmm1,%zmm2"); + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AVX512F], 1, [Define if host toolchain supports AVX512F]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + +dnl # +dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512CD +dnl # +AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512CD], [ + AC_MSG_CHECKING([whether host toolchain supports AVX512CD]) + + AC_LINK_IFELSE([AC_LANG_SOURCE([ + [ + void main() + { + __asm__ __volatile__("vplzcntd %zmm0,%zmm1"); + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AVX512CD], 1, [Define if host toolchain supports AVX512CD]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + +dnl # +dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512DQ +dnl # +AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512DQ], [ + AC_MSG_CHECKING([whether host toolchain supports AVX512DQ]) + + AC_LINK_IFELSE([AC_LANG_SOURCE([ + [ + void main() + { + __asm__ __volatile__("vandpd %zmm0,%zmm1,%zmm2"); + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AVX512DQ], 1, [Define if host toolchain supports AVX512DQ]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + +dnl # +dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512BW +dnl # +AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512BW], [ + AC_MSG_CHECKING([whether host toolchain supports AVX512BW]) + + AC_LINK_IFELSE([AC_LANG_SOURCE([ + [ + void main() + { + __asm__ __volatile__("vpshufb %zmm0,%zmm1,%zmm2"); + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AVX512BW], 1, [Define if host toolchain supports AVX512BW]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + +dnl # +dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512IFMA +dnl # +AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512IFMA], [ + AC_MSG_CHECKING([whether host toolchain supports AVX512IFMA]) + + AC_LINK_IFELSE([AC_LANG_SOURCE([ + [ + void main() + { + __asm__ __volatile__("vpmadd52luq %zmm0,%zmm1,%zmm2"); + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AVX512IFMA], 1, [Define if host toolchain supports AVX512IFMA]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + +dnl # +dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VBMI +dnl # +AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VBMI], [ + AC_MSG_CHECKING([whether host toolchain supports AVX512VBMI]) + + AC_LINK_IFELSE([AC_LANG_SOURCE([ + [ + void main() + { + __asm__ __volatile__("vpermb %zmm0,%zmm1,%zmm2"); + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AVX512VBMI], 1, [Define if host toolchain supports AVX512VBMI]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + +dnl # +dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512PF +dnl # +AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512PF], [ + AC_MSG_CHECKING([whether host toolchain supports AVX512PF]) + + AC_LINK_IFELSE([AC_LANG_SOURCE([ + [ + void main() + { + __asm__ __volatile__("vgatherpf0dps (%rsi,%zmm0,4){%k1}"); + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AVX512PF], 1, [Define if host toolchain supports AVX512PF]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + +dnl # +dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512ER +dnl # +AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512ER], [ + AC_MSG_CHECKING([whether host toolchain supports AVX512ER]) + + AC_LINK_IFELSE([AC_LANG_SOURCE([ + [ + void main() + { + __asm__ __volatile__("vexp2pd %zmm0,%zmm1"); + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AVX512ER], 1, [Define if host toolchain supports AVX512ER]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + +dnl # +dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VL +dnl # +AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VL], [ + AC_MSG_CHECKING([whether host toolchain supports AVX512VL]) + + AC_LINK_IFELSE([AC_LANG_SOURCE([ + [ + void main() + { + __asm__ __volatile__("vpabsq %zmm0,%zmm1"); + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AVX512VL], 1, [Define if host toolchain supports AVX512VL]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) -- cgit v1.2.3