"...composable_kernel.git" did not exist on "4df6d93f6092b4ffe6878fceeec15d4c70c94d62"
Commit f07a74d1 authored by Rostyslav Geyyer's avatar Rostyslav Geyyer
Browse files

Format

parent 21481b44
...@@ -1053,7 +1053,7 @@ template <> ...@@ -1053,7 +1053,7 @@ template <>
inline __host__ __device__ f8_t type_convert<f8_t, float>(float x) inline __host__ __device__ f8_t type_convert<f8_t, float>(float x)
{ {
constexpr bool negative_zero_nan = true; constexpr bool negative_zero_nan = true;
constexpr bool clip = true; constexpr bool clip = true;
// fp8 exponent/mantissa layout // fp8 exponent/mantissa layout
constexpr int we = 4; constexpr int we = 4;
...@@ -1088,14 +1088,13 @@ inline __host__ __device__ f8_t type_convert<f8_t, float>(float x) ...@@ -1088,14 +1088,13 @@ inline __host__ __device__ f8_t type_convert<f8_t, float>(float x)
if((_x & 0x7F800000) == 0x7F800000) if((_x & 0x7F800000) == 0x7F800000)
return signed_inf + (mantissa != 0 ? 1 : 0); return signed_inf + (mantissa != 0 ? 1 : 0);
} }
if(_x == 0) if(_x == 0)
return 0; return 0;
uint32_t drop_mask = (1 << (mfmt - wm)) - 1; uint32_t drop_mask = (1 << (mfmt - wm)) - 1;
const int max_exp = (1 << we) - (negative_zero_nan ? 1 : 2); const int max_exp = (1 << we) - (negative_zero_nan ? 1 : 2);
const int exp_low_cutoff = const int exp_low_cutoff = 128 - (1 << (we - 1)) + 1 - (negative_zero_nan ? 1 : 0);
128 - (1 << (we - 1)) + 1 - (negative_zero_nan ? 1 : 0);
exponent -= exp_low_cutoff - 1; exponent -= exp_low_cutoff - 1;
if(exponent <= 0) if(exponent <= 0)
...@@ -1169,7 +1168,7 @@ inline __host__ __device__ float type_convert<float, f8_t>(f8_t x) ...@@ -1169,7 +1168,7 @@ inline __host__ __device__ float type_convert<float, f8_t>(f8_t x)
uint32_t sign = x >> 7; uint32_t sign = x >> 7;
uint32_t mantissa = x & ((1 << wm) - 1); uint32_t mantissa = x & ((1 << wm) - 1);
int exponent = (x & 0x7F) >> wm; int exponent = (x & 0x7F) >> wm;
if(negative_zero_nan) if(negative_zero_nan)
{ {
if(x == 0x80) if(x == 0x80)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment