A64fx setup

This commit is contained in:
camierjs
2020-12-28 09:38:49 -08:00
parent de9fb83efe
commit 21bb338da4
4 changed files with 284 additions and 16 deletions
+4 -4
View File
@@ -9,7 +9,6 @@
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
// Support out-of-source builds: if MFEM_CONFIG_FILE is defined, include it.
//
// Otherwise, use the local file: _config.hpp.
@@ -25,7 +24,8 @@
// Common configuration macros
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) || defined(__clang__)
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) || \
defined(__clang__)
#define MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
#endif
@@ -66,6 +66,6 @@
#ifdef MFEM_USE_PUMI
#error Building with PUMI (MFEM_USE_PUMI=YES) requires MPI (MFEM_USE_MPI=YES)
#endif
#endif // MFEM_USE_MPI not defined
#endif // MFEM_USE_MPI not defined
#endif // MFEM_CONFIG_HPP
#endif // MFEM_CONFIG_HPP
+17 -12
View File
@@ -17,9 +17,11 @@
// --- AutoSIMD + specializations with intrinsics
#include "simd/auto.hpp"
#ifdef MFEM_USE_SIMD
#if defined(__VSX__)
#if defined(__aarch64__)
#include "simd/sve.hpp"
#elif defined(__VSX__)
#include "simd/vsx.hpp"
#elif defined (__bgq__)
#elif defined(__bgq__)
#include "simd/qpx.hpp"
#elif defined(__x86_64__) || defined(_M_X64) || defined(_M_IX86)
#include "simd/x86.hpp"
@@ -42,6 +44,9 @@
#elif defined(__AVX512F__)
#define MFEM_SIMD_BYTES 64
#define MFEM_ALIGN_BYTES 64
#elif defined(__AARCH64EL__)
#define MFEM_SIMD_BYTES 64
#define MFEM_ALIGN_BYTES 64
#elif defined(__AVX__) || defined(__VECTOR4DOUBLE__)
#define MFEM_SIMD_BYTES 32
#define MFEM_ALIGN_BYTES 32
@@ -54,14 +59,14 @@
#endif
// derived macros
#define MFEM_ROUNDUP(val,base) ((((val)+(base)-1)/(base))*(base))
#define MFEM_ALIGN_SIZE(size,type) \
MFEM_ROUNDUP(size,(MFEM_ALIGN_BYTES)/sizeof(type))
#define MFEM_ROUNDUP(val, base) ((((val) + (base)-1) / (base)) * (base))
#define MFEM_ALIGN_SIZE(size, type) \
MFEM_ROUNDUP(size, (MFEM_ALIGN_BYTES) / sizeof(type))
namespace mfem
{
template<typename complex_t, typename real_t>
template <typename complex_t, typename real_t>
struct AutoSIMDTraits
{
static const int block_size = MFEM_TEMPLATE_BLOCK_SIZE;
@@ -71,14 +76,14 @@ struct AutoSIMDTraits
static const int batch_size = 1;
static const int simd_size = MFEM_SIMD_BYTES/sizeof(real_t);
static const int simd_size = MFEM_SIMD_BYTES / sizeof(real_t);
typedef AutoSIMD<complex_t, simd_size, MFEM_SIMD_BYTES> vcomplex_t;
typedef AutoSIMD<real_t, simd_size, MFEM_SIMD_BYTES> vreal_t;
typedef AutoSIMD<int, simd_size, simd_size*sizeof(int)> vint_t;
typedef AutoSIMD<int, simd_size, simd_size * sizeof(int)> vint_t;
};
template<typename complex_t, typename real_t>
template <typename complex_t, typename real_t>
struct NoSIMDTraits
{
static const int block_size = MFEM_TEMPLATE_BLOCK_SIZE;
@@ -92,9 +97,9 @@ struct NoSIMDTraits
typedef AutoSIMD<complex_t, simd_size, align_bytes> vcomplex_t;
typedef AutoSIMD<real_t, simd_size, align_bytes> vreal_t;
typedef AutoSIMD<int, simd_size, simd_size*sizeof(int)> vint_t;
typedef AutoSIMD<int, simd_size, simd_size * sizeof(int)> vint_t;
};
} // mfem namespace
} // namespace mfem
#endif // MFEM_SIMD_HPP
#endif // MFEM_SIMD_HPP
+17
View File
@@ -0,0 +1,17 @@
// Copyright (c) 2010-2020, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
#ifndef MFEM_SIMD_SVE_HPP
#define MFEM_SIMD_SVE_HPP
#include "sve512.hpp"
#endif // MFEM_SIMD_SVE_HPP
+246
View File
@@ -0,0 +1,246 @@
// Copyright (c) 2010-2020, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
#ifndef MFEM_SIMD_SVE512_HPP
#define MFEM_SIMD_SVE512_HPP
#if defined(__AARCH64EL__) || 1
#include "../../config/tconfig.hpp"
namespace mfem
{
template <typename,int,int> struct AutoSIMD;
template <> struct AutoSIMD<double,2,16>
{
typedef double scalar_type;
static constexpr int size = 2;
static constexpr int align_bytes = 16;
union
{
vector double vd;
double vec[size];
};
inline MFEM_ALWAYS_INLINE double &operator[](int i)
{
return vec[i];
}
inline MFEM_ALWAYS_INLINE const double &operator[](int i) const
{
return vec[i];
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator=(const AutoSIMD &v)
{
vd = v.vd;
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator=(const double &e)
{
vd = vec_splats(e);
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator+=(const AutoSIMD &v)
{
vd = vec_add(vd,v.vd);
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator+=(const double &e)
{
vd = vec_add(vd,vec_splats(e));
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator-=(const AutoSIMD &v)
{
vd = vec_sub(vd,v.vd);
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator-=(const double &e)
{
vd = vec_sub(vd,vec_splats(e));
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator*=(const AutoSIMD &v)
{
vd = vec_mul(vd,v.vd);
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator*=(const double &e)
{
vd = vec_mul(vd,vec_splats(e));
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator/=(const AutoSIMD &v)
{
vd = vec_div(vd,v.vd);
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &operator/=(const double &e)
{
vd = vec_div(vd,vec_splats(e));
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD operator-() const
{
AutoSIMD r;
r.vd = vec_neg(vd);
return r;
}
inline MFEM_ALWAYS_INLINE AutoSIMD operator+(const AutoSIMD &v) const
{
AutoSIMD r;
r.vd = vec_add(vd,v.vd);
return r;
}
inline MFEM_ALWAYS_INLINE AutoSIMD operator+(const double &e) const
{
AutoSIMD r;
r.vd = vec_add(vd, vec_splats(e));
return r;
}
inline MFEM_ALWAYS_INLINE AutoSIMD operator-(const AutoSIMD &v) const
{
AutoSIMD r;
r.vd = vec_sub(vd,v.vd);
return r;
}
inline MFEM_ALWAYS_INLINE AutoSIMD operator-(const double &e) const
{
AutoSIMD r;
r.vd = vec_sub(vd, vec_splats(e));
return r;
}
inline MFEM_ALWAYS_INLINE AutoSIMD operator*(const AutoSIMD &v) const
{
AutoSIMD r;
r.vd = vec_mul(vd,v.vd);
return r;
}
inline MFEM_ALWAYS_INLINE AutoSIMD operator*(const double &e) const
{
AutoSIMD r;
r.vd = vec_mul(vd, vec_splats(e));
return r;
}
inline MFEM_ALWAYS_INLINE AutoSIMD operator/(const AutoSIMD &v) const
{
AutoSIMD r;
r.vd = vec_div(vd,v.vd);
return r;
}
inline MFEM_ALWAYS_INLINE AutoSIMD operator/(const double &e) const
{
AutoSIMD r;
r.vd = vec_div(vd, vec_splats(e));
return r;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &fma(const AutoSIMD &v, const AutoSIMD &w)
{
vd = vec_madd(w.vd,vd,v.vd);
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &fma(const AutoSIMD &v, const double &e)
{
vd = vec_madd(v.vd,vec_splats(e),vd);
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &fma(const double &e, const AutoSIMD &v)
{
vd = vec_madd(vec_splats(e),v.vd,vd);
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &mul(const AutoSIMD &v, const AutoSIMD &w)
{
vd = vec_mul(v.vd,w.vd);
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &mul(const AutoSIMD &v, const double &e)
{
vd = vec_mul(v.vd,vec_splats(e));
return *this;
}
inline MFEM_ALWAYS_INLINE AutoSIMD &mul(const double &e, const AutoSIMD &v)
{
vd = vec_mul(vec_splats(e),v.vd);
return *this;
}
};
inline MFEM_ALWAYS_INLINE
AutoSIMD<double,2,16> operator+(const double &e,
const AutoSIMD<double,2,16> &v)
{
AutoSIMD<double,2,16> r;
r.vd = vec_add(vec_splats(e),v.vd);
return r;
}
inline MFEM_ALWAYS_INLINE
AutoSIMD<double,2,16> operator-(const double &e,
const AutoSIMD<double,2,16> &v)
{
AutoSIMD<double,2,16> r;
r.vd = vec_sub(vec_splats(e),v.vd);
return r;
}
inline MFEM_ALWAYS_INLINE
AutoSIMD<double,2,16> operator*(const double &e,
const AutoSIMD<double,2,16> &v)
{
AutoSIMD<double,2,16> r;
r.vd = vec_mul(vec_splats(e),v.vd);
return r;
}
inline MFEM_ALWAYS_INLINE
AutoSIMD<double,2,16> operator/(const double &e,
const AutoSIMD<double,2,16> &v)
{
AutoSIMD<double,2,16> r;
r.vd = vec_div(vec_splats(e),v.vd);
return r;
}
} // namespace mfem
#endif // __AARCH64EL__
#endif // MFEM_SIMD_SVE512_HPP