Skip to content

Commit

Permalink
Gix GCC cast ambiguity.
Browse files Browse the repository at this point in the history
GCC complains about ambiguous casting mxfloat specifically to float8_e5m2fnuz.
The cause seems to be missing constructors.  Here we make the constructor
similar to all other float8 types, which eliminates the ambiguity.

PiperOrigin-RevId: 721882407
  • Loading branch information
cantonios authored and The ml_dtypes Authors committed Jan 31, 2025
1 parent 889f2c0 commit 9c65856
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions ml_dtypes/include/float8.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,17 +399,8 @@ class float8_e5m2fnuz : public float8_base<float8_e5m2fnuz> {
using Base::Base;

public:
explicit EIGEN_DEVICE_FUNC float8_e5m2fnuz(const float8_e5m2& f8)
: float8_e5m2fnuz(ConvertFrom(f8)) {}
explicit EIGEN_DEVICE_FUNC float8_e5m2fnuz(const float8_e4m3& f8)
: float8_e5m2fnuz(ConvertFrom(f8)) {}
explicit EIGEN_DEVICE_FUNC float8_e5m2fnuz(const float8_e3m4& f8)
: float8_e5m2fnuz(ConvertFrom(f8)) {}
explicit EIGEN_DEVICE_FUNC float8_e5m2fnuz(const float8_e4m3b11fnuz& f8)
: float8_e5m2fnuz(ConvertFrom(f8)) {}
explicit EIGEN_DEVICE_FUNC float8_e5m2fnuz(const float8_e4m3fn& f8)
: float8_e5m2fnuz(ConvertFrom(f8)) {}
explicit EIGEN_DEVICE_FUNC float8_e5m2fnuz(const float8_e4m3fnuz& f8)
template <typename T, RequiresIsDerivedFromFloat8Base<T> = 0>
explicit EIGEN_DEVICE_FUNC float8_e5m2fnuz(T f8)
: float8_e5m2fnuz(ConvertFrom(f8)) {}

constexpr float8_e5m2fnuz operator-() const {
Expand Down

0 comments on commit 9c65856

Please sign in to comment.