mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-09 23:45:36 +00:00
Control scalar execution or vector under generic. Disable Eigen vectorisation on powerpc / SUmmit
This commit is contained in:
parent
6411caad67
commit
a8a0bb85cc
14
configure.ac
14
configure.ac
@ -234,6 +234,20 @@ AC_ARG_ENABLE([gen-simd-width],
|
||||
[ac_gen_simd_width=$enable_gen_simd_width],
|
||||
[ac_gen_simd_width=32])
|
||||
|
||||
AC_ARG_ENABLE([gen-scalar],
|
||||
[AS_HELP_STRING([--enable-gen-scalar=yes|no],
|
||||
[enable generic scalar implementation])],
|
||||
[ac_gen_scalar=$enable_gen_scalar],
|
||||
[ac_gen_scalar=no])
|
||||
|
||||
case ${ac_gen_scalar} in
|
||||
yes)
|
||||
AC_DEFINE([GENERIC_SCALAR],[1],[Use scalar data parallel loops])
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
##################### Compiler dependent choices
|
||||
case ${CXX} in
|
||||
nvcc)
|
||||
|
@ -29,9 +29,10 @@ Author: Antonin Portelli <antonin.portelli@me.com>
|
||||
|
||||
static_assert(GEN_SIMD_WIDTH % 16u == 0, "SIMD vector size is not an integer multiple of 16 bytes");
|
||||
|
||||
//#define VECTOR_LOOPS
|
||||
#undef VECTOR_LOOPS
|
||||
|
||||
// playing with compiler pragmas
|
||||
|
||||
#ifdef VECTOR_LOOPS
|
||||
#ifdef __clang__
|
||||
#define VECTOR_FOR(i, w, inc) \
|
||||
@ -53,6 +54,31 @@ static_assert(GEN_SIMD_WIDTH % 16u == 0, "SIMD vector size is not an integer mul
|
||||
NAMESPACE_BEGIN(Grid);
|
||||
NAMESPACE_BEGIN(Optimization);
|
||||
|
||||
#ifdef GENERIC_SCALAR
|
||||
|
||||
// type traits giving the number of elements for each vector type
|
||||
template <typename T> struct W;
|
||||
template <> struct W<double> {
|
||||
constexpr static unsigned int c = 1;
|
||||
constexpr static unsigned int r = 2;
|
||||
};
|
||||
template <> struct W<float> {
|
||||
constexpr static unsigned int c = 1;
|
||||
constexpr static unsigned int r = 2;
|
||||
};
|
||||
template <> struct W<Integer> {
|
||||
constexpr static unsigned int r = 1;
|
||||
};
|
||||
template <> struct W<uint16_t> {
|
||||
constexpr static unsigned int c = 1;
|
||||
constexpr static unsigned int r = 2;
|
||||
};
|
||||
// SIMD vector types
|
||||
template <typename T>
|
||||
struct vec {
|
||||
T v[W<T>::r];
|
||||
};
|
||||
#else
|
||||
// type traits giving the number of elements for each vector type
|
||||
template <typename T> struct W;
|
||||
template <> struct W<double> {
|
||||
@ -70,12 +96,12 @@ template <> struct W<uint16_t> {
|
||||
constexpr static unsigned int c = GEN_SIMD_WIDTH/4u;
|
||||
constexpr static unsigned int r = GEN_SIMD_WIDTH/2u;
|
||||
};
|
||||
|
||||
// SIMD vector types
|
||||
template <typename T>
|
||||
struct vec {
|
||||
alignas(GEN_SIMD_WIDTH) T v[W<T>::r];
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef vec<float> vecf;
|
||||
typedef vec<double> vecd;
|
||||
|
@ -138,6 +138,7 @@ public:
|
||||
Vector_type v;
|
||||
|
||||
static accelerator_inline constexpr int Nsimd(void) {
|
||||
static_assert( (sizeof(Vector_type) / sizeof(Scalar_type) >= 1), " size mismatch " );
|
||||
return sizeof(Vector_type) / sizeof(Scalar_type);
|
||||
}
|
||||
|
||||
@ -831,13 +832,16 @@ accelerator_inline void precisionChange(vComplexD *out,vComplexH *in,int nvec){
|
||||
accelerator_inline void precisionChange(vComplexF *out,vComplexH *in,int nvec){ precisionChange((vRealF *)out,(vRealH *)in,nvec);}
|
||||
|
||||
// Check our vector types are of an appropriate size.
|
||||
|
||||
#if defined QPX
|
||||
static_assert(2*sizeof(SIMD_Ftype) == sizeof(SIMD_Dtype), "SIMD vector lengths incorrect");
|
||||
static_assert(2*sizeof(SIMD_Ftype) == sizeof(SIMD_Itype), "SIMD vector lengths incorrect");
|
||||
#else
|
||||
#ifndef GENERIC_SCALAR
|
||||
static_assert(sizeof(SIMD_Ftype) == sizeof(SIMD_Dtype), "SIMD vector lengths incorrect");
|
||||
static_assert(sizeof(SIMD_Ftype) == sizeof(SIMD_Itype), "SIMD vector lengths incorrect");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////
|
||||
// Some traits to recognise the types
|
||||
|
Loading…
Reference in New Issue
Block a user