1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-16 23:07:05 +01:00

revert Add/SubTimesI and prefetching in stencil

This reverts commit 9b2699226c.
This commit is contained in:
nmeyer-ur
2020-06-08 12:02:53 +02:00
parent 93a37c8f68
commit 433766ac62
7 changed files with 83 additions and 344 deletions

View File

@ -442,59 +442,6 @@ struct TimesMinusI{
}
};
// alternative implementation using fcadd
// this is not optimal because we have op1 = op2 + TimesMinusI(op3) = op2 - TimesI(op3) etc
// but ideally we have op1 = SubTimesI(op2,op3)
//
// makes performance worse in Benchmark_wilson using MPI
// increases halogtime and gathertime
/*
struct TimesMinusI{
// Complex float
inline vecf operator()(vecf a, vecf b){
pred pg1 = acle<float>::pg1();
vecf z_v = acle<float>::zero();
return svcadd_x(pg1, z_v, a, 270);
}
// Complex double
inline vecd operator()(vecd a, vecd b){
pred pg1 = acle<double>::pg1();
vecd z_v = acle<double>::zero();
return svcadd_x(pg1, z_v, a, 270);
}
};
*/
// SVE only, fcadd returns a +- i*b
// a + i * b
struct AddTimesI{
// Complex float
inline vecf operator()(vecf a, vecf b){
pred pg1 = acle<float>::pg1();
return svcadd_x(pg1, a, b, 90);
}
// Complex double
inline vecd operator()(vecd a, vecd b){
pred pg1 = acle<double>::pg1();
return svcadd_x(pg1, a, b, 90);
}
};
// a - i * b
struct SubTimesI{
// Complex float
inline vecf operator()(vecf a, vecf b){
pred pg1 = acle<float>::pg1();
return svcadd_x(pg1, a, b, 270);
}
// Complex double
inline vecd operator()(vecd a, vecd b){
pred pg1 = acle<double>::pg1();
return svcadd_x(pg1, a, b, 270);
}
};
struct TimesI{
// Complex float
inline vecf operator()(vecf a, vecf b){
@ -518,33 +465,6 @@ struct TimesI{
}
};
// alternative implementation using fcadd
// this is not optimal because we have op1 = op2 + TimesI(op3) etc
// ideally we have op1 = AddTimesI(op2,op3)
//
// makes performance worse in Benchmark_wilson using MPI
// increases halogtime and gathertime
/*
struct TimesI{
// Complex float
inline vecf operator()(vecf a, vecf b){
pred pg1 = acle<float>::pg1();
vecf z_v = acle<float>::zero();
return svcadd_x(pg1, z_v, a, 90);
}
// Complex double
inline vecd operator()(vecd a, vecd b){
pred pg1 = acle<double>::pg1();
vecd z_v = acle<double>::zero();
return svcadd_x(pg1, z_v, a, 90);
}
};
*/
struct PrecisionChange {
static inline vech StoH (vecf sa, vecf sb) {
pred pg1s = acle<float>::pg1();
@ -827,25 +747,6 @@ typedef veci SIMD_Itype; // Integer type
// prefetch utilities
inline void v_prefetch0(int size, const char *ptr){};
/* PF 256
inline void prefetch_HINT_T0(const char *ptr){
static int64_t last_ptr;
int64_t vptr = reinterpret_cast<std::intptr_t>(ptr) & 0x7fffffffffffff00ll;
if (last_ptr != vptr) {
last_ptr = vptr;
pred pg1 = Optimization::acle<double>::pg1();
svprfd(pg1, reinterpret_cast<int64_t*>(ptr), SV_PLDL1STRM);
svprfd(pg1, ptr, SV_PLDL1STRM);
}
};
*/
/* PF 64
inline void prefetch_HINT_T0(const char *ptr){
pred pg1 = Optimization::acle<double>::pg1();
svprfd(pg1, ptr, SV_PLDL1STRM);
};
*/
inline void prefetch_HINT_T0(const char *ptr){};
// Function name aliases
@ -867,8 +768,5 @@ typedef Optimization::MaddRealPart MaddRealPartSIMD;
typedef Optimization::Conj ConjSIMD;
typedef Optimization::TimesMinusI TimesMinusISIMD;
typedef Optimization::TimesI TimesISIMD;
typedef Optimization::AddTimesI AddTimesISIMD;
typedef Optimization::SubTimesI SubTimesISIMD;
NAMESPACE_END(Grid);

View File

@ -298,7 +298,7 @@ public:
// FIXME -- alias this to an accelerator_inline MAC struct.
// specialize mac for A64FX
// FIXME VLA build error
#if defined(A64FX) || defined(A64FXFIXEDSIZE)
friend accelerator_inline void mac(Grid_simd *__restrict__ y,
const Grid_simd *__restrict__ a,
@ -894,47 +894,6 @@ accelerator_inline Grid_simd<S, V> timesI(const Grid_simd<S, V> &in) {
return in;
}
// -----------------------------------------------------------------------------
// SVE only
///////////////////////
// AddTimesI
///////////////////////
template <class S, class V, IfComplex<S> = 0>
accelerator_inline void addTimesI(Grid_simd<S, V> &ret, const Grid_simd<S, V> &in1, const Grid_simd<S, V> &in2) {
ret.v = binary<V>(in1.v, in2.v, AddTimesISIMD());
}
template <class S, class V, IfComplex<S> = 0>
accelerator_inline Grid_simd<S, V> addTimesI(const Grid_simd<S, V> &in1, const Grid_simd<S, V> &in2) {
Grid_simd<S, V> ret;
ret = addTimesI(in1, in2);
return ret;
}
template <class S, class V, IfNotComplex<S> = 0>
accelerator_inline Grid_simd<S, V> addTimesI(const Grid_simd<S, V> &in1, const Grid_simd<S, V> &in2) {
return in1;
}
///////////////////////
// SubTimesI
///////////////////////
template <class S, class V, IfComplex<S> = 0>
accelerator_inline void subTimesI(Grid_simd<S, V> &ret, const Grid_simd<S, V> &in1, const Grid_simd<S, V> &in2) {
ret.v = binary<V>(in1.v, in2.v, SubTimesISIMD());
}
template <class S, class V, IfComplex<S> = 0>
accelerator_inline Grid_simd<S, V> subTimesI(const Grid_simd<S, V> &in1, const Grid_simd<S, V> &in2) {
Grid_simd<S, V> ret;
ret = subTimesI(in1, in2);
return ret;
}
template <class S, class V, IfNotComplex<S> = 0>
accelerator_inline Grid_simd<S, V> subTimesI(const Grid_simd<S, V> &in1, const Grid_simd<S, V> &in2) {
return in1;
}
// end SVE
// -----------------------------------------------------------------------------
/////////////////////
// Inner, outer
/////////////////////