Commit d4ab9550 authored by Andreas Marek's avatar Andreas Marek

Better control of AVX kernels

Sometimes it might be desirable that only one of the specifc AVX
kernels (AVX, AVX2, and in the future AVX512) are build, even though the processor
supports all (or several) of these instructions.

The flag --disable-[avx | avx2 | avx512] allows to define which kernels
should NOT be build. The default is: what can be build will be build
parent b9ac9bf6
...@@ -258,19 +258,32 @@ fi ...@@ -258,19 +258,32 @@ fi
dnl check whether one can compile with avx - gcc intrinsics dnl check whether one can compile with avx - gcc intrinsics
dnl first pass: try with specified CFLAGS and CXXFLAGS dnl first pass: try with specified CFLAGS and CXXFLAGS
AC_MSG_CHECKING([whether we can compile AVX intrinsics in C])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_MSG_CHECKING(whether --enable-avx is specified)
#include <x86intrin.h> AC_ARG_ENABLE([avx],
int main(int argc, char **argv){ AS_HELP_STRING([--enable-avx],
double* q; [check whether AVX kernels can be build, default yes]),
__m256d a1_1 = _mm256_load_pd(q); [check_avx=no],
return 0; [check_avx=yes])
} AC_MSG_RESULT([$check_avx])
])],
[can_compile_avx=yes], if test "${check_avx}" = "yes"; then
[can_compile_avx=no] AC_MSG_CHECKING([whether we can compile AVX intrinsics in C])
) AC_COMPILE_IFELSE([AC_LANG_SOURCE([
AC_MSG_RESULT([${can_compile_avx}]) #include <x86intrin.h>
int main(int argc, char **argv){
double* q;
__m256d a1_1 = _mm256_load_pd(q);
return 0;
}
])],
[can_compile_avx=yes],
[can_compile_avx=no]
)
AC_MSG_RESULT([${can_compile_avx}])
else
can_compile_avx=no
fi
dnl if test "${can_compile_avx}" = "yes" ; then dnl if test "${can_compile_avx}" = "yes" ; then
dnl AC_MSG_CHECKING([whether we can compile AVX intrinsics in C++]) dnl AC_MSG_CHECKING([whether we can compile AVX intrinsics in C++])
...@@ -293,20 +306,32 @@ dnl AC_MSG_WARN([Cannot compile C++ with AVX: disabling AVX alltogether]) ...@@ -293,20 +306,32 @@ dnl AC_MSG_WARN([Cannot compile C++ with AVX: disabling AVX alltogether])
dnl fi dnl fi
dnl fi dnl fi
AC_MSG_CHECKING([whether we can compile AVX2 intrinsics in C]) AC_MSG_CHECKING(whether --enable-avx2 is specified)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_ARG_ENABLE([avx2],
#include <x86intrin.h> AS_HELP_STRING([--enable-avx2],
int main(int argc, char **argv){ [check whether AVX2 kernels can be build, default yes]),
double* q; [check_avx2=no],
__m256d q1 = _mm256_load_pd(q); [check_avx2=yes])
__m256d y1 = _mm256_fmadd_pd(q1, q1, q1); AC_MSG_RESULT([$check_avx2])
return 0;
} if test "${check_avx2}" = "yes"; then
])], AC_MSG_CHECKING([whether we can compile AVX2 intrinsics in C])
[can_compile_avx2=yes], AC_COMPILE_IFELSE([AC_LANG_SOURCE([
[can_compile_avx2=no] #include <x86intrin.h>
) int main(int argc, char **argv){
AC_MSG_RESULT([${can_compile_avx2}]) double* q;
__m256d q1 = _mm256_load_pd(q);
__m256d y1 = _mm256_fmadd_pd(q1, q1, q1);
return 0;
}
])],
[can_compile_avx2=yes],
[can_compile_avx2=no]
)
AC_MSG_RESULT([${can_compile_avx2}])
else
can_compile_avx2=no
fi
dnl if test "${can_compile_avx2}" = "yes" ; then dnl if test "${can_compile_avx2}" = "yes" ; then
dnl AC_MSG_CHECKING([whether we can compile AVX2 intrinsics in C++]) dnl AC_MSG_CHECKING([whether we can compile AVX2 intrinsics in C++])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment