Remove gmx_simd_check_and_reset_overflow
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 4 Jun 2015 11:32:32 +0000 (13:32 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 5 Jun 2015 17:46:55 +0000 (19:46 +0200)
We think this can only be implemented on x86, was only used for TPI,
and protected against an issue Berk can't reproduce. Thus best
removed.

Refs #1740

Change-Id: Ia8ca50b67683dab5a0e5e4a8b8485946edfd922a

src/gromacs/mdlib/tpi.cpp
src/gromacs/simd/impl_ibm_qpx/impl_ibm_qpx.h
src/gromacs/simd/impl_ibm_vmx/impl_ibm_vmx.h
src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx.h
src/gromacs/simd/impl_intel_mic/impl_intel_mic.h
src/gromacs/simd/impl_reference/impl_reference.h
src/gromacs/simd/impl_x86_avx_256/impl_x86_avx_256.h
src/gromacs/simd/impl_x86_avx_512f/impl_x86_avx_512f.h
src/gromacs/simd/impl_x86_sse2/impl_x86_sse2.h

index da745706f6bcfdd4bfb308ef447e41b5e1e159b4..744efd51af0e059380d0ab0a151029c74749ed85 100644 (file)
@@ -70,7 +70,6 @@
 #include "gromacs/math/units.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/random/random.h"
-#include "gromacs/simd/simd.h"
 #include "gromacs/timing/wallcycle.h"
 #include "gromacs/timing/walltime_accounting.h"
 #include "gromacs/topology/mtop_util.h"
@@ -464,11 +463,6 @@ double do_tpi(FILE *fplog, t_commrec *cr,
             gmx_fatal(FARGS, "Unknown integrator %s", ei_names[inputrec->eI]);
     }
 
-#ifdef GMX_SIMD
-    /* Make sure we don't detect SIMD overflow generated before this point */
-    gmx_simd_check_and_reset_overflow();
-#endif
-
     while (bNotLastFrame)
     {
         frame_step      = rerun_fr.step;
@@ -668,17 +662,7 @@ double do_tpi(FILE *fplog, t_commrec *cr,
 
             epot               = enerd->term[F_EPOT];
             bEnergyOutOfBounds = FALSE;
-#ifdef GMX_SIMD_X86_SSE2_OR_HIGHER
-            /* With SSE the energy can overflow, check for this */
-            if (gmx_simd_check_and_reset_overflow())
-            {
-                if (debug)
-                {
-                    fprintf(debug, "Found an SSE overflow, assuming the energy is out of bounds\n");
-                }
-                bEnergyOutOfBounds = TRUE;
-            }
-#endif
+
             /* If the compiler doesn't optimize this check away
              * we catch the NAN energies.
              * The epot>GMX_REAL_MAX check catches inf values,
index ebbf77aec775e79d548a95f2313bd88c1351da83..bed7790e3be75a20668e00231d89499604dd273b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, 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.
@@ -468,13 +468,4 @@ gmx_simd4_dotproduct3_f_ibm_qpx(vector4double a, vector4double b)
     return (float)gmx_simd4_dotproduct3_d_ibm_qpx(a, b);
 }
 
-/* Function to check whether SIMD operations have resulted in overflow.
- * For now, this is unfortunately a dummy for this architecture.
- */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
-    return 0;
-}
-
 #endif /* GMX_SIMD_IMPLEMENTATION_IBM_QPX_H */
index 66b2986925a9a607111339765f235549de6e1196..3f35a7fce8b246c867684eb92249bd24ea48d3a1 100644 (file)
@@ -348,13 +348,4 @@ gmx_simd4_dotproduct3_f_ibm_vmx(gmx_simd4_float_t a, gmx_simd4_float_t b)
     return gmx_simd_reduce_f_ibm_vmx(c);
 }
 
-/* Function to check whether SIMD operations have resulted in overflow.
- * For now, this is unfortunately a dummy for this architecture.
- */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
-    return 0;
-}
-
 #endif /* GMX_SIMD_IMPLEMENTATION_IBM_VMX_H */
index ca8fb1ba5c3065115f5a19291ee781c890e960ed..d5fb5483d9bd943838071de774bdc7dbfd80640e 100644 (file)
@@ -615,15 +615,6 @@ gmx_simd4_dotproduct3_f_ibm_vsx(gmx_simd4_float_t a, gmx_simd4_float_t b)
     return vec_extract(sum, 0);
 }
 
-/* Function to check whether SIMD operations have resulted in overflow.
- * For now, this is unfortunately a dummy for this architecture.
- */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
-    return 0;
-}
-
 /* Undefine our temporary work-arounds so they are not used by mistake */
 #undef gmx_vsx_f2d
 #undef gmx_vsx_d2f
index 1840c772753c7dfb5cfc58e71d2e9214cd1817f8..0fd51fb3992525e8b0d97207bfd64788026fc6b6 100644 (file)
@@ -555,28 +555,4 @@ gmx_simd_log_f_mic(__m512 x)
     return _mm512_mul_ps(_mm512_set1_ps(0.693147180559945286226764), _mm512_log2ae23_ps(x));
 }
 
-/* Function to check whether SIMD operations have resulted in overflow */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
-    int                MXCSR;
-    int                sse_overflow;
-    /* The overflow flag is bit 3 in the register */
-    const unsigned int flag = 0x8;
-
-    MXCSR = _mm_getcsr();
-    if (MXCSR & flag)
-    {
-        sse_overflow = 1;
-        /* Set the overflow flag to zero */
-        MXCSR = MXCSR & ~flag;
-        _mm_setcsr(MXCSR);
-    }
-    else
-    {
-        sse_overflow = 0;
-    }
-    return sse_overflow;
-}
-
 #endif /* GMX_SIMD_IMPL_INTEL_MIC_H */
index c4f6f776caa1aa353d1ae14dcd62b1a75be866aa..05d73f34d35de579e045e27aab3b0730e6cc3426 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, 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.
@@ -3693,18 +3693,6 @@ gmx_simd4_dotproduct3_d(gmx_simd_double_t a, gmx_simd_double_t b)
 /*! \} */
 
 
-/*! \brief Return 1 if SIMD floating-point ops have overflowed, and reset check.
-
- * This function to check whether SIMD operations have resulted in overflow,
- * and returns 1 if it occured, 0 otherwise.
- * For now, this is unfortunately a dummy for all architectures except x86.
- */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
-    return 0;
-}
-
 /*! \} */
 /*! \endcond */
 
index 8e2671a321edb5043852cd742a7dd4fa84369d7b..499882a1051a1c28cdd384f44d69f8951a394237 100644 (file)
@@ -539,28 +539,5 @@ gmx_simd4_dotproduct3_d_avx_256(__m256d a, __m256d b)
     return d;
 }
 
-/* Function to check whether SIMD operations have resulted in overflow */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
-    int MXCSR;
-    int sse_overflow;
-
-    MXCSR = _mm_getcsr();
-    /* The overflow flag is bit 3 in the register */
-    if (MXCSR & 0x0008)
-    {
-        sse_overflow = 1;
-        /* Set the overflow flag to zero */
-        MXCSR = MXCSR & 0xFFF7;
-        _mm_setcsr(MXCSR);
-    }
-    else
-    {
-        sse_overflow = 0;
-    }
-    return sse_overflow;
-}
-
 
 #endif /* GMX_SIMD_IMPL_X86_AVX_256_H */
index fac0b6f84a651d88be7106d5e051ba29eb2c23d3..0f7b387dd7e94fd649ffbc0962415b4dba6b03b5 100644 (file)
@@ -491,28 +491,4 @@ gmx_simd4_dotproduct3_d_x86_avx_512f(__m256d a, __m256d b)
     return d;
 }
 
-/* Function to check whether SIMD operations have resulted in overflow */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
-    int                MXCSR;
-    int                sse_overflow;
-    /* The overflow flag is bit 3 in the register */
-    const unsigned int flag = 0x8;
-
-    MXCSR = _mm_getcsr();
-    if (MXCSR & flag)
-    {
-        sse_overflow = 1;
-        /* Set the overflow flag to zero */
-        MXCSR = MXCSR & ~flag;
-        _mm_setcsr(MXCSR);
-    }
-    else
-    {
-        sse_overflow = 0;
-    }
-    return sse_overflow;
-}
-
 #endif /* GMX_SIMD_IMPL_X86_AVX_512F_H */
index 90aac616a13f21305e38bae5bc79eb58b53c9ba6..3151d97b3f16950fc7b7a00e9df8b23488edeec7 100644 (file)
@@ -373,29 +373,6 @@ gmx_simd_reduce_d_sse2(__m128d a)
     return f;
 }
 
-/* Function to check whether SIMD operations have resulted in overflow */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
-    int MXCSR;
-    int sse_overflow;
-
-    MXCSR = _mm_getcsr();
-    /* The overflow flag is bit 3 in the register */
-    if (MXCSR & 0x0008)
-    {
-        sse_overflow = 1;
-        /* Set the overflow flag to zero */
-        MXCSR = MXCSR & 0xFFF7;
-        _mm_setcsr(MXCSR);
-    }
-    else
-    {
-        sse_overflow = 0;
-    }
-    return sse_overflow;
-}
-
 /* SSE2 is already 4-wide in single, so we just reuse float datatype for SIMD4.
  * SSE2 cannot do double-precision SIMD4.
  */