mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-01-18 17:31:19 +01:00
The goal of this MR is to implement a generic SIMD backend (packet ops) for Eigen that uses clang vector extensions instead of platform-dependent intrinsics. Ideally, this should make it possible to build Eigen and achieve reasonable speed on any platform that has a recent clang compiler, without having to write any inline assembly or intrinsics. Caveats: * The current implementation is a proof of concept and supports vectorization for float, double, int32_t, and int64_t using fixed-size 512-bit vectors (a somewhat arbitrary choice). I have not done much to tune this for speed yet. * For now, there is no way to enable this other than setting -DEIGEN_VECTORIZE_GENERIC on the command line. * This only compiles with newer versions of clang. I have tested that it compiles and all tests pass with clang 19.1.7. https://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors Closes #2998 and #2997 See merge request libeigen/eigen!2051 Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com> Co-authored-by: Antonio Sánchez <cantonios@google.com>
108 lines
3.0 KiB
Plaintext
108 lines
3.0 KiB
Plaintext
// This file is part of Eigen, a lightweight C++ template library
|
|
// for linear algebra.
|
|
//
|
|
// Copyright (C) 2016 Gael Guennebaud <g.gael@free.fr>
|
|
//
|
|
// This Source Code Form is subject to the terms of the Mozilla
|
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
#ifndef EIGEN_SPECIALFUNCTIONS_MODULE_H
|
|
#define EIGEN_SPECIALFUNCTIONS_MODULE_H
|
|
|
|
#include <math.h>
|
|
|
|
#include "../../Eigen/Core"
|
|
|
|
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
|
|
|
|
namespace Eigen {
|
|
|
|
/**
|
|
* \defgroup SpecialFunctions_Module Special math functions module
|
|
*
|
|
* This module features additional coefficient-wise math functions available
|
|
* within the numext:: namespace for the scalar version, and as method and/or free
|
|
* functions of Array. Those include:
|
|
*
|
|
* - erf
|
|
* - erfc
|
|
* - lgamma
|
|
* - igamma
|
|
* - igamma_der_a
|
|
* - gamma_sample_der_alpha
|
|
* - igammac
|
|
* - digamma
|
|
* - ndtri
|
|
* - polygamma
|
|
* - zeta
|
|
* - betainc
|
|
*
|
|
* Bessel Functions
|
|
* - bessel_i0
|
|
* - bessel_i0e
|
|
* - bessel_i1
|
|
* - bessel_i1e
|
|
* - bessel_j0
|
|
* - bessel_j1
|
|
* - bessel_k0
|
|
* - bessel_k0e
|
|
* - bessel_k1
|
|
* - bessel_k1e
|
|
* - bessel_y0
|
|
* - bessel_y1
|
|
*
|
|
* \code
|
|
* #include <unsupported/Eigen/SpecialFunctions>
|
|
* \endcode
|
|
*/
|
|
//@{
|
|
|
|
} // namespace Eigen
|
|
|
|
// IWYU pragma: begin_exports
|
|
#include "src/SpecialFunctions/BesselFunctionsImpl.h"
|
|
#include "src/SpecialFunctions/BesselFunctionsBFloat16.h"
|
|
#include "src/SpecialFunctions/BesselFunctionsHalf.h"
|
|
#include "src/SpecialFunctions/BesselFunctionsPacketMath.h"
|
|
#include "src/SpecialFunctions/BesselFunctionsFunctors.h"
|
|
#include "src/SpecialFunctions/BesselFunctionsArrayAPI.h"
|
|
#include "src/SpecialFunctions/SpecialFunctionsImpl.h"
|
|
#if defined(EIGEN_HIPCC)
|
|
#include "src/SpecialFunctions/HipVectorCompatibility.h"
|
|
#endif
|
|
#include "src/SpecialFunctions/SpecialFunctionsBFloat16.h"
|
|
#include "src/SpecialFunctions/SpecialFunctionsHalf.h"
|
|
#include "src/SpecialFunctions/SpecialFunctionsPacketMath.h"
|
|
#include "src/SpecialFunctions/SpecialFunctionsFunctors.h"
|
|
#include "src/SpecialFunctions/SpecialFunctionsArrayAPI.h"
|
|
|
|
#ifndef EIGEN_VECTORIZE_GENERIC
|
|
// TODO(rmlarsen): Make these work with generic vectorization if possible.
|
|
#if defined EIGEN_VECTORIZE_AVX512
|
|
#include "src/SpecialFunctions/arch/AVX/BesselFunctions.h"
|
|
#include "src/SpecialFunctions/arch/AVX/SpecialFunctions.h"
|
|
#include "src/SpecialFunctions/arch/AVX512/BesselFunctions.h"
|
|
#include "src/SpecialFunctions/arch/AVX512/SpecialFunctions.h"
|
|
#elif defined EIGEN_VECTORIZE_AVX
|
|
#include "src/SpecialFunctions/arch/AVX/BesselFunctions.h"
|
|
#include "src/SpecialFunctions/arch/AVX/SpecialFunctions.h"
|
|
#elif defined EIGEN_VECTORIZE_NEON
|
|
#include "src/SpecialFunctions/arch/NEON/BesselFunctions.h"
|
|
#include "src/SpecialFunctions/arch/NEON/SpecialFunctions.h"
|
|
#endif
|
|
|
|
#if defined EIGEN_VECTORIZE_GPU
|
|
#include "src/SpecialFunctions/arch/GPU/SpecialFunctions.h"
|
|
#endif
|
|
#endif
|
|
// IWYU pragma: end_exports
|
|
|
|
namespace Eigen {
|
|
//@}
|
|
}
|
|
|
|
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
|
|
|
|
#endif // EIGEN_SPECIALFUNCTIONS_MODULE_H
|