1 #ifndef USE_LEGACY_DSLASH
3 #include <gauge_field.h>
4 #include <color_spinor_field.h>
5 #include <clover_field.h>
9 #include <dslash_policy.cuh>
10 #include <kernels/dslash_wilson_clover_hasenbusch_twist.cuh>
13 This is the Wilson-clover linear operator
19 template <typename Arg> class WilsonCloverHasenbuschTwist : public Dslash<cloverHasenbusch, Arg>
21 using Dslash = Dslash<cloverHasenbusch, Arg>;
26 WilsonCloverHasenbuschTwist(Arg &arg, const ColorSpinorField &out, const ColorSpinorField &in) :
27 Dslash(arg, out, in) {}
29 void apply(const qudaStream_t &stream)
31 TuneParam tp = tuneLaunch(*this, getTuning(), getVerbosity());
34 Dslash::template instantiate<packShmem, true>(tp, stream);
36 errorQuda("Wilson-clover - Hasenbusch Twist operator only defined for xpay=true");
39 long long flops() const
41 int clover_flops = 504;
42 long long flops = Dslash::flops();
43 switch (arg.kernel_type) {
47 flops += clover_flops * in.Volume();
49 // -mu * (i gamma_5 A) (A x)
50 flops += ((clover_flops + 48) * in.Volume());
53 default: break; // all clover flops are in the interior kernel
58 long long bytes() const
60 int clover_bytes = 72 * in.Precision() + (isFixed<typename Arg::Float>::value ? 2 * sizeof(float) : 0);
62 long long bytes = Dslash::bytes();
63 switch (arg.kernel_type) {
66 case KERNEL_POLICY: bytes += clover_bytes * in.Volume(); break;
74 template <typename Float, int nColor, QudaReconstructType recon> struct WilsonCloverHasenbuschTwistApply {
76 inline WilsonCloverHasenbuschTwistApply(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U,
77 const CloverField &A, double a, double b, const ColorSpinorField &x,
78 int parity, bool dagger, const int *comm_override, TimeProfile &profile)
80 constexpr int nDim = 4;
81 WilsonCloverHasenbuschTwistArg<Float, nColor, nDim, recon> arg(out, in, U, A, a, b, x, parity, dagger, comm_override);
82 WilsonCloverHasenbuschTwist<decltype(arg)> wilson(arg, out, in);
84 dslash::DslashPolicyTune<decltype(wilson)> policy(
85 wilson, const_cast<cudaColorSpinorField *>(static_cast<const cudaColorSpinorField *>(&in)), in.VolumeCB(),
86 in.GhostFaceCB(), profile);
91 // Apply the Wilson-clover operator
92 // out(x) = M*in = (A(x) + a * \sum_mu U_{-\mu}(x)in(x+mu) + U^\dagger_mu(x-mu)in(x-mu))
93 // Uses the kappa normalization for the Wilson operator.
94 void ApplyWilsonCloverHasenbuschTwist(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U,
95 const CloverField &A, double a, double b, const ColorSpinorField &x, int parity,
96 bool dagger, const int *comm_override, TimeProfile &profile)
98 #ifdef GPU_CLOVER_HASENBUSCH_TWIST
99 instantiate<WilsonCloverHasenbuschTwistApply>(out, in, U, A, a, b, x, parity, dagger, comm_override, profile);
101 errorQuda("Clover Hasensbuch Twist dslash has not been built");