@@ -30,6 +30,20 @@ AC_DEFUN([OVS_CHECK_DPCLS_AUTOVALIDATOR], [
fi
])
+
+AC_DEFUN([OVS_CHECK_CPU_ISA_OPT_IN], [
+ AC_ARG_ENABLE([cpu-isa],
+ [AC_HELP_STRING([--enable-cpu-isa], [Enable CPU ISA default enable.])],
+ [isa=yes],[isa=no])
+ AC_MSG_CHECKING([whether CPU ISA should be enabled by default])
+ if test "$isa" != yes; then
+ AC_MSG_RESULT([no])
+ else
+ OVS_CFLAGS="$OVS_CFLAGS -DCPU_ISA_OPT_IN"
+ AC_MSG_RESULT([yes])
+ fi
+])
+
dnl OVS_ENABLE_WERROR
AC_DEFUN([OVS_ENABLE_WERROR],
[AC_ARG_ENABLE(
@@ -184,6 +184,7 @@ OVS_CHECK_CC_OPTION([-mavx512f], [CFLAGS="$CFLAGS -DHAVE_AVX512F"])
OVS_ENABLE_WERROR
OVS_ENABLE_SPARSE
OVS_CTAGS_IDENTIFIERS
+OVS_CHECK_CPU_ISA_OPT_IN
OVS_CHECK_DPCLS_AUTOVALIDATOR
OVS_CHECK_BINUTILS_AVX512
@@ -45,7 +45,13 @@ static struct dpcls_subtable_lookup_info_t subtable_lookups[] = {
#if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && __SSE4_2__)
/* Only available on x86_64 bit builds with SSE 4.2 used for OVS core. */
- { .prio = 0,
+ {
+#ifdef CPU_ISA_OPT_IN
+ /* Allow Autovalidator to override, but higher than default scalar. */
+ .prio = 100,
+#else
+ .prio = 0,
+#endif
.probe = dpcls_subtable_avx512_gather_probe,
.name = "avx512_gather", },
#else
This commit allows "opt-in" to CPU ISA optimized implementations of OVS SW datapath components at compile time. This can be useful in some deployments where the CPU ISA optimized implementation is to be chosen by default. Note that only the default priority order of valid subtable implementations is being modified. If a subtable implementation is not available due to ISA not being available, it will not be selected. With --enable-cpu-isa on an AVX512 capable CPU, the dpcls_avx512_gather ISA optimized implementation of DPCLS is automatically enabled. The default is off, so unless ./configure --enable-cpu-isa is passed, the behaviour of the default OVS compile is not changed. Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com> --- acinclude.m4 | 14 ++++++++++++++ configure.ac | 1 + lib/dpif-netdev-lookup.c | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-)