Lines 642-662
struct evaluator<Map<PlainObjectType, Ma
Link Here
|
642 |
OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 |
642 |
OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 |
643 |
? int(PlainObjectType::OuterStrideAtCompileTime) |
643 |
? int(PlainObjectType::OuterStrideAtCompileTime) |
644 |
: int(StrideType::OuterStrideAtCompileTime), |
644 |
: int(StrideType::OuterStrideAtCompileTime), |
645 |
HasNoInnerStride = InnerStrideAtCompileTime == 1, |
645 |
HasNoInnerStride = InnerStrideAtCompileTime == 1, |
646 |
HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, |
646 |
HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, |
647 |
HasNoStride = HasNoInnerStride && HasNoOuterStride, |
647 |
HasNoStride = HasNoInnerStride && HasNoOuterStride, |
648 |
IsAligned = bool(EIGEN_ALIGN) && ((int(MapOptions)&Aligned)==Aligned), |
648 |
IsAligned = bool(EIGEN_ALIGN) && ((int(MapOptions)&Aligned)==Aligned), |
649 |
IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, |
649 |
IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, |
|
|
650 |
|
651 |
// TODO: should check for smaller packet types once we can handle multi-sized packet types |
652 |
AlignBytes = int(packet_traits<Scalar>::size) * sizeof(Scalar), |
653 |
|
650 |
KeepsPacketAccess = bool(HasNoInnerStride) |
654 |
KeepsPacketAccess = bool(HasNoInnerStride) |
651 |
&& ( bool(IsDynamicSize) |
655 |
&& ( bool(IsDynamicSize) |
652 |
|| HasNoOuterStride |
656 |
|| HasNoOuterStride |
653 |
|| ( OuterStrideAtCompileTime!=Dynamic |
657 |
|| ( OuterStrideAtCompileTime!=Dynamic |
654 |
&& ((static_cast<int>(sizeof(Scalar))*OuterStrideAtCompileTime)%EIGEN_ALIGN_BYTES)==0 ) ), |
658 |
&& ((static_cast<int>(sizeof(Scalar))*OuterStrideAtCompileTime) % AlignBytes)==0 ) ), |
655 |
Flags0 = evaluator<PlainObjectType>::Flags, |
659 |
Flags0 = evaluator<PlainObjectType>::Flags, |
656 |
Flags1 = IsAligned ? (int(Flags0) | AlignedBit) : (int(Flags0) & ~AlignedBit), |
660 |
Flags1 = IsAligned ? (int(Flags0) | AlignedBit) : (int(Flags0) & ~AlignedBit), |
657 |
Flags2 = (bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime)) |
661 |
Flags2 = (bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime)) |
658 |
? int(Flags1) : int(Flags1 & ~LinearAccessBit), |
662 |
? int(Flags1) : int(Flags1 & ~LinearAccessBit), |
659 |
Flags = KeepsPacketAccess ? int(Flags2) : (int(Flags2) & ~PacketAccessBit) |
663 |
Flags = KeepsPacketAccess ? int(Flags2) : (int(Flags2) & ~PacketAccessBit) |
660 |
}; |
664 |
}; |
661 |
|
665 |
|
662 |
EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map) |
666 |
EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map) |
Lines 712-728
struct evaluator<Block<ArgType, BlockRow
Link Here
|
712 |
: int(outer_stride_at_compile_time<ArgType>::ret), |
716 |
: int(outer_stride_at_compile_time<ArgType>::ret), |
713 |
OuterStrideAtCompileTime = HasSameStorageOrderAsArgType |
717 |
OuterStrideAtCompileTime = HasSameStorageOrderAsArgType |
714 |
? int(outer_stride_at_compile_time<ArgType>::ret) |
718 |
? int(outer_stride_at_compile_time<ArgType>::ret) |
715 |
: int(inner_stride_at_compile_time<ArgType>::ret), |
719 |
: int(inner_stride_at_compile_time<ArgType>::ret), |
716 |
MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits<Scalar>::size) == 0) |
720 |
MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits<Scalar>::size) == 0) |
717 |
&& (InnerStrideAtCompileTime == 1) |
721 |
&& (InnerStrideAtCompileTime == 1) |
718 |
? PacketAccessBit : 0, |
722 |
? PacketAccessBit : 0, |
719 |
|
723 |
|
720 |
MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % EIGEN_ALIGN_BYTES) == 0)) ? AlignedBit : 0, |
724 |
// TODO: should check for smaller packet types once we can handle multi-sized packet types |
|
|
725 |
AlignBytes = int(packet_traits<Scalar>::size) * sizeof(Scalar), |
726 |
|
727 |
MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % AlignBytes) == 0)) ? AlignedBit : 0, |
721 |
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator<ArgType>::Flags&LinearAccessBit))) ? LinearAccessBit : 0, |
728 |
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator<ArgType>::Flags&LinearAccessBit))) ? LinearAccessBit : 0, |
722 |
FlagsRowMajorBit = XprType::Flags&RowMajorBit, |
729 |
FlagsRowMajorBit = XprType::Flags&RowMajorBit, |
723 |
Flags0 = evaluator<ArgType>::Flags & ( (HereditaryBits & ~RowMajorBit) | |
730 |
Flags0 = evaluator<ArgType>::Flags & ( (HereditaryBits & ~RowMajorBit) | |
724 |
DirectAccessBit | |
731 |
DirectAccessBit | |
725 |
MaskPacketAccessBit | |
732 |
MaskPacketAccessBit | |
726 |
MaskAlignedBit), |
733 |
MaskAlignedBit), |
727 |
Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit |
734 |
Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit |
728 |
}; |
735 |
}; |
Lines 820-841
protected:
Link Here
|
820 |
// all action is via the data() as returned by the Block expression. |
827 |
// all action is via the data() as returned by the Block expression. |
821 |
|
828 |
|
822 |
template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel> |
829 |
template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel> |
823 |
struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /* HasDirectAccess */ true> |
830 |
struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /* HasDirectAccess */ true> |
824 |
: mapbase_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, |
831 |
: mapbase_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, |
825 |
typename Block<ArgType, BlockRows, BlockCols, InnerPanel>::PlainObject> |
832 |
typename Block<ArgType, BlockRows, BlockCols, InnerPanel>::PlainObject> |
826 |
{ |
833 |
{ |
827 |
typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType; |
834 |
typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType; |
|
|
835 |
typedef typename XprType::Scalar Scalar; |
828 |
|
836 |
|
829 |
EIGEN_DEVICE_FUNC explicit block_evaluator(const XprType& block) |
837 |
EIGEN_DEVICE_FUNC explicit block_evaluator(const XprType& block) |
830 |
: mapbase_evaluator<XprType, typename XprType::PlainObject>(block) |
838 |
: mapbase_evaluator<XprType, typename XprType::PlainObject>(block) |
831 |
{ |
839 |
{ |
|
|
840 |
// TODO: should check for smaller packet types once we can handle multi-sized packet types |
841 |
const int AlignBytes = int(packet_traits<Scalar>::size) * sizeof(Scalar); |
832 |
// FIXME this should be an internal assertion |
842 |
// FIXME this should be an internal assertion |
833 |
eigen_assert(EIGEN_IMPLIES(evaluator<XprType>::Flags&AlignedBit, (size_t(block.data()) % EIGEN_ALIGN_BYTES) == 0) && "data is not aligned"); |
843 |
eigen_assert(EIGEN_IMPLIES(evaluator<XprType>::Flags&AlignedBit, (size_t(block.data()) % AlignBytes) == 0) && "data is not aligned"); |
834 |
} |
844 |
} |
835 |
}; |
845 |
}; |
836 |
|
846 |
|
837 |
|
847 |
|
838 |
// -------------------- Select -------------------- |
848 |
// -------------------- Select -------------------- |
839 |
// TODO shall we introduce a ternary_evaluator? |
849 |
// TODO shall we introduce a ternary_evaluator? |
840 |
|
850 |
|
841 |
// TODO enable vectorization for Select |
851 |
// TODO enable vectorization for Select |