fix bug introduced yesterday preventing vectorization of vectors when the storage order is not "the right one".

expand a little the vectorization_logic test and backport EIGEN_DEBUG_ASSIGN.
This commit is contained in:
Benoit Jacob 2010-06-22 09:24:07 -04:00
parent eaa81c135a
commit e7b6a4bcba
3 changed files with 30 additions and 1 deletions

View File

@ -90,6 +90,28 @@ public:
? ( int(MayUnrollCompletely) && int(DstIsAligned) ? int(CompleteUnrolling) : int(NoUnrolling) )
: int(NoUnrolling)
};
#ifdef EIGEN_DEBUG_ASSIGN
#define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
static void debug()
{
EIGEN_DEBUG_VAR(DstIsAligned)
EIGEN_DEBUG_VAR(SrcIsAligned)
EIGEN_DEBUG_VAR(SrcAlignment)
EIGEN_DEBUG_VAR(InnerSize)
EIGEN_DEBUG_VAR(InnerMaxSize)
EIGEN_DEBUG_VAR(PacketSize)
EIGEN_DEBUG_VAR(MightVectorize)
EIGEN_DEBUG_VAR(MayInnerVectorize)
EIGEN_DEBUG_VAR(MayLinearVectorize)
EIGEN_DEBUG_VAR(MaySliceVectorize)
EIGEN_DEBUG_VAR(Vectorization)
EIGEN_DEBUG_VAR(UnrollingLimit)
EIGEN_DEBUG_VAR(MayUnrollCompletely)
EIGEN_DEBUG_VAR(MayUnrollInner)
EIGEN_DEBUG_VAR(Unrolling)
}
#endif
};
/***************************************************************************
@ -400,6 +422,9 @@ template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>
::lazyAssign(const MatrixBase<OtherDerived>& other)
{
#ifdef EIGEN_DEBUG_ASSIGN
ei_assign_traits<Derived, OtherDerived>::debug();
#endif
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
EIGEN_STATIC_ASSERT((ei_is_same_type<typename Derived::Scalar, typename OtherDerived::Scalar>::ret),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)

View File

@ -94,7 +94,9 @@ class ei_compute_matrix_flags
{
enum {
row_major_bit = Options&RowMajor ? RowMajorBit : 0,
inner_max_size = row_major_bit ? MaxCols : MaxRows,
inner_max_size = int(MaxRows==1) ? int(MaxCols)
: int(MaxCols==1) ? int(MaxRows)
: int(row_major_bit) ? int(MaxCols) : int(MaxRows),
is_big = inner_max_size == Dynamic,
storage_has_fixed_size = MaxRows != Dynamic && MaxCols != Dynamic,
storage_has_aligned_fixed_size = storage_has_fixed_size

View File

@ -85,6 +85,8 @@ void test_vectorization_logic()
VERIFY(test_assign(MatrixXf(10,10),MatrixXf(20,20).block(10,10,2,3),
SliceVectorization,NoUnrolling));
VERIFY(test_assign(VectorXf(10),VectorXf(10)+VectorXf(10),
LinearVectorization,NoUnrolling));
VERIFY(test_sum(VectorXf(10),
LinearVectorization,NoUnrolling));