From add86cd7f4070958ae993bd8dff0c6d91c9744e8 Mon Sep 17 00:00:00 2001 From: Daniel Richtmann Date: Tue, 1 Feb 2022 21:22:45 +0100 Subject: [PATCH] Abandon ET for clover application, use construct similar to multLink --- Grid/qcd/action/fermion/WilsonCloverHelpers.h | 20 +++++++++++++++++++ .../WilsonCloverFermionImplementation.h | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Grid/qcd/action/fermion/WilsonCloverHelpers.h b/Grid/qcd/action/fermion/WilsonCloverHelpers.h index daf57f78..337af647 100644 --- a/Grid/qcd/action/fermion/WilsonCloverHelpers.h +++ b/Grid/qcd/action/fermion/WilsonCloverHelpers.h @@ -186,6 +186,26 @@ public: return T; } + + template + static accelerator_inline void multClover(_Spinor& phi, const SiteClover& C, const _Spinor& chi) { + auto CC = coalescedRead(C); + mult(&phi, &CC, &chi); + } + + template + inline void multCloverField(_SpinorField& out, const CloverField& C, const _SpinorField& phi) { + const int Nsimd = SiteSpinor::Nsimd(); + autoView(out_v, out, AcceleratorWrite); + autoView(phi_v, phi, AcceleratorRead); + autoView(C_v, C, AcceleratorRead); + typedef decltype(coalescedRead(out_v[0])) calcSpinor; + accelerator_for(sss,out.Grid()->oSites(),Nsimd,{ + calcSpinor tmp; + multClover(tmp,C_v[sss],phi_v(sss)); + coalescedWrite(out_v[sss],tmp); + }); + } }; NAMESPACE_END(Grid); diff --git a/Grid/qcd/action/fermion/implementation/WilsonCloverFermionImplementation.h b/Grid/qcd/action/fermion/implementation/WilsonCloverFermionImplementation.h index fd81af11..e4d2e736 100644 --- a/Grid/qcd/action/fermion/implementation/WilsonCloverFermionImplementation.h +++ b/Grid/qcd/action/fermion/implementation/WilsonCloverFermionImplementation.h @@ -243,12 +243,12 @@ void WilsonCloverFermion::MooeeInternal(const FermionField &in, FermionFie { Clover = (inv) ? &CloverTermInvDagEven : &CloverTermDagEven; } - out = *Clover * in; + Helpers::multCloverField(out, *Clover, in); } else { Clover = (inv) ? &CloverTermInv : &CloverTerm; - out = adj(*Clover) * in; + Helpers::multCloverField(out, *Clover, in); // don't bother with adj, hermitian anyway } } else @@ -266,13 +266,13 @@ void WilsonCloverFermion::MooeeInternal(const FermionField &in, FermionFie // std::cout << "Calling clover term Even" << std::endl; Clover = (inv) ? &CloverTermInvEven : &CloverTermEven; } - out = *Clover * in; + Helpers::multCloverField(out, *Clover, in); // std::cout << GridLogMessage << "*Clover.Checkerboard() " << (*Clover).Checkerboard() << std::endl; } else { Clover = (inv) ? &CloverTermInv : &CloverTerm; - out = *Clover * in; + Helpers::multCloverField(out, *Clover, in); } } } // MooeeInternal