mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-12 09:23:12 +08:00
Backport changes from old to new expression engines
This commit is contained in:
parent
b29b81a1f4
commit
7fa87a8b12
@ -658,7 +658,7 @@ struct evaluator<Map<PlainObjectType, MapOptions, StrideType> >
|
|||||||
&& ( bool(IsDynamicSize)
|
&& ( bool(IsDynamicSize)
|
||||||
|| HasNoOuterStride
|
|| HasNoOuterStride
|
||||||
|| ( OuterStrideAtCompileTime!=Dynamic
|
|| ( OuterStrideAtCompileTime!=Dynamic
|
||||||
&& ((static_cast<int>(sizeof(Scalar))*OuterStrideAtCompileTime)%16)==0 ) ),
|
&& ((static_cast<int>(sizeof(Scalar))*OuterStrideAtCompileTime)%EIGEN_ALIGN_BYTES)==0 ) ),
|
||||||
Flags0 = evaluator<PlainObjectType>::Flags,
|
Flags0 = evaluator<PlainObjectType>::Flags,
|
||||||
Flags1 = IsAligned ? (int(Flags0) | AlignedBit) : (int(Flags0) & ~AlignedBit),
|
Flags1 = IsAligned ? (int(Flags0) | AlignedBit) : (int(Flags0) & ~AlignedBit),
|
||||||
Flags2 = (bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime))
|
Flags2 = (bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime))
|
||||||
@ -723,8 +723,9 @@ struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
|
|||||||
MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits<Scalar>::size) == 0)
|
MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits<Scalar>::size) == 0)
|
||||||
&& (InnerStrideAtCompileTime == 1)
|
&& (InnerStrideAtCompileTime == 1)
|
||||||
? PacketAccessBit : 0,
|
? PacketAccessBit : 0,
|
||||||
MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0,
|
|
||||||
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0,
|
MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % EIGEN_ALIGN_BYTES) == 0)) ? AlignedBit : 0,
|
||||||
|
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (traits<XprType>::Flags&LinearAccessBit))) ? LinearAccessBit : 0,
|
||||||
FlagsRowMajorBit = XprType::Flags&RowMajorBit,
|
FlagsRowMajorBit = XprType::Flags&RowMajorBit,
|
||||||
Flags0 = evaluator<ArgType>::Flags & ( (HereditaryBits & ~RowMajorBit) |
|
Flags0 = evaluator<ArgType>::Flags & ( (HereditaryBits & ~RowMajorBit) |
|
||||||
DirectAccessBit |
|
DirectAccessBit |
|
||||||
@ -825,7 +826,7 @@ struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /* HasDirectAc
|
|||||||
: mapbase_evaluator<XprType, typename XprType::PlainObject>(block)
|
: mapbase_evaluator<XprType, typename XprType::PlainObject>(block)
|
||||||
{
|
{
|
||||||
// FIXME this should be an internal assertion
|
// FIXME this should be an internal assertion
|
||||||
eigen_assert(EIGEN_IMPLIES(evaluator<XprType>::Flags&AlignedBit, (size_t(block.data()) % 16) == 0) && "data is not aligned");
|
eigen_assert(EIGEN_IMPLIES(evaluator<XprType>::Flags&AlignedBit, (size_t(block.data()) % EIGEN_ALIGN_BYTES) == 0) && "data is not aligned");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -471,6 +471,38 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemmProduct>
|
|||||||
MaxDepthAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(Lhs::MaxColsAtCompileTime,Rhs::MaxRowsAtCompileTime)
|
MaxDepthAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(Lhs::MaxColsAtCompileTime,Rhs::MaxRowsAtCompileTime)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,CoeffBasedProductMode> lazyproduct;
|
||||||
|
|
||||||
|
template<typename Dst>
|
||||||
|
static void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
||||||
|
{
|
||||||
|
if((rhs.rows()+dst.rows()+dst.cols())<20 && rhs.rows()>0)
|
||||||
|
lazyproduct::evalTo(dst, lhs, rhs);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dst.setZero();
|
||||||
|
scaleAndAddTo(dst, lhs, rhs, Scalar(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Dst>
|
||||||
|
static void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
||||||
|
{
|
||||||
|
if((rhs.rows()+dst.rows()+dst.cols())<20 && rhs.rows()>0)
|
||||||
|
lazyproduct::addTo(dst, lhs, rhs);
|
||||||
|
else
|
||||||
|
scaleAndAddTo(dst,lhs, rhs, Scalar(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Dst>
|
||||||
|
static void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
||||||
|
{
|
||||||
|
if((rhs.rows()+dst.rows()+dst.cols())<20 && rhs.rows()>0)
|
||||||
|
lazyproduct::subTo(dst, lhs, rhs);
|
||||||
|
else
|
||||||
|
scaleAndAddTo(dst, lhs, rhs, Scalar(-1));
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Dest>
|
template<typename Dest>
|
||||||
static void scaleAndAddTo(Dest& dst, const Lhs& a_lhs, const Rhs& a_rhs, const Scalar& alpha)
|
static void scaleAndAddTo(Dest& dst, const Lhs& a_lhs, const Rhs& a_rhs, const Scalar& alpha)
|
||||||
{
|
{
|
||||||
@ -494,7 +526,7 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemmProduct>
|
|||||||
(Dest::Flags&RowMajorBit) ? RowMajor : ColMajor>,
|
(Dest::Flags&RowMajorBit) ? RowMajor : ColMajor>,
|
||||||
ActualLhsTypeCleaned, ActualRhsTypeCleaned, Dest, BlockingType> GemmFunctor;
|
ActualLhsTypeCleaned, ActualRhsTypeCleaned, Dest, BlockingType> GemmFunctor;
|
||||||
|
|
||||||
BlockingType blocking(dst.rows(), dst.cols(), lhs.cols());
|
BlockingType blocking(dst.rows(), dst.cols(), lhs.cols(), true);
|
||||||
|
|
||||||
internal::parallelize_gemm<(Dest::MaxRowsAtCompileTime>32 || Dest::MaxRowsAtCompileTime==Dynamic)>
|
internal::parallelize_gemm<(Dest::MaxRowsAtCompileTime>32 || Dest::MaxRowsAtCompileTime==Dynamic)>
|
||||||
(GemmFunctor(lhs, rhs, dst, actualAlpha, blocking), a_lhs.rows(), a_rhs.cols(), Dest::Flags&RowMajorBit);
|
(GemmFunctor(lhs, rhs, dst, actualAlpha, blocking), a_lhs.rows(), a_rhs.cols(), Dest::Flags&RowMajorBit);
|
||||||
|
@ -266,6 +266,8 @@ template<typename MatrixType, unsigned int UpLo>
|
|||||||
template<typename ProductType>
|
template<typename ProductType>
|
||||||
TriangularView<MatrixType,UpLo>& TriangularView<MatrixType,UpLo>::_assignProduct(const ProductType& prod, const Scalar& alpha)
|
TriangularView<MatrixType,UpLo>& TriangularView<MatrixType,UpLo>::_assignProduct(const ProductType& prod, const Scalar& alpha)
|
||||||
{
|
{
|
||||||
|
eigen_assert(m_matrix.rows() == prod.rows() && m_matrix.cols() == prod.cols());
|
||||||
|
|
||||||
general_product_to_triangular_selector<MatrixType, ProductType, UpLo, internal::traits<ProductType>::InnerSize==1>::run(m_matrix.const_cast_derived(), prod, alpha);
|
general_product_to_triangular_selector<MatrixType, ProductType, UpLo, internal::traits<ProductType>::InnerSize==1>::run(m_matrix.const_cast_derived(), prod, alpha);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -187,7 +187,7 @@ class compute_matrix_evaluator_flags
|
|||||||
((Options&DontAlign)==0)
|
((Options&DontAlign)==0)
|
||||||
&& (
|
&& (
|
||||||
#if EIGEN_ALIGN_STATICALLY
|
#if EIGEN_ALIGN_STATICALLY
|
||||||
((!is_dynamic_size_storage) && (((MaxCols*MaxRows*int(sizeof(Scalar))) % 16) == 0))
|
((!is_dynamic_size_storage) && (((MaxCols*MaxRows*int(sizeof(Scalar))) % EIGEN_ALIGN_BYTES) == 0))
|
||||||
#else
|
#else
|
||||||
0
|
0
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user