Commit 5a1efab3 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, 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 554d2785
...@@ -284,22 +284,33 @@ else ...@@ -284,22 +284,33 @@ else
install_complex_sse_block2=no install_complex_sse_block2=no
fi fi
dnl check whether one can compile with avx - gcc intrinsics AC_MSG_CHECKING(whether --enable-avx is specified)
AC_ARG_ENABLE([avx],
dnl first pass: try with specified CFLAGS and CXXFLAGS AS_HELP_STRING([--enable-avx],
AC_MSG_CHECKING([whether we can compile AVX gcc intrinsics in C]) [check whether AVX kernels can be build, default yes]),
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ [check_avx=no],
#include <x86intrin.h> [check_avx=yes])
int main(int argc, char **argv){ AC_MSG_RESULT([$check_avx])
double* q;
__m256d a1_1 = _mm256_load_pd(q); if test "${check_avx}" = "yes"; then
return 0; dnl check whether one can compile with avx - gcc intrinsics
} dnl first pass: try with specified CFLAGS and CXXFLAGS
])], AC_MSG_CHECKING([whether we can compile AVX gcc intrinsics in C])
[can_compile_avx=yes], AC_COMPILE_IFELSE([AC_LANG_SOURCE([
[can_compile_avx=no] #include <x86intrin.h>
) int main(int argc, char **argv){
AC_MSG_RESULT([${can_compile_avx}]) 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
#if test "${can_compile_avx}" = "yes" ; then #if test "${can_compile_avx}" = "yes" ; then
# AC_MSG_CHECKING([whether we can compile AVX gcc intrinsics in C++]) # AC_MSG_CHECKING([whether we can compile AVX gcc intrinsics in C++])
...@@ -322,20 +333,33 @@ AC_MSG_RESULT([${can_compile_avx}]) ...@@ -322,20 +333,33 @@ AC_MSG_RESULT([${can_compile_avx}])
# fi # fi
#fi #fi
AC_MSG_CHECKING([whether we can compile AVX2 gcc 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 gcc 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
#if test "${can_compile_avx2}" = "yes" ; then #if test "${can_compile_avx2}" = "yes" ; then
# AC_MSG_CHECKING([whether we can compile AVX2 gcc intrinsics in C++]) # AC_MSG_CHECKING([whether we can compile AVX2 gcc intrinsics in C++])
# AC_LANG_PUSH([C++]) # AC_LANG_PUSH([C++])
...@@ -358,20 +382,32 @@ AC_MSG_RESULT([${can_compile_avx2}]) ...@@ -358,20 +382,32 @@ AC_MSG_RESULT([${can_compile_avx2}])
# fi # fi
#fi #fi
AC_MSG_CHECKING([whether we can compile AVX512 gcc intrinsics in C]) AC_MSG_CHECKING(whether --enable-avx512 is specified)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_ARG_ENABLE([avx512],
#include <x86intrin.h> AS_HELP_STRING([--enable-avx512],
int main(int argc, char **argv){ [check whether AVX512 kernels can be build, default yes]),
double* q; [check_avx512=no],
__m512d q1 = _mm512_load_pd(q); [check_avx512=yes])
__m512d y1 = _mm512_fmadd_pd(q1, q1, q1); AC_MSG_RESULT([$check_avx512])
return 0;
} if test "${check_avx512}" = "yes"; then
])], AC_MSG_CHECKING([whether we can compile AVX512 gcc intrinsics in C])
[can_compile_avx512=yes], AC_COMPILE_IFELSE([AC_LANG_SOURCE([
[can_compile_avx512=no] #include <x86intrin.h>
) int main(int argc, char **argv){
AC_MSG_RESULT([${can_compile_avx512}]) double* q;
__m512d q1 = _mm512_load_pd(q);
__m512d y1 = _mm512_fmadd_pd(q1, q1, q1);
return 0;
}
])],
[can_compile_avx512=yes],
[can_compile_avx512=no]
)
AC_MSG_RESULT([${can_compile_avx512}])
else
can_compile_avx512=no
fi
#if test "${can_compile_avx512}" = "yes" ; then #if test "${can_compile_avx512}" = "yes" ; then
# AC_MSG_CHECKING([whether we can compile AVX512 gcc intrinsics in C++]) # AC_MSG_CHECKING([whether we can compile AVX512 gcc 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