Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Error in libtensorflow Pointing to float8.h in ml_dtype #144

Open
HongMJ1315 opened this issue Apr 1, 2024 · 6 comments
Open

Comments

@HongMJ1315
Copy link

HongMJ1315 commented Apr 1, 2024

I encountered an error while compiling my program using libtensorflow. The error seems to point to float8.h in ml_dtype. Here is the error information:

In file included from /home/mrjb/tensorflow/tf_env/include/tsl/platform/ml_dtypes.h:19,
                 from /home/mrjb/tensorflow/tf_env/include/tsl/platform/types.h:22,
                 from /home/mrjb/tensorflow/tf_env/include/tensorflow/core/platform/types.h:22,
                 from /home/mrjb/tensorflow/tf_env/include/tensorflow/core/platform/env_time.h:20,
                 from /home/mrjb/tensorflow/tf_env/include/tensorflow/core/platform/env.h:26,
                 from /mnt/c/Users/gonec/Documents/C++/tf/src/main.cc:1:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:871:29: error: ‘get_integer_by_size’ in namespace ‘Eigen::numext’ does not name a template type
  871 |     typename Eigen::numext::get_integer_by_size<kNumBytes>::unsigned_type;
      |                             ^~~~~~~~~~~~~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:892:20: error: ‘GetUnsignedInteger’ does not name a type
  892 |   using BitsType = GetUnsignedInteger<sizeof(Float)>;
      |                    ^~~~~~~~~~~~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:896:20: error: ‘BitsType’ does not name a type
  896 |   static constexpr BitsType kExponentMask = ((BitsType{1} << kExponentBits) - 1)
      |                    ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:896:59: error: expected unqualified-id before ‘<<’ token
  896 |   static constexpr BitsType kExponentMask = ((BitsType{1} << kExponentBits) - 1)
      |                                                           ^~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:898:20: error: ‘BitsType’ does not name a type
  898 |   static constexpr BitsType kMantissaMask = (BitsType{1} << kMantissaBits) - 1;
      |                    ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:898:58: error: expected unqualified-id before ‘<<’ token
  898 |   static constexpr BitsType kMantissaMask = (BitsType{1} << kMantissaBits) - 1;
      |                                                          ^~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1024:20: error: ‘GetUnsignedInteger’ does not name a type
 1024 |   using WideBits = GetUnsignedInteger<kWideBytes>;
      |                    ^~~~~~~~~~~~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In static member function ‘static To ml_dtypes::float8_internal::ConvertImpl<From, To, kSaturate, kTruncate, typename std::enable_if<(! is_same_v<From, To>), void>::type>::run(From)’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1056:9: error: ‘WideBits’ was not declared in this scope; did you mean ‘kWideBits’?
 1056 |         WideBits bits = from_bits;
      |         ^~~~~~~~
      |         kWideBits
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1066:13: error: ‘bits’ was not declared in this scope
 1066 |             bits <<= kExponentOffset;
      |             ^~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1071:11: error: ‘bits’ was not declared in this scope
 1071 |           bits <<= normalization_factor;
      |           ^~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1072:29: error: expected ‘)’ before ‘{’ token
 1072 |           bits &= ~(WideBits{1} << kFromMantissaBits);
      |                             ^
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1072:20: note: to match this ‘(’
 1072 |           bits &= ~(WideBits{1} << kFromMantissaBits);
      |                    ^
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1074:31: error: ‘WideBits’ does not name a type
 1074 |           bits |= static_cast<WideBits>(biased_exponent) << kFromMantissaBits;
      |                               ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1079:11: error: ‘bits’ was not declared in this scope
 1079 |           bits <<= kDigitShift;
      |           ^~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1082:13: error: ‘bits’ was not declared in this scope
 1082 |             bits = RoundBitsToNearestEven(bits, -kDigitShift);
      |             ^~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1084:11: error: ‘bits’ was not declared in this scope
 1084 |           bits >>= -kDigitShift;
      |           ^~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1086:65: error: ‘bits’ was not declared in this scope
 1086 |         To to = Eigen::numext::bit_cast<To>(static_cast<ToBits>(bits));
      |                                                                 ^~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1128:5: error: ‘WideBits’ was not declared in this scope; did you mean ‘kWideBits’?
 1128 |     WideBits rounded_from_bits = from_bits;
      |     ^~~~~~~~
      |     kWideBits
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1131:9: error: ‘rounded_from_bits’ was not declared in this scope
 1131 |         rounded_from_bits = RoundBitsToNearestEven(from_bits, -kDigitShift);
      |         ^~~~~~~~~~~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1134:7: error: ‘rounded_from_bits’ was not declared in this scope
 1134 |       rounded_from_bits &= ~((WideBits{1} << (-kDigitShift)) - 1);
      |       ^~~~~~~~~~~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1134:39: error: expected ‘)’ before ‘{’ token
 1134 |       rounded_from_bits &= ~((WideBits{1} << (-kDigitShift)) - 1);
      |                                       ^
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1134:30: note: to match this ‘(’
 1134 |       rounded_from_bits &= ~((WideBits{1} << (-kDigitShift)) - 1);
      |                              ^
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1138:5: error: ‘rounded_from_bits’ was not declared in this scope
 1138 |     rounded_from_bits += static_cast<WideBits>(kExponentOffset)
      |     ^~~~~~~~~~~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1138:38: error: ‘WideBits’ does not name a type
 1138 |     rounded_from_bits += static_cast<WideBits>(kExponentOffset)
      |                                      ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1144:11: error: ‘WideBits’ does not name a type
 1144 |     const WideBits kToHighestRep =
      |           ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1146:14: error: expected ‘;’ before ‘aligned_highest’
 1146 |     WideBits aligned_highest{kToHighestRep};
      |              ^~~~~~~~~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1148:7: error: ‘aligned_highest’ was not declared in this scope
 1148 |       aligned_highest <<= -kDigitShift;
      |       ^~~~~~~~~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1163:31: error: ‘aligned_highest’ was not declared in this scope
 1163 |       if (rounded_from_bits > aligned_highest) {
      |                               ^~~~~~~~~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<ml_dtypes::float8_internal::float8_e5m2, ml_dtypes::float8_internal::float8_e5m2fnuz, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1264:65:   required from ‘static Derived ml_dtypes::float8_internal::float8_base<Derived>::ConvertFrom(From) [with bool kSaturate = false; bool kTruncate = false; From = ml_dtypes::float8_internal::float8_e5m2; Derived = ml_dtypes::float8_internal::float8_e5m2fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:371:36:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e5m2>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e5m2fnuz>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<ml_dtypes::float8_internal::float8_e4m3b11fnuz, ml_dtypes::float8_internal::float8_e5m2fnuz, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1264:65:   required from ‘static Derived ml_dtypes::float8_internal::float8_base<Derived>::ConvertFrom(From) [with bool kSaturate = false; bool kTruncate = false; From = ml_dtypes::float8_internal::float8_e4m3b11fnuz; Derived = ml_dtypes::float8_internal::float8_e5m2fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:373:36:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e4m3b11fnuz>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e5m2fnuz>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<ml_dtypes::float8_internal::float8_e4m3fn, ml_dtypes::float8_internal::float8_e5m2fnuz, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1264:65:   required from ‘static Derived ml_dtypes::float8_internal::float8_base<Derived>::ConvertFrom(From) [with bool kSaturate = false; bool kTruncate = false; From = ml_dtypes::float8_internal::float8_e4m3fn; Derived = ml_dtypes::float8_internal::float8_e5m2fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:375:36:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e4m3fn>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e5m2fnuz>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<ml_dtypes::float8_internal::float8_e4m3fnuz, ml_dtypes::float8_internal::float8_e5m2fnuz, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1264:65:   required from ‘static Derived ml_dtypes::float8_internal::float8_base<Derived>::ConvertFrom(From) [with bool kSaturate = false; bool kTruncate = false; From = ml_dtypes::float8_internal::float8_e4m3fnuz; Derived = ml_dtypes::float8_internal::float8_e5m2fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:377:36:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e4m3fnuz>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e5m2fnuz>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<ml_dtypes::float8_internal::float8_e4m3b11fnuz, float, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1271:61:   required from ‘static To ml_dtypes::float8_internal::float8_base<Derived>::ConvertTo(Derived) [with To = float; bool kSaturate = false; bool kTruncate = false; Derived = ml_dtypes::float8_internal::float8_e4m3b11fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:87:28:   required from ‘ml_dtypes::float8_internal::float8_base<Derived>::operator float() const [with Derived = ml_dtypes::float8_internal::float8_e4m3b11fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:128:37:   required from ‘Derived ml_dtypes::float8_internal::float8_base<Derived>::operator-(const Derived&) const [with Derived = ml_dtypes::float8_internal::float8_e4m3b11fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:285:27:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e4m3b11fnuz>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<float>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<float, ml_dtypes::float8_internal::float8_e4m3b11fnuz, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1264:65:   required from ‘static Derived ml_dtypes::float8_internal::float8_base<Derived>::ConvertFrom(From) [with bool kSaturate = false; bool kTruncate = false; From = float; Derived = ml_dtypes::float8_internal::float8_e4m3b11fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:70:32:   required from ‘ml_dtypes::float8_internal::float8_base<Derived>::float8_base(T, std::enable_if_t<is_floating_point_v<T>, int>) [with T = float; Derived = ml_dtypes::float8_internal::float8_e4m3b11fnuz; std::enable_if_t<is_floating_point_v<T>, int> = int]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:270:15:   required from ‘Derived ml_dtypes::float8_internal::float8_base<Derived>::operator-(const Derived&) const [with Derived = ml_dtypes::float8_internal::float8_e4m3b11fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:285:27:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<float>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e4m3b11fnuz>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<ml_dtypes::float8_internal::float8_e4m3fnuz, float, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1271:61:   required from ‘static To ml_dtypes::float8_internal::float8_base<Derived>::ConvertTo(Derived) [with To = float; bool kSaturate = false; bool kTruncate = false; Derived = ml_dtypes::float8_internal::float8_e4m3fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:87:28:   required from ‘ml_dtypes::float8_internal::float8_base<Derived>::operator float() const [with Derived = ml_dtypes::float8_internal::float8_e4m3fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:128:37:   required from ‘Derived ml_dtypes::float8_internal::float8_base<Derived>::operator-(const Derived&) const [with Derived = ml_dtypes::float8_internal::float8_e4m3fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:328:27:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e4m3fnuz>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<float>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<float, ml_dtypes::float8_internal::float8_e4m3fnuz, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1264:65:   required from ‘static Derived ml_dtypes::float8_internal::float8_base<Derived>::ConvertFrom(From) [with bool kSaturate = false; bool kTruncate = false; From = float; Derived = ml_dtypes::float8_internal::float8_e4m3fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:70:32:   required from ‘ml_dtypes::float8_internal::float8_base<Derived>::float8_base(T, std::enable_if_t<is_floating_point_v<T>, int>) [with T = float; Derived = ml_dtypes::float8_internal::float8_e4m3fnuz; std::enable_if_t<is_floating_point_v<T>, int> = int]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:313:15:   required from ‘Derived ml_dtypes::float8_internal::float8_base<Derived>::operator-(const Derived&) const [with Derived = ml_dtypes::float8_internal::float8_e4m3fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:328:27:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<float>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e4m3fnuz>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<ml_dtypes::float8_internal::float8_e5m2fnuz, float, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1271:61:   required from ‘static To ml_dtypes::float8_internal::float8_base<Derived>::ConvertTo(Derived) [with To = float; bool kSaturate = false; bool kTruncate = false; Derived = ml_dtypes::float8_internal::float8_e5m2fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:87:28:   required from ‘ml_dtypes::float8_internal::float8_base<Derived>::operator float() const [with Derived = ml_dtypes::float8_internal::float8_e5m2fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:128:37:   required from ‘Derived ml_dtypes::float8_internal::float8_base<Derived>::operator-(const Derived&) const [with Derived = ml_dtypes::float8_internal::float8_e5m2fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:387:27:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e5m2fnuz>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<float>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h: In instantiation of ‘struct ml_dtypes::float8_internal::ConvertImpl<float, ml_dtypes::float8_internal::float8_e5m2fnuz, false, false, void>’:
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1264:65:   required from ‘static Derived ml_dtypes::float8_internal::float8_base<Derived>::ConvertFrom(From) [with bool kSaturate = false; bool kTruncate = false; From = float; Derived = ml_dtypes::float8_internal::float8_e5m2fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:70:32:   required from ‘ml_dtypes::float8_internal::float8_base<Derived>::float8_base(T, std::enable_if_t<is_floating_point_v<T>, int>) [with T = float; Derived = ml_dtypes::float8_internal::float8_e5m2fnuz; std::enable_if_t<is_floating_point_v<T>, int> = int]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:367:15:   required from ‘Derived ml_dtypes::float8_internal::float8_base<Derived>::operator-(const Derived&) const [with Derived = ml_dtypes::float8_internal::float8_e5m2fnuz]’
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:387:27:   required from here
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1003:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<float>’
 1003 |   using FromBits = typename FromTraits::BitsType;
      |         ^~~~~~~~
/home/mrjb/tensorflow/tf_env/include/ml_dtypes/include/float8.h:1011:9: error: no type named ‘BitsType’ in ‘struct ml_dtypes::float8_internal::Traits<ml_dtypes::float8_internal::float8_e5m2fnuz>’
 1011 |   using ToBits = typename ToTraits::BitsType;
      |         ^~~~~~

output.txt

Any help would be greatly appreciated. Thank you.

@jakevdp
Copy link
Collaborator

jakevdp commented Apr 1, 2024

Thanks for the question. What version of ml_dtypes are you using, and what compiler are you using?

@HongMJ1315
Copy link
Author

Compiler version: g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
I found in tensorflow/third_party/py/ml_dtypes/workspace.bzl that TensorFlow seems to be using this version: 2ca30a2b3c0744625ae3d6988f5596740080bbd0

And for Eigen, I found in tensorflow/third_party/eigen3/workspace.bzl that it seems to be using this version: aa6964bf3a34fd607837dd8123bc42465185c4f8

@jakevdp
Copy link
Collaborator

jakevdp commented Apr 2, 2024

I don't understand where the error would be coming from. In the commit you reference, Traits:BitsType is defined, as you can see here:

template <typename Float>
struct TraitsBase {
using BitsType = GetUnsignedInteger<sizeof(Float)>;

Perhaps the using FromBits = typename FromTraits::BitsType invocation is not supported by g++ 11.4?

@HongMJ1315
Copy link
Author

I suspect the error might be originating from the following line:

  871 |     typename Eigen::numext::get_integer_by_size<kNumBytes>::unsigned_type;

I've tried both the Eigen version from tensorflow/third_party/eigen3/workspace.bzl and the latest version of Eigen, but neither could compile. Furthermore, I couldn't find get_integer_by_size in Eigen::numext in either version.

In addition, I noticed that the Eigen library seems to be missing in ml_dtypes/tree/main/third_party. Could the error be due to using different libraries?

@jakevdp
Copy link
Collaborator

jakevdp commented Apr 5, 2024

If eigen is missing from the ml_dtypes package, then perhaps you forgot to run the git submodule commands? There is more info on building from source here: https://github.com/jax-ml/ml_dtypes#installation

@HongMJ1315
Copy link
Author

After deleting Eigen and recompiling using the Eigen provided in ml_dtypes/tree/main/third_party, it was successful.
It might indeed be due to different versions of Eigen.
Thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants