From dd934ad057e5ad5a5bc9e9a2b4340b4ac16c01d3 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 8 Oct 2015 17:27:01 +0200 Subject: [PATCH] Re-enable vectorization of LinSpaced, plus some cleaning --- Eigen/src/Core/CoreEvaluators.h | 4 ++-- Eigen/src/Core/GeneralProduct.h | 14 +++++++------- Eigen/src/Core/Inverse.h | 2 -- Eigen/src/Core/ProductEvaluators.h | 2 +- Eigen/src/Core/functors/NullaryFunctors.h | 3 --- test/nullary.cpp | 2 ++ 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h index 74908bd45..c0563f534 100644 --- a/Eigen/src/Core/CoreEvaluators.h +++ b/Eigen/src/Core/CoreEvaluators.h @@ -321,8 +321,8 @@ struct evaluator > & ( HereditaryBits | (functor_has_linear_access::ret ? LinearAccessBit : 0) | (functor_traits::PacketAccess ? PacketAccessBit : 0))) - | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), // FIXME EvalBeforeNestingBit should be needed anymore - Alignment = 0 // FIXME alignment should not matter here, perhaps we could set it to AlignMax?? + | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), + Alignment = AlignedMax }; EIGEN_DEVICE_FUNC explicit evaluator(const XprType& n) diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index 475d6f4aa..4a5054592 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -160,7 +160,7 @@ template<> struct product_type_selector { enum namespace internal { template -struct gemv_dense_sense_selector; +struct gemv_dense_selector; } // end namespace internal @@ -204,19 +204,19 @@ struct gemv_static_vector_if // The vector is on the left => transposition template -struct gemv_dense_sense_selector +struct gemv_dense_selector { template static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) { Transpose destT(dest); enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; - gemv_dense_sense_selector + gemv_dense_selector ::run(rhs.transpose(), lhs.transpose(), destT, alpha); } }; -template<> struct gemv_dense_sense_selector +template<> struct gemv_dense_selector { template static inline void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) @@ -292,7 +292,7 @@ template<> struct gemv_dense_sense_selector } }; -template<> struct gemv_dense_sense_selector +template<> struct gemv_dense_selector { template static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) @@ -345,7 +345,7 @@ template<> struct gemv_dense_sense_selector } }; -template<> struct gemv_dense_sense_selector +template<> struct gemv_dense_selector { template static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) @@ -357,7 +357,7 @@ template<> struct gemv_dense_sense_selector } }; -template<> struct gemv_dense_sense_selector +template<> struct gemv_dense_selector { template static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) diff --git a/Eigen/src/Core/Inverse.h b/Eigen/src/Core/Inverse.h index b359e1287..8e6b275f7 100644 --- a/Eigen/src/Core/Inverse.h +++ b/Eigen/src/Core/Inverse.h @@ -12,8 +12,6 @@ namespace Eigen { -// TODO move the general declaration in Core, and rename this file DenseInverseImpl.h, or something like this... - template class InverseImpl; namespace internal { diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h index 529870300..c2a7314bd 100755 --- a/Eigen/src/Core/ProductEvaluators.h +++ b/Eigen/src/Core/ProductEvaluators.h @@ -313,7 +313,7 @@ struct generic_product_impl template static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) { - internal::gemv_dense_sense_selector::HasUsableDirectAccess) >::run(lhs, rhs, dst, alpha); diff --git a/Eigen/src/Core/functors/NullaryFunctors.h b/Eigen/src/Core/functors/NullaryFunctors.h index 130f20868..55d45f26f 100644 --- a/Eigen/src/Core/functors/NullaryFunctors.h +++ b/Eigen/src/Core/functors/NullaryFunctors.h @@ -26,7 +26,6 @@ struct scalar_constant_op { }; template struct functor_traits > -// FIXME replace this packet test by a safe one { enum { Cost = 1, PacketAccess = packet_traits::Vectorizable, IsRepeatable = true }; }; template struct scalar_identity_op { @@ -135,14 +134,12 @@ template struct linspa // This proxy object handles the actual required temporaries, the different // implementations (random vs. sequential access) as well as the // correct piping to size 2/4 packet operations. - // TODO find a way to make the packet type configurable const linspaced_op_impl impl; }; // all functors allow linear access, except scalar_identity_op. So we fix here a quick meta // to indicate whether a functor allows linear access, just always answering 'yes' except for // scalar_identity_op. -// FIXME move this to functor_traits adding a functor_default template struct functor_has_linear_access { enum { ret = 1 }; }; template struct functor_has_linear_access > { enum { ret = 0 }; }; diff --git a/test/nullary.cpp b/test/nullary.cpp index 2c148e205..4844f2952 100644 --- a/test/nullary.cpp +++ b/test/nullary.cpp @@ -123,6 +123,8 @@ void test_nullary() CALL_SUBTEST_6( testVectorType(Vector3d()) ); CALL_SUBTEST_7( testVectorType(VectorXf(internal::random(1,300))) ); CALL_SUBTEST_8( testVectorType(Vector3f()) ); + CALL_SUBTEST_8( testVectorType(Vector4f()) ); + CALL_SUBTEST_8( testVectorType(Matrix()) ); CALL_SUBTEST_8( testVectorType(Matrix()) ); } }