#ifndef ROOFIT_BATCHCOMPUTE_ROOBATCHCOMPUTE_H #define ROOFIT_BATCHCOMPUTE_ROOBATCHCOMPUTE_H #include "RooSpan.h" #include "RooVDTHeaders.h" #include "RunContext.h" #include "BracketAdapter.h" #include "DllImport.h" //for R__EXTERN, needed for windows class RooAbsReal; class RooListProxy; /** * Namespace for dispatching RooFit computations to various backends. * * This namespace contains an interface for providing high-performance computation functions for use in RooAbsReal::evaluateSpan(), * see RooBatchComputeInterface. * * Furthermore, several implementations of this interface can be created, which reside in RooBatchCompute::RF_ARCH, where * RF_ARCH may be replaced by the architecture that this implementation targets, e.g. SSE, AVX, etc. * * Using the pointer RooBatchCompute::dispatch, a computation request can be dispatched to the fastest backend that is available * on a specific platform. */ namespace RooBatchCompute { /** * \brief The interface which should be implemented to provide optimised computation functions for implementations of RooAbsReal::evaluateSpan(). * * This interface contains the signatures of the compute functions of every PDF that has an optimised implementation available. * These are the functions that perform the actual computations in batches. * * Several implementations of this interface may be provided, e.g. SSE, AVX, AVX2 etc. At run time, the fastest implementation of this interface * is selected, and using a virtual call, the computation is dispatched to the best backend. * * \see RooBatchCompute::dispatch, RooBatchComputeClass, RF_ARCH */ class RooBatchComputeInterface { public: virtual ~RooBatchComputeInterface() = default; virtual RooSpan computeArgusBG(const RooAbsReal*, RunContext&, RooSpan m, RooSpan m0, RooSpan c, RooSpan p) = 0; virtual void computeBernstein(size_t batchSize, double * __restrict output, const double * __restrict const xData, double xmin, double xmax, std::vector coef) = 0; virtual RooSpan computeBifurGauss(const RooAbsReal*, RunContext&, RooSpan x, RooSpan mean, RooSpan sigmaL, RooSpan sigmaR) = 0; virtual RooSpan computeBukin(const RooAbsReal*, RunContext&, RooSpan x, RooSpan Xp, RooSpan sigp, RooSpan xi, RooSpan rho1, RooSpan rho2) = 0; virtual RooSpan computeBreitWigner(const RooAbsReal*, RunContext&, RooSpan x, RooSpan mean, RooSpan width) = 0; virtual RooSpan computeCBShape(const RooAbsReal*, RunContext&, RooSpan m, RooSpan m0, RooSpan sigma, RooSpan alpha, RooSpan n) = 0; virtual void computeChebychev(size_t batchSize, double * __restrict output, const double * __restrict const xData, double xmin, double xmax, std::vector coef) = 0; virtual RooSpan computeChiSquare(const RooAbsReal*, RunContext&, RooSpan x, RooSpan ndof) = 0; virtual RooSpan computeDstD0BG(const RooAbsReal*, RunContext&, RooSpan dm, RooSpan dm0, RooSpan C, RooSpan A, RooSpan B) = 0; virtual RooSpan computeExponential(const RooAbsReal*, RunContext&, RooSpan x, RooSpan c) = 0; virtual RooSpan computeGamma(const RooAbsReal*, RunContext&, RooSpan x, RooSpan gamma, RooSpan beta, RooSpan mu) = 0; virtual RooSpan computeGaussian(const RooAbsReal*, RunContext&, RooSpan x, RooSpan mean, RooSpan sigma) = 0; virtual RooSpan computeJohnson(const RooAbsReal*, RunContext&, RooSpan mass, RooSpan mu, RooSpan lambda, RooSpan gamma, RooSpan delta, double massThreshold) = 0; virtual RooSpan computeLandau(const RooAbsReal*, RunContext&, RooSpan x, RooSpan mean, RooSpan sigma) = 0; virtual RooSpan computeLognormal(const RooAbsReal*, RunContext&, RooSpan x, RooSpan m0, RooSpan k) = 0; virtual RooSpan computeNovosibirsk(const RooAbsReal*, RunContext&, RooSpan x, RooSpan peak, RooSpan width, RooSpan tail) = 0; virtual RooSpan computePoisson(const RooAbsReal*, RunContext&, RooSpan x, RooSpan mean, bool protectNegative, bool noRounding) = 0; virtual void computePolynomial(size_t batchSize, double * __restrict output, const double * __restrict const xData, int lowestOrder, std::vector &coef) = 0; virtual RooSpan computeVoigtian(const RooAbsReal*, RunContext&, RooSpan x, RooSpan mean, RooSpan width, RooSpan sigma) = 0; }; /** * This dispatch pointer points to an implementation of the compute library, provided one has been loaded. * Using a virtual call, computation requests are dispatched to backends with architecture-specific functions * such as SSE, AVX, AVX2, etc. * * \see RooBatchComputeInterface, RooBatchComputeClass, RF_ARCH */ R__EXTERN RooBatchComputeInterface* dispatch; } #endif