Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
balancap committed Sep 12, 2024
1 parent 81082c9 commit 9c73b89
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ml_dtypes/include/float8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,7 @@ struct ConvertImpl<From, To, kSaturate, kTruncate,
<< " / " << std::numeric_limits<To>::digits << std::endl;
std::cerr << "CONVERT IMPL Signed0: " << kToIsSigned << " / "
<< kFromIsSigned << std::endl;

std::cerr << "CONVERT IMPL Inf/Nan0: " << int(Eigen::numext::isinf(from))
<< " / " << int(Eigen::numext::isnan(from)) << std::endl;

Expand Down Expand Up @@ -1820,6 +1821,12 @@ EIGEN_DEVICE_FUNC inline bool isinf_impl<ml_dtypes::float8_e5m2fnuz>(
return ml_dtypes::float8_internal::isinf(x);
}

template <>
EIGEN_DEVICE_FUNC inline bool isinf_impl<ml_dtypes::float8_e8m0fnu>(
const ml_dtypes::float8_e8m0fnu& x) {
return ml_dtypes::float8_internal::isinf(x);
}

template <>
EIGEN_DEVICE_FUNC inline bool isnan_impl<ml_dtypes::float8_e3m4>(
const ml_dtypes::float8_e3m4& x) {
Expand Down Expand Up @@ -1862,6 +1869,12 @@ EIGEN_DEVICE_FUNC inline bool isnan_impl<ml_dtypes::float8_e5m2fnuz>(
return ml_dtypes::float8_internal::isnan(x);
}

template <>
EIGEN_DEVICE_FUNC inline bool isnan_impl<ml_dtypes::float8_e8m0fnu>(
const ml_dtypes::float8_e8m0fnu& x) {
return ml_dtypes::float8_internal::isnan(x);
}

template <>
EIGEN_DEVICE_FUNC inline bool isfinite_impl<ml_dtypes::float8_e3m4>(
const ml_dtypes::float8_e3m4& x) {
Expand Down Expand Up @@ -1904,6 +1917,12 @@ EIGEN_DEVICE_FUNC inline bool isfinite_impl<ml_dtypes::float8_e5m2fnuz>(
return ml_dtypes::float8_internal::isfinite(x);
}

template <>
EIGEN_DEVICE_FUNC inline bool isfinite_impl<ml_dtypes::float8_e8m0fnu>(
const ml_dtypes::float8_e8m0fnu& x) {
return ml_dtypes::float8_internal::isfinite(x);
}

} // namespace internal
} // namespace Eigen

Expand Down

0 comments on commit 9c73b89

Please sign in to comment.