From 5ba3c3edd782b4f6e20a7ae877e5da9f324c05e8 Mon Sep 17 00:00:00 2001 From: Gino Lu Date: Wed, 2 Jul 2025 14:53:00 +0800 Subject: [PATCH] Fix return value bug that drops minus sign in some cases. (#2415) * fix return value bug. * refine change according to comment. [ROCm/composable_kernel commit: 60eb70f5436c41dc6e227b5b1d7f9a6445b17892] --- include/ck/utility/mxfp_utils.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ck/utility/mxfp_utils.hpp b/include/ck/utility/mxfp_utils.hpp index cf7a3e8713..ebed85f5fd 100644 --- a/include/ck/utility/mxfp_utils.hpp +++ b/include/ck/utility/mxfp_utils.hpp @@ -213,7 +213,7 @@ __host__ __device__ inline T convert_to_type(float value) { // closer to 0 if(std::abs(value) <= std::abs(min_subnorm - value)) - return 0; + return sign << (NumericUtils::exp + NumericUtils::mant); else return 1 | (sign << (NumericUtils::exp + NumericUtils::mant)); } @@ -249,7 +249,7 @@ __host__ __device__ inline T convert_to_type(float value) if(out_exponent == 0 && mantissa == 0) { - return 0; + return sign << (NumericUtils::exp + NumericUtils::mant); } mantissa &= (1UL << NumericUtils::mant) - 1;