Clean up packetmath tests and fix various bugs to make bfloat16 pass (almost) all packetmath tests with SSE, AVX, and AVX512.

This commit is contained in:
Rasmus Munk Larsen
2020-10-09 20:05:49 +00:00
parent 7a8d3d5b81
commit 4e4d3f32d1
8 changed files with 114 additions and 70 deletions

View File

@@ -1626,8 +1626,6 @@ template <> struct is_arithmetic<Packet16bf> { enum { value = true }; };
template <>
struct packet_traits<bfloat16> : default_packet_traits {
typedef Packet16bf type;
// There is no half-size packet for current Packet16bf.
// TODO: support as SSE path.
typedef Packet8bf half;
enum {
Vectorizable = 1,
@@ -1883,6 +1881,11 @@ EIGEN_STRONG_INLINE Packet16bf pmax<Packet16bf>(const Packet16bf& a,
return F32ToBf16(pmax<Packet16f>(Bf16ToF32(a), Bf16ToF32(b)));
}
template <>
EIGEN_STRONG_INLINE Packet16bf plset<Packet16bf>(const bfloat16& a) {
return F32ToBf16(plset<Packet16f>(static_cast<float>(a)));
}
template <>
EIGEN_STRONG_INLINE Packet8bf predux_half_dowto4<Packet16bf>(const Packet16bf& a) {
Packet8bf lane0 = _mm256_extractf128_si256(a, 0);