Skip to content

Commit

Permalink
Delete some unused/redundant code.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 578003516
  • Loading branch information
majnemer authored and The ml_dtypes Authors committed Oct 31, 2023
1 parent 171155f commit 3d74b01
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions ml_dtypes/include/float8.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,18 +882,10 @@ struct IdentityConversion {
static EIGEN_DEVICE_FUNC inline Scalar run(Scalar from) { return from; }
};

template <typename Scalar>
struct ConvertImpl<Scalar, Scalar, /*kSaturate=*/false, /*kTruncate=*/false,
/*EnableIf=*/void> : public IdentityConversion<Scalar> {};
template <typename Scalar>
struct ConvertImpl<Scalar, Scalar, /*kSaturate=*/false, /*kTruncate=*/true,
/*EnableIf=*/void> : public IdentityConversion<Scalar> {};
template <typename Scalar>
struct ConvertImpl<Scalar, Scalar, /*kSaturate=*/true, /*kTruncate=*/false,
/*EnableIf=*/void> : public IdentityConversion<Scalar> {};
template <typename Scalar>
struct ConvertImpl<Scalar, Scalar, /*kSaturate=*/true, /*kTruncate=*/true,
/*EnableIf=*/void> : public IdentityConversion<Scalar> {};
template <typename Scalar, bool kSaturate, bool kTruncate>
struct ConvertImpl<Scalar, Scalar, /*kSaturate=*/kSaturate,
/*kTruncate=*/kTruncate>
: public IdentityConversion<Scalar> {};

template <typename Float>
struct TraitsBase {
Expand Down Expand Up @@ -1221,15 +1213,6 @@ struct ConvertImpl<Eigen::half, float8_e5m2, kSaturate, kTruncate> {
}
};

template <>
struct ConvertImpl<float8_e5m2, Eigen::half, /*kSaturate=*/false,
/*kTruncate=*/false> {
static EIGEN_DEVICE_FUNC inline Eigen::half run(float8_e5m2 from) {
return Eigen::numext::bit_cast<Eigen::half>(
static_cast<uint16_t>(static_cast<uint16_t>(from.rep()) << 8));
}
};

// Direct casts of e5m2 to Eigen::half simply shifts bits over.
template <bool kSaturate, bool kTruncate>
struct ConvertImpl<float8_e5m2, Eigen::half, kSaturate, kTruncate> {
Expand Down

0 comments on commit 3d74b01

Please sign in to comment.