From 54c28861fe21d515ee913b14fc92562f6628a46f Mon Sep 17 00:00:00 2001 From: Po Yen Chen Date: Tue, 9 Apr 2024 13:39:18 +0000 Subject: [PATCH] Reuse the existing template less_equal<> in check_err() --- include/ck_tile/host/check_err.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/ck_tile/host/check_err.hpp b/include/ck_tile/host/check_err.hpp index baeb0b3537..b80023b336 100644 --- a/include/ck_tile/host/check_err.hpp +++ b/include/ck_tile/host/check_err.hpp @@ -291,10 +291,6 @@ std::enable_if_t<(std::is_same_v, ranges::range_val return either_not_finite && !(allow_infinity_ref && both_infinite_and_same); }; - static const auto less_equal = [](double lhs, double rhs) { - return lhs < rhs || bit_cast(lhs) == bit_cast(rhs); - }; - static const auto get_rounding_error = [](fp8_t o, fp8_t r) -> unsigned { static const auto get_sign_bit = [](fp8_t v) -> bool { return 0x80 & bit_cast(v); @@ -321,7 +317,8 @@ std::enable_if_t<(std::is_same_v, ranges::range_val const double o_fp64 = type_convert(o_fp8); const double r_fp64 = type_convert(r_fp8); err = std::abs(o_fp64 - r_fp64); - if(!(less_equal(err, atol) || get_rounding_error(o_fp8, r_fp8) <= rounding_error) || + if(!(less_equal{}(err, atol) || + get_rounding_error(o_fp8, r_fp8) <= rounding_error) || is_infinity_error(o_fp64, r_fp64)) { max_err = err > max_err ? err : max_err;