1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 17:25:37 +01:00

Removed superfluous implementation of G-parity twist for hand-unrolled kernel from GparityWilsonImpl

This commit is contained in:
Christopher Kelly 2017-08-23 15:05:22 -04:00
parent a0bb8e5b46
commit ce5df177ee
2 changed files with 1 additions and 98 deletions

View File

@ -478,10 +478,7 @@ class GparityWilsonImpl : public ConjugateGaugeImpl<GaugeImplTypes<S, Nrepresent
ImplParams Params; ImplParams Params;
std::vector<SiteSpinor, alignedAllocator<SiteSpinor> > tmp_full; GparityWilsonImpl(const ImplParams &p = ImplParams()) : Params(p){};
std::vector<SiteHalfSpinor, alignedAllocator<SiteHalfSpinor> > tmp_half;
GparityWilsonImpl(const ImplParams &p = ImplParams()) : Params(p), tmp_full(GridThread::GetThreads()), tmp_half(GridThread::GetThreads()){};
bool overlapCommsCompute(void) { return Params.overlapCommsCompute; }; bool overlapCommsCompute(void) { return Params.overlapCommsCompute; };
@ -563,86 +560,6 @@ class GparityWilsonImpl : public ConjugateGaugeImpl<GaugeImplTypes<S, Nrepresent
reg = memory; reg = memory;
} }
template<typename SiteSpinorType>
void GparityTwistPermute(SiteSpinorType &into, const SiteSpinorType &from, const int direction, const int distance, const int perm, GridBase* grid){
#if 0
typedef typename SiteSpinorType::scalar_object sobj;
sobj stmp;
std::vector<sobj> vals(grid->Nsimd());
extract(from,vals);
std::vector<int> icoor;
for(int s=0;s<grid->Nsimd();s++){
grid->iCoorFromIindex(icoor,s);
assert((icoor[direction]==0)||(icoor[direction]==1));
int permute_lane;
if ( distance == 1) {
permute_lane = icoor[direction]?1:0;
} else {
permute_lane = icoor[direction]?0:1;
}
if(perm) permute_lane = !permute_lane;
if ( permute_lane ) {
stmp(0) = vals[s](1);
stmp(1) = vals[s](0);
vals[s] = stmp;
}
}
merge(into,vals);
#else
int permute_type = grid->PermuteType(direction);
typedef typename SiteSpinorType::vector_type vtype;
vtype tmp1, tmp2, tmp3, tmp4;
for(int s=0;s<Ns;s++){
for(int c=0;c<Nrepresentation;c++){
permute(tmp1, from(1)(s)(c), permute_type); //1l 1h -> 1h 1l
exchange(tmp2,tmp3, from(0)(s)(c), tmp1, permute_type); // 0l 0h , 1h 1l -> 0l 1h 0h,1l
permute(tmp4, tmp3, permute_type); //0h,1l -> 1l,0h
if( (distance == 1 && !perm) || (distance == -1 && perm) ){
//Pulled fermion through forwards face, GPBC on upper component
//Need 0= 0l 1h 1= 1l 0h
into(0)(s)(c) = tmp2;
into(1)(s)(c) = tmp4;
}else if( (distance == -1 && !perm) || (distance == 1 && perm) ){
//Pulled fermion through backwards face, GPBC on lower component
//Need 0= 1l 0h 1= 0l 1h
into(0)(s)(c) = tmp4;
into(1)(s)(c) = tmp2;
}else assert(0);
}
}
#endif
}
template<typename SiteSpinorType>
const SiteSpinorType & GparityGetChi(int &g, SiteSpinorType const* in, const int dir, const int f, StencilEntry *SE, StencilImpl &st){
const int mmu = dir % 4;
const int direction = st._directions[dir];
const int sl = st._grid->_simd_layout[direction];
const int perm = SE->_permute;
g = f;
if(SE->_around_the_world && Params.twists[mmu]){
if(sl == 1){ //not SIMD vectorized in G-parity direction so just change the flavor index accessed to implement the twist
g = (f+1) % 2;
return in[SE->_offset];
}else{ //SIMD vectorized in Gparity direction
const int me = omp_get_thread_num();
const int distance = st._distances[dir];
assert(distance == -1 || distance == 1);
SiteSpinorType &tmp = GparityWilsonImpl_helper::getAB<SiteSpinorType, SiteSpinor, SiteHalfSpinor>::ref(tmp_full[me], tmp_half[me]);
GparityTwistPermute<SiteSpinorType>(tmp, in[SE->_offset], direction, distance, perm, st._grid);
return tmp;
}
}else return in[SE->_offset];
}
inline void DoubleStore(GridBase *GaugeGrid,DoubledGaugeField &Uds,const GaugeField &Umu) inline void DoubleStore(GridBase *GaugeGrid,DoubledGaugeField &Uds,const GaugeField &Umu)
{ {
conformable(Uds._grid,GaugeGrid); conformable(Uds._grid,GaugeGrid);

View File

@ -59,14 +59,6 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
{const SiteHalfSpinor &ref(buf[offset]); LOAD_CHI_BODY(F); } {const SiteHalfSpinor &ref(buf[offset]); LOAD_CHI_BODY(F); }
//G-parity implementations using implementation method
#define LOAD_CHIMU_GPARITY_IMPL(DIR,F) \
{ int g; const SiteSpinor & ref = GparityGetChi<SiteSpinor>(g,in._odata.data(),DIR,F,SE,st); LOAD_CHIMU_BODY(g); }
#define LOAD_CHI_GPARITY_IMPL(DIR,F) \
{ int g; const SiteHalfSpinor &ref = GparityGetChi<SiteHalfSpinor>(g,buf,DIR,F,SE,st); LOAD_CHI_BODY(g); }
//G-parity implementations using in-place intrinsic ops //G-parity implementations using in-place intrinsic ops
//1l 1h -> 1h 1l //1l 1h -> 1h 1l
@ -156,13 +148,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
} }
//#define LOAD_CHI_GPARITY(DIR,F) LOAD_CHI_GPARITY_IMPL(DIR,F)
#define LOAD_CHI_GPARITY(DIR,F) LOAD_CHI_GPARITY_INPLACE_TWIST(DIR,F) #define LOAD_CHI_GPARITY(DIR,F) LOAD_CHI_GPARITY_INPLACE_TWIST(DIR,F)
//#define LOAD_CHIMU_GPARITY(DIR,F) LOAD_CHIMU_GPARITY_IMPL(DIR,F)
#define LOAD_CHIMU_GPARITY(DIR,F) LOAD_CHIMU_GPARITY_INPLACE_TWIST(DIR,F) #define LOAD_CHIMU_GPARITY(DIR,F) LOAD_CHIMU_GPARITY_INPLACE_TWIST(DIR,F)
// To splat or not to splat depends on the implementation // To splat or not to splat depends on the implementation