Commit 410ff83f authored by Nicholas Breen's avatar Nicholas Breen

Remove test_GMX_ALIGNED.patch, incorporated upstream

parent d5fe12a3
gromacs (2018-1) UNRELEASED; urgency=medium
* New upstream release.
- Remove test_GMX_ALIGNED.patch, incorporated.
-- Nicholas Breen <nbreen@debian.org> Wed, 10 Jan 2018 19:04:30 -0800
gromacs (2018~rc1-3) experimental; urgency=medium
* patches/gtest-death-test.patch: disable EXPECT_DEATH tests if
......
......@@ -4,6 +4,5 @@ reproducible-builds.patch
doxygen.patch
disable-cpuinfotest.patch
hurd-disable-numa-test.patch
test_GMX_ALIGNED.patch
gtest-death-test.patch
mdrun-test-timeout.patch
From 7f0de667ba7269c3d17e080431ebf1ec6fd2feca Mon Sep 17 00:00:00 2001
From: Roland Schulz <roland.schulz@intel.com>
Date: Wed, 27 Dec 2017 10:59:04 -0800
Subject: [PATCH] Move GMX_ALIGNED to simd module
Allows us to test up to SIMD width and avoid testing
alignmnet larger than this. Also fix overalignment
in pairs.
Fixes #2365
Change-Id: I4793adf31d186eade8a1fd8c920ab75c685ad53f
---
diff --git a/docs/doxygen/suppressions.txt b/docs/doxygen/suppressions.txt
index 9e8b9c3..a8ea07c 100644
--- a/docs/doxygen/suppressions.txt
+++ b/docs/doxygen/suppressions.txt
@@ -16,9 +16,7 @@
# making the right #includes should be on the source file that uses these.
# TODO: # Stop using the preprocessor for meta-programming!
src/gromacs/ewald/pme-simd4.h: warning: should include "pme-simd.h"
-src/gromacs/ewald/pme-spline-work.cpp: warning: includes "simd.h" unnecessarily
src/gromacs/ewald/pme-spline-work.h: warning: includes "simd.h" unnecessarily
-src/gromacs/ewald/pme-spread.cpp: warning: includes "simd.h" unnecessarily
src/gromacs/gmxlib/nonbonded/nb_kernel_sparc64_hpc_ace_double/kernelutil_sparc64_hpc_ace_double.h: warning: includes "simd.h" unnecessarily
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_inner.h: warning: should include "simd.h"
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_outer.h: warning: should include "simd.h"
diff --git a/src/gromacs/listed-forces/pairs.cpp b/src/gromacs/listed-forces/pairs.cpp
index 6d0d179..2580637 100644
--- a/src/gromacs/listed-forces/pairs.cpp
+++ b/src/gromacs/listed-forces/pairs.cpp
@@ -550,11 +550,17 @@
T twelve(12);
T ef(scale_factor);
- const int align = 16;
- GMX_ASSERT(pack_size <= align, "align should be increased");
- GMX_ALIGNED(int, align) ai[pack_size];
- GMX_ALIGNED(int, align) aj[pack_size];
- GMX_ALIGNED(real, align) coeff[3*pack_size];
+#if GMX_SIMD_HAVE_REAL
+ // No matter what the pack_size is, we only need temporary storage to be
+ // aligned to match the SIMD load/store requirements.
+ GMX_ALIGNED(std::int32_t, GMX_SIMD_REAL_WIDTH) ai[pack_size];
+ GMX_ALIGNED(std::int32_t, GMX_SIMD_REAL_WIDTH) aj[pack_size];
+ GMX_ALIGNED(real, GMX_SIMD_REAL_WIDTH) coeff[3*pack_size];
+#else
+ std::int32_t ai[pack_size];
+ std::int32_t aj[pack_size];
+ real coeff[3*pack_size];
+#endif
/* nbonds is #pairs*nfa1, here we step pack_size pairs */
for (int i = 0; i < nbonds; i += pack_size*nfa1)
diff --git a/src/gromacs/simd/simd.h b/src/gromacs/simd/simd.h
index 673cfa3..0aa4872 100644
--- a/src/gromacs/simd/simd.h
+++ b/src/gromacs/simd/simd.h
@@ -99,6 +99,24 @@
struct SimdDInt32Tag {};
}
+/*! \def GMX_ALIGNED(type, alignment)
+ * \brief
+ * Declare variable with data alignment
+ *
+ * \param[in] type Type of variable
+ * \param[in] alignment Alignment in multiples of type
+ *
+ * Typical usage:
+ * \code
+ GMX_ALIGNED(real, GMX_SIMD_REAL_WIDTH) buf[...];
+ \endcode
+ */
+
+// We rely on C++11. This will for instance work for MSVC2015 and later.
+// If you get an error here, find out what attribute to use to get your compiler to align
+// data properly and add it as a case.
+#define GMX_ALIGNED(type, alignment) alignas(alignment*sizeof(type)) type
+
/*! \name SIMD predefined macros to describe high-level capabilities
*
* These macros are used to describe the features available in default
diff --git a/src/gromacs/simd/tests/simd.cpp b/src/gromacs/simd/tests/simd.cpp
index d07621b..d939481 100644
--- a/src/gromacs/simd/tests/simd.cpp
+++ b/src/gromacs/simd/tests/simd.cpp
@@ -121,6 +121,34 @@
#endif
#if GMX_SIMD_HAVE_REAL
+TEST(BasedefinitionsTest, GmxAlignedDeclaresAlignedVariable)
+{
+ GMX_ALIGNED(real, 2) r1;
+ GMX_ALIGNED(real, 4) r2;
+ GMX_ALIGNED(real, GMX_SIMD_REAL_WIDTH) r3;
+
+ std::uint64_t addr1 = reinterpret_cast<std::uint64_t>(&r1);
+ std::uint64_t addr2 = reinterpret_cast<std::uint64_t>(&r2);
+ std::uint64_t addr3 = reinterpret_cast<std::uint64_t>(&r3);
+
+ EXPECT_EQ(0, addr1 % 2);
+ EXPECT_EQ(0, addr2 % 4);
+ EXPECT_EQ(0, addr3 % GMX_SIMD_REAL_WIDTH);
+
+ GMX_ALIGNED(std::int32_t, 2) i1;
+ GMX_ALIGNED(std::int32_t, 4) i2;
+ GMX_ALIGNED(std::int32_t, GMX_SIMD_REAL_WIDTH) i3;
+
+ addr1 = reinterpret_cast<std::uint64_t>(&i1);
+ addr2 = reinterpret_cast<std::uint64_t>(&i2);
+ addr3 = reinterpret_cast<std::uint64_t>(&i3);
+
+ EXPECT_EQ(0, addr1 % 2);
+ EXPECT_EQ(0, addr2 % 4);
+ EXPECT_EQ(0, addr3 % GMX_SIMD_REAL_WIDTH);
+}
+
+
::std::vector<real>
simdReal2Vector(const SimdReal simd)
{
diff --git a/src/gromacs/utility/basedefinitions.h b/src/gromacs/utility/basedefinitions.h
index 1c3e36c..a1638ef 100644
--- a/src/gromacs/utility/basedefinitions.h
+++ b/src/gromacs/utility/basedefinitions.h
@@ -226,24 +226,6 @@
#endif
#endif
-/*! \def GMX_ALIGNED(type, alignment)
- * \brief
- * Declare variable with data alignment
- *
- * \param[in] type Type of variable
- * \param[in] alignment Alignment in multiples of type
- *
- * Typical usage:
- * \code
- GMX_ALIGNED(real, GMX_SIMD_REAL_WIDTH) buf[...];
- \endcode
- */
-
-// We rely on C++11. This will for instance work for MSVC2015 and later.
-// If you get an error here, find out what attribute to use to get your compiler to align
-// data properly and add it as a case.
-#define GMX_ALIGNED(type, alignment) alignas(alignment*sizeof(type)) type
-
/*! \brief
* Macro to explicitly ignore an unused value.
*
diff --git a/src/gromacs/utility/tests/CMakeLists.txt b/src/gromacs/utility/tests/CMakeLists.txt
index 57cf2a1..74ed8f4 100644
--- a/src/gromacs/utility/tests/CMakeLists.txt
+++ b/src/gromacs/utility/tests/CMakeLists.txt
@@ -35,7 +35,6 @@
gmx_add_unit_test(UtilityUnitTests utility-test
alignedallocator.cpp
arrayref.cpp
- basedefinitions.cpp
bitmask32.cpp bitmask64.cpp bitmask128.cpp
keyvaluetreeserializer.cpp
keyvaluetreetransform.cpp
diff --git a/src/gromacs/utility/tests/basedefinitions.cpp b/src/gromacs/utility/tests/basedefinitions.cpp
deleted file mode 100644
index a0223e1..0000000
--- a/src/gromacs/utility/tests/basedefinitions.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * Copyright (c) 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.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-/*! \internal \file
- * \brief Tests for base definitions (only alignment attributes for now)
- *
- * \author Erik Lindahl <erik.lindahl@gmail.com>
- * \ingroup module_utility
- */
-
-#include "gmxpre.h"
-
-#include "gromacs/utility/basedefinitions.h"
-
-#include <cstdint>
-
-#include <gtest/gtest.h>
-
-#include "gromacs/utility/real.h"
-
-namespace gmx
-{
-
-TEST(BasedefinitionsTest, GmxAlignedDeclaresAlignedVariable)
-{
- GMX_ALIGNED(real, 2) r1;
- GMX_ALIGNED(real, 4) r2;
- GMX_ALIGNED(real, 8) r3;
-
- std::uint64_t addr1 = reinterpret_cast<std::uint64_t>(&r1);
- std::uint64_t addr2 = reinterpret_cast<std::uint64_t>(&r2);
- std::uint64_t addr3 = reinterpret_cast<std::uint64_t>(&r3);
-
- EXPECT_EQ(0, addr1 % 2);
- EXPECT_EQ(0, addr2 % 4);
- EXPECT_EQ(0, addr3 % 8);
-
- GMX_ALIGNED(int, 2) i1;
- GMX_ALIGNED(int, 4) i2;
- GMX_ALIGNED(int, 8) i3;
-
- addr1 = reinterpret_cast<std::uint64_t>(&i1);
- addr2 = reinterpret_cast<std::uint64_t>(&i2);
- addr3 = reinterpret_cast<std::uint64_t>(&i3);
-
- EXPECT_EQ(0, addr1 % 2);
- EXPECT_EQ(0, addr2 % 4);
- EXPECT_EQ(0, addr3 % 8);
-}
-
-}
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