Redesigned SIMD module and unit tests.
authorErik Lindahl <erik@kth.se>
Wed, 22 Jan 2014 17:30:10 +0000 (18:30 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 26 Feb 2014 10:52:57 +0000 (11:52 +0100)
commit8e92fd67fa04d90779778ec6a46752d22d199d4a
tree9fa212a800dde16b40982903fc1843c736096ea2
parentef2d19b37cb9978512f3ce8f0a6385cc44244d4d
Redesigned SIMD module and unit tests.

Second part of the commit (after renaming), which contains
the actual functionality changes. This new version
implements a complete interface layer that
is architecture-agnostic, while each architecture has a
separate implementation file with both single, double and
simd4 versions (that can be used simultaneously). simd.h
contains a number of defines that describe the capabilities
of the instruction set, and there is a new documentation
module for Doxygen. This will be used in a later patch
for modularized verlet kernels. With that, we hope to remove
all architecture-specific SIMD code from the rest of Gromacs.
All SIMD math functions have been redesigned so they work even
with instruction sets that do not support integers (and even
on sets that do not support logical operations), and
accuracy has been improved for double precision sincos() by
removing the table implementation. To try to reduce
the size of this relatively large patch I have kept a few
header files (in particular the math files in gromacs/simd)
to avoid touching all the group kernels. With this new kernel
module, 256-bit AVX2 SIMD acceleration will now automatically be
enabled for the verlet kernels. Group kernels will use AVX_256
in this case. Also incorporates changes from Teemu to make
static and gmx_inline library functions appear correctly in
the Doxygen documentation.
Relocation of nbnxn SIMD setup from nb_verlet.h to nbnxn_simd.h
in mdlib by Berk. Now the nbnxn SIMD setup is completely internal.
Replaced the pr4 functions in the nbnxn kernels by simd4.
The nbnxn kernel selection is now nearly architecture agnostic.
Also enabled FMA again for pmecorr SIMD functions in double.

Change-Id: I643da75f346f120500682bcc4bcc1333a635db70
96 files changed:
CMakeLists.txt
cmake/gmxTestSimd.cmake
doxygen/Doxyfile-common.cmakein
doxygen/Doxyfile-lib.cmakein
doxygen/Doxyfile-user.cmakein
doxygen/directories.cpp
doxygen/mainpage.md
doxygen/simd.md [new file with mode: 0644]
src/config.h.cmakein
src/gromacs/CMakeLists.txt
src/gromacs/gmxlib/bondfree.c
src/gromacs/gmxlib/gmx_cpuid.c
src/gromacs/gmxlib/nonbonded/CMakeLists.txt
src/gromacs/gmxlib/nonbonded/nb_kernel_avx_128_fma_double/kernelutil_x86_avx_128_fma_double.h
src/gromacs/gmxlib/nonbonded/nb_kernel_avx_128_fma_single/kernelutil_x86_avx_128_fma_single.h
src/gromacs/gmxlib/nonbonded/nb_kernel_avx_256_double/kernelutil_x86_avx_256_double.h
src/gromacs/gmxlib/nonbonded/nb_kernel_avx_256_single/kernelutil_x86_avx_256_single.h
src/gromacs/gmxlib/nonbonded/nb_kernel_sse2_double/kernelutil_x86_sse2_double.h
src/gromacs/gmxlib/nonbonded/nb_kernel_sse2_single/kernelutil_x86_sse2_single.h
src/gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_double/kernelutil_x86_sse4_1_double.h
src/gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/kernelutil_x86_sse4_1_single.h
src/gromacs/gmxlib/nonbonded/nonbonded.c
src/gromacs/gmxpreprocess/calc_verletbuf.c
src/gromacs/legacyheaders/gmx_cpuid.h
src/gromacs/legacyheaders/types/nb_verlet.h
src/gromacs/mdlib/forcerec.c
src/gromacs/mdlib/nbnxn_internal.h
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_simd_utils.h
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_simd_utils_ibm_qpx.h
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_simd_utils_ref.h
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_simd_utils_x86_128d.h
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_simd_utils_x86_128s.h
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_simd_utils_x86_256s.h
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_simd_utils_x86_mic.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn.c
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_common.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_inner.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_outer.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn.c
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_common.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_inner.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h
src/gromacs/mdlib/nbnxn_search.c
src/gromacs/mdlib/nbnxn_simd.h [new file with mode: 0644]
src/gromacs/mdlib/pme.c
src/gromacs/mdlib/pme_simd4.h
src/gromacs/mdlib/tpi.c
src/gromacs/simd/CMakeLists.txt [new file with mode: 0644]
src/gromacs/simd/four_wide_macros.h [deleted file]
src/gromacs/simd/four_wide_macros_ref.h [deleted file]
src/gromacs/simd/general_x86_avx_128_fma.h [deleted file]
src/gromacs/simd/general_x86_avx_256.h [deleted file]
src/gromacs/simd/general_x86_mic.h [deleted file]
src/gromacs/simd/general_x86_sse2.h [deleted file]
src/gromacs/simd/general_x86_sse4_1.h [deleted file]
src/gromacs/simd/impl_ibm_qpx/impl_ibm_qpx.h [new file with mode: 0644]
src/gromacs/simd/impl_intel_mic/impl_intel_mic.h [new file with mode: 0644]
src/gromacs/simd/impl_reference/impl_reference.h [new file with mode: 0644]
src/gromacs/simd/impl_x86_avx2_256/impl_x86_avx2_256.h [new file with mode: 0644]
src/gromacs/simd/impl_x86_avx_128_fma/impl_x86_avx_128_fma.h [new file with mode: 0644]
src/gromacs/simd/impl_x86_avx_256/impl_x86_avx_256.h [new file with mode: 0644]
src/gromacs/simd/impl_x86_sse2/impl_x86_sse2.h [new file with mode: 0644]
src/gromacs/simd/impl_x86_sse4_1/impl_x86_sse4_1.h [new file with mode: 0644]
src/gromacs/simd/macros.h [deleted file]
src/gromacs/simd/macros_ref.h [deleted file]
src/gromacs/simd/math_double.h [deleted file]
src/gromacs/simd/math_single.h [deleted file]
src/gromacs/simd/math_x86_avx_128_fma_double.h
src/gromacs/simd/math_x86_avx_128_fma_single.h
src/gromacs/simd/math_x86_avx_256_double.h
src/gromacs/simd/math_x86_avx_256_single.h
src/gromacs/simd/math_x86_sse2_double.h
src/gromacs/simd/math_x86_sse2_single.h
src/gromacs/simd/math_x86_sse4_1_double.h
src/gromacs/simd/math_x86_sse4_1_single.h
src/gromacs/simd/simd.h [new file with mode: 0644]
src/gromacs/simd/simd_math.h [new file with mode: 0644]
src/gromacs/simd/tests/CMakeLists.txt [new file with mode: 0644]
src/gromacs/simd/tests/base.cpp [new file with mode: 0644]
src/gromacs/simd/tests/base.h [new file with mode: 0644]
src/gromacs/simd/tests/bootstrap_loadstore.cpp [new file with mode: 0644]
src/gromacs/simd/tests/simd.cpp [new file with mode: 0644]
src/gromacs/simd/tests/simd.h [new file with mode: 0644]
src/gromacs/simd/tests/simd4.cpp [new file with mode: 0644]
src/gromacs/simd/tests/simd4.h [new file with mode: 0644]
src/gromacs/simd/tests/simd4_floatingpoint.cpp [new file with mode: 0644]
src/gromacs/simd/tests/simd4_math.cpp [new file with mode: 0644]
src/gromacs/simd/tests/simd4_vector_operations.cpp [new file with mode: 0644]
src/gromacs/simd/tests/simd_floatingpoint.cpp [new file with mode: 0644]
src/gromacs/simd/tests/simd_integer.cpp [new file with mode: 0644]
src/gromacs/simd/tests/simd_math.cpp [new file with mode: 0644]
src/gromacs/simd/tests/simd_vector_operations.cpp [new file with mode: 0644]
src/gromacs/simd/vector_operations.h
src/gromacs/utility/gmxomp.h