Change to test TSAN with clang and libomp
[alexxy/gromacs.git] / src / gromacs / mdlib / lincs.cpp
index fb3e2c0d7970539f0b8f58472f5ab316118a33c1..f57d901a034b42bf21d1c197848da938e6e014aa 100644 (file)
@@ -500,6 +500,23 @@ static void lincs_update_atoms(Lincs *li, int th,
 }
 
 #if GMX_SIMD_HAVE_REAL
+//! Helper function so that we can run TSAN with SIMD support (where implemented).
+template <int align>
+static inline void gmx_simdcall
+gatherLoadUTransposeTSANSafe(const real         *base,
+                             const std::int32_t *offset,
+                             SimdReal           *v0,
+                             SimdReal           *v1,
+                             SimdReal           *v2)
+{
+#if (CMAKE_BUILD_TYPE == CMAKE_BUILD_TYPE_TSAN) && GMX_SIMD_X86_AVX2_256
+    // This function is only implemented in this case
+    gatherLoadUTransposeSafe<align>(base, offset, v0, v1, v2);
+#else
+    gatherLoadUTranspose<align>(base, offset, v0, v1, v2);
+#endif
+}
+
 /*! \brief Calculate the constraint distance vectors r to project on from x.
  *
  * Determine the right-hand side of the matrix equation using quantity f.
@@ -541,8 +558,8 @@ calc_dr_x_f_simd(int                       b0,
             offset1[i] = bla[bs*2 + i*2 + 1];
         }
 
-        gatherLoadUTranspose<3>(reinterpret_cast<const real *>(x), offset0, &x0_S, &y0_S, &z0_S);
-        gatherLoadUTranspose<3>(reinterpret_cast<const real *>(x), offset1, &x1_S, &y1_S, &z1_S);
+        gatherLoadUTransposeTSANSafe<3>(reinterpret_cast<const real *>(x), offset0, &x0_S, &y0_S, &z0_S);
+        gatherLoadUTransposeTSANSafe<3>(reinterpret_cast<const real *>(x), offset1, &x1_S, &y1_S, &z1_S);
         rx_S = x0_S - x1_S;
         ry_S = y0_S - y1_S;
         rz_S = z0_S - z1_S;
@@ -558,8 +575,8 @@ calc_dr_x_f_simd(int                       b0,
 
         transposeScatterStoreU<3>(reinterpret_cast<real *>(r + bs), offset2, rx_S, ry_S, rz_S);
 
-        gatherLoadUTranspose<3>(reinterpret_cast<const real *>(f), offset0, &x0_S, &y0_S, &z0_S);
-        gatherLoadUTranspose<3>(reinterpret_cast<const real *>(f), offset1, &x1_S, &y1_S, &z1_S);
+        gatherLoadUTransposeTSANSafe<3>(reinterpret_cast<const real *>(f), offset0, &x0_S, &y0_S, &z0_S);
+        gatherLoadUTransposeTSANSafe<3>(reinterpret_cast<const real *>(f), offset1, &x1_S, &y1_S, &z1_S);
         fx_S = x0_S - x1_S;
         fy_S = y0_S - y1_S;
         fz_S = z0_S - z1_S;
@@ -757,23 +774,6 @@ static void do_lincsp(const rvec *x, rvec *f, rvec *fp, t_pbc *pbc,
 
 #if GMX_SIMD_HAVE_REAL
 
-//! Helper function so that we can run TSAN with SIMD support (where implemented).
-template <int align>
-static inline void gmx_simdcall
-gatherLoadUTransposeTSANSafe(const real         *base,
-                             const std::int32_t *offset,
-                             SimdReal           *v0,
-                             SimdReal           *v1,
-                             SimdReal           *v2)
-{
-#if (CMAKE_BUILD_TYPE == CMAKE_BUILD_TYPE_TSAN) && GMX_SIMD_X86_AVX2_256
-    // This function is only implemented in this case
-    gatherLoadUTransposeSafe<align>(base, offset, v0, v1, v2);
-#else
-    gatherLoadUTranspose<align>(base, offset, v0, v1, v2);
-#endif
-}
-
 /*! \brief Calculate the constraint distance vectors r to project on from x.
  *
  * Determine the right-hand side of the matrix equation using coordinates xp. */