diff --git a/DataFormats/Math/interface/choleskyInversion.h b/DataFormats/Math/interface/choleskyInversion.h index 2cb4105f86bae..b84e7cc80a120 100644 --- a/DataFormats/Math/interface/choleskyInversion.h +++ b/DataFormats/Math/interface/choleskyInversion.h @@ -20,13 +20,13 @@ namespace math { namespace cholesky { template - inline constexpr void invert11(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert11(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); dst(0, 0) = F(1.0) / src(0, 0); } template - inline constexpr void invert22(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert22(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0) * src(1, 0) * luc0; @@ -40,7 +40,7 @@ namespace math { } template - inline constexpr void invert33(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert33(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0); @@ -64,7 +64,7 @@ namespace math { } template - inline constexpr void invert44(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert44(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0); @@ -100,7 +100,7 @@ namespace math { } template - inline constexpr void invert55(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert55(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0); @@ -155,7 +155,7 @@ namespace math { } template - inline __attribute__((always_inline)) constexpr void invert66(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert66(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0); @@ -297,7 +297,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert22(src, dst); symmetrize22(dst); } @@ -305,7 +305,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert33(src, dst); symmetrize33(dst); } @@ -313,7 +313,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert44(src, dst); symmetrize44(dst); } @@ -321,7 +321,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert55(src, dst); symmetrize55(dst); } @@ -329,7 +329,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert66(src, dst); symmetrize66(dst); } @@ -337,7 +337,8 @@ namespace math { // Eigen interface template - inline constexpr void invert(Eigen::DenseBase const& src, Eigen::DenseBase& dst) { + inline constexpr void __attribute__((always_inline)) + invert(Eigen::DenseBase const& src, Eigen::DenseBase& dst) { using M1 = Eigen::DenseBase; using M2 = Eigen::DenseBase; Inverter::eval(src, dst); diff --git a/DataFormats/Math/test/CholeskyInvert_t.cpp b/DataFormats/Math/test/CholeskyInvert_t.cpp index c5dea25231988..de048e3d4455b 100644 --- a/DataFormats/Math/test/CholeskyInvert_t.cpp +++ b/DataFormats/Math/test/CholeskyInvert_t.cpp @@ -94,16 +94,23 @@ void go(bool soa) { for (int kk = 0; kk < NKK; ++kk) { delta -= (std::chrono::high_resolution_clock::now() - start); if (soa) +#ifdef USE_VECTORIZATION_PRAGMA #pragma GCC ivdep #ifdef __clang__ #pragma clang loop vectorize(enable) interleave(enable) +#endif #endif for (unsigned int i = 0; i < SIZE; ++i) { MapMX m(p + i); math::cholesky::invert(m, m); } else +#ifdef USE_VECTORIZATION_PRAGMA #pragma GCC ivdep +#ifdef __clang__ +#pragma clang loop vectorize(enable) interleave(enable) +#endif +#endif for (auto& m : mm) { math::cholesky::invert(m, m); }