From 30c6a00a0383d970ae7dbbcbfba72e8f8700918c Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Tue, 9 May 2017 22:45:18 +0200 Subject: [PATCH] Fix bugs in double Simd4 implementations The double precision version of reduce() and dotProduct() returned a float with AVX_128_FMA, AVX_512, MIC and IBM_QPX. Only reduce() is used in double, in the PME force gather. The same bugs were fixed before for AVX(2)_256. Refs #2162. Change-Id: If1a5f044fc70ba1e8d7928a61e4e2c3d170a3922 --- src/gromacs/simd/impl_ibm_qpx/impl_ibm_qpx_simd4_double.h | 4 ++-- .../simd/impl_x86_avx_128_fma/impl_x86_avx_128_fma_simd4_double.h | 6 +++--- src/gromacs/simd/impl_x86_avx_512/impl_x86_avx_512_simd4_double.h | 6 +++--- src/gromacs/simd/impl_x86_mic/impl_x86_mic_simd4_double.h | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gromacs/simd/impl_ibm_qpx/impl_ibm_qpx_simd4_double.h b/src/gromacs/simd/impl_ibm_qpx/impl_ibm_qpx_simd4_double.h index e0dd99d00a..9223492f29 100644 --- a/src/gromacs/simd/impl_ibm_qpx/impl_ibm_qpx_simd4_double.h +++ b/src/gromacs/simd/impl_ibm_qpx/impl_ibm_qpx_simd4_double.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -226,7 +226,7 @@ trunc(Simd4Double x) }; } -static inline float gmx_simdcall +static inline double gmx_simdcall dotProduct(Simd4Double a, Simd4Double b) { vector4double dp_sh0 = vec_mul(a.simdInternal_, b.simdInternal_); diff --git a/src/gromacs/simd/impl_x86_avx_128_fma/impl_x86_avx_128_fma_simd4_double.h b/src/gromacs/simd/impl_x86_avx_128_fma/impl_x86_avx_128_fma_simd4_double.h index 1036eaace2..d51633ec7d 100644 --- a/src/gromacs/simd/impl_x86_avx_128_fma/impl_x86_avx_128_fma_simd4_double.h +++ b/src/gromacs/simd/impl_x86_avx_128_fma/impl_x86_avx_128_fma_simd4_double.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -256,7 +256,7 @@ trunc(Simd4Double x) }; } -static inline float gmx_simdcall +static inline double gmx_simdcall dotProduct(Simd4Double a, Simd4Double b) { __m128d tmp1, tmp2; @@ -359,7 +359,7 @@ blend(Simd4Double a, Simd4Double b, Simd4DBool sel) }; } -static inline float gmx_simdcall +static inline double gmx_simdcall reduce(Simd4Double a) { __m128d a0, a1; diff --git a/src/gromacs/simd/impl_x86_avx_512/impl_x86_avx_512_simd4_double.h b/src/gromacs/simd/impl_x86_avx_512/impl_x86_avx_512_simd4_double.h index ecf2eca5a3..44d13a1e06 100644 --- a/src/gromacs/simd/impl_x86_avx_512/impl_x86_avx_512_simd4_double.h +++ b/src/gromacs/simd/impl_x86_avx_512/impl_x86_avx_512_simd4_double.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -258,7 +258,7 @@ trunc(Simd4Double x) }; } -static inline float gmx_simdcall +static inline double gmx_simdcall dotProduct(Simd4Double a, Simd4Double b) { __m128d tmp1, tmp2; @@ -364,7 +364,7 @@ blend(Simd4Double a, Simd4Double b, Simd4DBool sel) }; } -static inline float gmx_simdcall +static inline double gmx_simdcall reduce(Simd4Double a) { __m128d a0, a1; diff --git a/src/gromacs/simd/impl_x86_mic/impl_x86_mic_simd4_double.h b/src/gromacs/simd/impl_x86_mic/impl_x86_mic_simd4_double.h index 4ed2602c37..29320adf41 100644 --- a/src/gromacs/simd/impl_x86_mic/impl_x86_mic_simd4_double.h +++ b/src/gromacs/simd/impl_x86_mic/impl_x86_mic_simd4_double.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -268,7 +268,7 @@ trunc(Simd4Double x) }; } -static inline float gmx_simdcall +static inline double gmx_simdcall dotProduct(Simd4Double a, Simd4Double b) { return _mm512_mask_reduce_add_pd(_mm512_int2mask(7), @@ -382,7 +382,7 @@ blend(Simd4Double a, Simd4Double b, Simd4DBool sel) }; } -static inline float gmx_simdcall +static inline double gmx_simdcall reduce(Simd4Double a) { return _mm512_mask_reduce_add_pd(_mm512_int2mask(0xF), a.simdInternal_); -- 2.11.4.GIT