Revert "Select AVX2 even if the data size is not a multiple of 8"

Tests are failing for AVX and NEON.

This reverts commit eb85b97339e3791d533592bac20999b1b3ebca09.
This commit is contained in:
David Tellenbach 2021-12-28 23:57:06 +01:00
parent 8eab7b6886
commit d705eb5f86
2 changed files with 0 additions and 55 deletions

View File

@ -180,32 +180,8 @@ template<typename T> struct packet_traits;
template<typename T> struct unpacket_traits;
// If we vectorize regardless of alignment, pick the full-sized packet if:
//
// * The size is large enough;
// * Picking it will result in less operations than picking the half size.
// Consider the case where the size is 12, the full packet is 8, and the
// half packet is 4. If we pick the full packet we'd have 1 + 4 operations,
// but only 3 operations if we pick the half-packet.
//
// The reason why we only do this with EIGEN_UNALIGNED_VECTORIZE is that if
// we chose packets which do not divide the data size exactly we're going to
// be left with some possibly unaligned data at the end.
#if EIGEN_UNALIGNED_VECTORIZE
template<int Size, typename PacketType,
bool Stop =
Size==Dynamic ||
(Size >= unpacket_traits<PacketType>::size &&
// If the packet size is 1 we're always good -- it will always divide things perfectly.
// We have this check since otherwise 1/2 would be 0 in the division below.
(unpacket_traits<PacketType>::size == 1 ||
(Size/unpacket_traits<PacketType>::size + Size%unpacket_traits<PacketType>::size) <=
(Size/(unpacket_traits<PacketType>::size/2) + Size%(unpacket_traits<PacketType>::size/2)))) ||
is_same<PacketType,typename unpacket_traits<PacketType>::half>::value>
#else
template<int Size, typename PacketType,
bool Stop = Size==Dynamic || (Size%unpacket_traits<PacketType>::size)==0 || is_same<PacketType,typename unpacket_traits<PacketType>::half>::value>
#endif
struct find_best_packet_helper;
template< int Size, typename PacketType>

View File

@ -258,38 +258,7 @@ struct vectorization_logic
VERIFY(test_redux(VectorX(10),
LinearVectorizedTraversal,NoUnrolling));
// Some static checks for packet-picking -- see
// <https://gitlab.com/libeigen/eigen/merge_requests/46#note_271497656> for context.
// Any multiple of the packet size itself will result in the normal packet
STATIC_CHECK((
internal::is_same<typename internal::find_best_packet<Scalar, PacketSize>::type, PacketType>::value
));
STATIC_CHECK((
internal::is_same<typename internal::find_best_packet<Scalar, PacketSize*2>::type, PacketType>::value
));
STATIC_CHECK((
internal::is_same<typename internal::find_best_packet<Scalar, PacketSize*5>::type, PacketType>::value
));
// Moreover, situations where the size is _not_ a multiple but picking the full packet
// is convenient will also work, but only with unaligned vectorize
STATIC_CHECK((
!(EIGEN_UNALIGNED_VECTORIZE || PacketSize == HalfPacketSize) ||
internal::is_same<typename internal::find_best_packet<Scalar, PacketSize*5+1>::type, PacketType>::value
));
STATIC_CHECK((
!(EIGEN_UNALIGNED_VECTORIZE || PacketSize == HalfPacketSize) ||
internal::is_same<typename internal::find_best_packet<Scalar, PacketSize*5+2>::type, PacketType>::value
));
// In situations where the picking the full-packet would be detrimental the half-packet
// is chosen.
STATIC_CHECK((
!(PacketSize > 2) ||
internal::is_same<typename internal::find_best_packet<Scalar, PacketSize*2-1>::type, HalfPacketType>::value
));
}
};
template<typename Scalar> struct vectorization_logic<Scalar,false>