2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

acinclude: Don't set AVX512-related configuration via CFLAGS.

The correct way to pass configuration options is to define them
inside the config.h.  Additionally, few long lines wrapped and
fixed the unnecessary double check for -mavx512f.

Fixes: abb807e27d ("dpif-netdev: Add command to switch dpif implementation.")
Fixes: 5324b54e60 ("dpif-netdev: Add configure to enable autovalidator at build time.")
Fixes: e90e115a01 ("dpif-netdev: implement subtable lookup validation.")
Fixes: 352b6c7116 ("dpif-lookup: add avx512 gather implementation.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Cian Ferriter <cian.ferriter@intel.com>
This commit is contained in:
Ilya Maximets
2021-08-03 19:36:39 +02:00
parent e21e9dcec2
commit a3bd383e94
3 changed files with 35 additions and 10 deletions

View File

@@ -19,13 +19,16 @@ dnl This enables automatically running all unit tests with all MFEX
dnl implementations. dnl implementations.
AC_DEFUN([OVS_CHECK_MFEX_AUTOVALIDATOR], [ AC_DEFUN([OVS_CHECK_MFEX_AUTOVALIDATOR], [
AC_ARG_ENABLE([mfex-default-autovalidator], AC_ARG_ENABLE([mfex-default-autovalidator],
[AC_HELP_STRING([--enable-mfex-default-autovalidator], [Enable MFEX autovalidator as default miniflow_extract implementation.])], [AC_HELP_STRING([--enable-mfex-default-autovalidator],
[Enable MFEX autovalidator as default
miniflow_extract implementation.])],
[autovalidator=yes],[autovalidator=no]) [autovalidator=yes],[autovalidator=no])
AC_MSG_CHECKING([whether MFEX Autovalidator is default implementation]) AC_MSG_CHECKING([whether MFEX Autovalidator is default implementation])
if test "$autovalidator" != yes; then if test "$autovalidator" != yes; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
else else
OVS_CFLAGS="$OVS_CFLAGS -DMFEX_AUTOVALIDATOR_DEFAULT" AC_DEFINE([MFEX_AUTOVALIDATOR_DEFAULT], [1],
[Autovalidator for miniflow_extract is a default implementation.])
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
fi fi
]) ])
@@ -35,13 +38,17 @@ dnl This enables automatically running all unit tests with all DPCLS
dnl implementations. dnl implementations.
AC_DEFUN([OVS_CHECK_DPCLS_AUTOVALIDATOR], [ AC_DEFUN([OVS_CHECK_DPCLS_AUTOVALIDATOR], [
AC_ARG_ENABLE([autovalidator], AC_ARG_ENABLE([autovalidator],
[AC_HELP_STRING([--enable-autovalidator], [Enable DPCLS autovalidator as default subtable search implementation.])], [AC_HELP_STRING([--enable-autovalidator],
[Enable DPCLS autovalidator as default subtable
search implementation.])],
[autovalidator=yes],[autovalidator=no]) [autovalidator=yes],[autovalidator=no])
AC_MSG_CHECKING([whether DPCLS Autovalidator is default implementation]) AC_MSG_CHECKING([whether DPCLS Autovalidator is default implementation])
if test "$autovalidator" != yes; then if test "$autovalidator" != yes; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
else else
OVS_CFLAGS="$OVS_CFLAGS -DDPCLS_AUTOVALIDATOR_DEFAULT" AC_DEFINE([DPCLS_AUTOVALIDATOR_DEFAULT], [1],
[Autovalidator for the userspace datapath classifier is a
default implementation.])
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
fi fi
]) ])
@@ -50,17 +57,34 @@ dnl Set OVS DPIF default implementation at configure time for running the unit
dnl tests on the whole codebase without modifying tests per DPIF impl dnl tests on the whole codebase without modifying tests per DPIF impl
AC_DEFUN([OVS_CHECK_DPIF_AVX512_DEFAULT], [ AC_DEFUN([OVS_CHECK_DPIF_AVX512_DEFAULT], [
AC_ARG_ENABLE([dpif-default-avx512], AC_ARG_ENABLE([dpif-default-avx512],
[AC_HELP_STRING([--enable-dpif-default-avx512], [Enable DPIF AVX512 implementation as default.])], [AC_HELP_STRING([--enable-dpif-default-avx512],
[Enable DPIF AVX512 implementation as default.])],
[dpifavx512=yes],[dpifavx512=no]) [dpifavx512=yes],[dpifavx512=no])
AC_MSG_CHECKING([whether DPIF AVX512 is default implementation]) AC_MSG_CHECKING([whether DPIF AVX512 is default implementation])
if test "$dpifavx512" != yes; then if test "$dpifavx512" != yes; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
else else
OVS_CFLAGS="$OVS_CFLAGS -DDPIF_AVX512_DEFAULT" AC_DEFINE([DPIF_AVX512_DEFAULT], [1],
[DPIF AVX512 is a default implementation of the userspace
datapath interface.])
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
fi fi
]) ])
dnl OVS_CHECK_AVX512
dnl
dnl Checks if compiler and binutils supports AVX512.
AC_DEFUN([OVS_CHECK_AVX512], [
OVS_CHECK_BINUTILS_AVX512
OVS_CHECK_CC_OPTION(
[-mavx512f], [ovs_have_cc_mavx512f=yes], [ovs_have_cc_mavx512f=no])
AM_CONDITIONAL([HAVE_AVX512F], [test $ovs_have_cc_mavx512f = yes])
if test "$ovs_have_cc_mavx512f" = yes; then
AC_DEFINE([HAVE_AVX512F], [1],
[Define to 1 if compiler supports AVX512.])
fi
])
dnl OVS_ENABLE_WERROR dnl OVS_ENABLE_WERROR
AC_DEFUN([OVS_ENABLE_WERROR], AC_DEFUN([OVS_ENABLE_WERROR],
[AC_ARG_ENABLE( [AC_ARG_ENABLE(

View File

@@ -179,15 +179,13 @@ OVS_ENABLE_OPTION([-Wno-null-pointer-arithmetic])
OVS_ENABLE_OPTION([-Warray-bounds-pointer-arithmetic]) OVS_ENABLE_OPTION([-Warray-bounds-pointer-arithmetic])
OVS_CONDITIONAL_CC_OPTION([-Wno-unused], [HAVE_WNO_UNUSED]) OVS_CONDITIONAL_CC_OPTION([-Wno-unused], [HAVE_WNO_UNUSED])
OVS_CONDITIONAL_CC_OPTION([-Wno-unused-parameter], [HAVE_WNO_UNUSED_PARAMETER]) OVS_CONDITIONAL_CC_OPTION([-Wno-unused-parameter], [HAVE_WNO_UNUSED_PARAMETER])
OVS_CONDITIONAL_CC_OPTION([-mavx512f], [HAVE_AVX512F])
OVS_CHECK_CC_OPTION([-mavx512f], [CFLAGS="$CFLAGS -DHAVE_AVX512F"])
OVS_ENABLE_WERROR OVS_ENABLE_WERROR
OVS_ENABLE_SPARSE OVS_ENABLE_SPARSE
OVS_CTAGS_IDENTIFIERS OVS_CTAGS_IDENTIFIERS
OVS_CHECK_DPCLS_AUTOVALIDATOR OVS_CHECK_DPCLS_AUTOVALIDATOR
OVS_CHECK_DPIF_AVX512_DEFAULT OVS_CHECK_DPIF_AVX512_DEFAULT
OVS_CHECK_MFEX_AUTOVALIDATOR OVS_CHECK_MFEX_AUTOVALIDATOR
OVS_CHECK_BINUTILS_AVX512 OVS_CHECK_AVX512
AC_ARG_VAR(KARCH, [Kernel Architecture String]) AC_ARG_VAR(KARCH, [Kernel Architecture String])
AC_SUBST(KARCH) AC_SUBST(KARCH)

View File

@@ -412,7 +412,6 @@ AC_DEFUN([OVS_CHECK_BINUTILS_AVX512],
if ($CC -dumpmachine | grep x86_64) >/dev/null 2>&1; then if ($CC -dumpmachine | grep x86_64) >/dev/null 2>&1; then
if (objdump -d --no-show-raw-insn $OBJFILE | grep -q $GATHER_PARAMS) >/dev/null 2>&1; then if (objdump -d --no-show-raw-insn $OBJFILE | grep -q $GATHER_PARAMS) >/dev/null 2>&1; then
ovs_cv_binutils_avx512_good=yes ovs_cv_binutils_avx512_good=yes
CFLAGS="$CFLAGS -DHAVE_LD_AVX512_GOOD"
else else
ovs_cv_binutils_avx512_good=no ovs_cv_binutils_avx512_good=no
dnl Explicitly disallow avx512f to stop compiler auto-vectorizing dnl Explicitly disallow avx512f to stop compiler auto-vectorizing
@@ -424,6 +423,10 @@ AC_DEFUN([OVS_CHECK_BINUTILS_AVX512],
ovs_cv_binutils_avx512_good=no ovs_cv_binutils_avx512_good=no
fi]) fi])
rm $OBJFILE rm $OBJFILE
if test "$ovs_cv_binutils_avx512_good" = yes; then
AC_DEFINE([HAVE_LD_AVX512_GOOD], [1],
[Define to 1 if binutils correctly supports AVX512.])
fi
AM_CONDITIONAL([HAVE_LD_AVX512_GOOD], AM_CONDITIONAL([HAVE_LD_AVX512_GOOD],
[test "$ovs_cv_binutils_avx512_good" = yes])]) [test "$ovs_cv_binutils_avx512_good" = yes])])