Commit ae17b19c authored by Umang Yadav's avatar Umang Yadav
Browse files

add literals limit test

parent 27598fab
...@@ -500,6 +500,17 @@ class NumericLimits<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::fp8>> ...@@ -500,6 +500,17 @@ class NumericLimits<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::fp8>>
{ {
return migraphx_fp8::F8_Lowest<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::fp8>>(); return migraphx_fp8::F8_Lowest<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::fp8>>();
} }
static MIGRAPHX_HIP_HOST_DEVICE migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::fp8> infinity()
{
if constexpr(MIGRAPHX_FP8_FNUZ)
{
return static_cast<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::fp8>>(
static_cast<uint8_t>(0x80));
}
return static_cast<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::fp8>>(
static_cast<uint8_t>(0x78));
}
}; };
template <> template <>
...@@ -532,6 +543,17 @@ class NumericLimits<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::bf8>> ...@@ -532,6 +543,17 @@ class NumericLimits<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::bf8>>
{ {
return migraphx_fp8::F8_Lowest<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::bf8>>(); return migraphx_fp8::F8_Lowest<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::bf8>>();
} }
static MIGRAPHX_HIP_HOST_DEVICE migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::bf8> infinity()
{
if constexpr(MIGRAPHX_FP8_FNUZ)
{
return static_cast<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::bf8>>(
static_cast<uint8_t>(0x80));
}
return static_cast<migraphx_fp8::hip_f8<migraphx_fp8::hip_f8_type::bf8>>(
static_cast<uint8_t>(0x7c));
}
}; };
/* /*
// Use h/w intrinsic and optimized version when __gfx940__ // Use h/w intrinsic and optimized version when __gfx940__
......
...@@ -251,7 +251,7 @@ MIGRAPHX_HIP_HOST_DEVICE constexpr T cast_from_f8(uint8_t x) ...@@ -251,7 +251,7 @@ MIGRAPHX_HIP_HOST_DEVICE constexpr T cast_from_f8(uint8_t x)
uint32_t ifNegInf = 0xFF800000; uint32_t ifNegInf = 0xFF800000;
uint32_t ifNaN = 0x7F800001; uint32_t ifNaN = 0x7F800001;
uint32_t ifNeg0 = 0x80000000; uint32_t ifNeg0 = 0x80000000;
// TODO: need to change T for half but right now it would never be called with half // TODO: need to change T for half but right now it would never called with half
fInf = detail::bit_cast<float>(ifInf); fInf = detail::bit_cast<float>(ifInf);
fNegInf = detail::bit_cast<float>(ifNegInf); fNegInf = detail::bit_cast<float>(ifNegInf);
fNaN = detail::bit_cast<float>(ifNaN); fNaN = detail::bit_cast<float>(ifNaN);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "migraphx/migraphx_float8.hpp"
#include "verify_program.hpp" #include "verify_program.hpp"
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
...@@ -52,3 +53,4 @@ template struct test_literal_limits<migraphx::shape::double_type, double>; ...@@ -52,3 +53,4 @@ template struct test_literal_limits<migraphx::shape::double_type, double>;
template struct test_literal_limits<migraphx::shape::half_type, migraphx::half>; template struct test_literal_limits<migraphx::shape::half_type, migraphx::half>;
template struct test_literal_limits<migraphx::shape::int32_type, int32_t>; template struct test_literal_limits<migraphx::shape::int32_type, int32_t>;
template struct test_literal_limits<migraphx::shape::int8_type, int8_t>; template struct test_literal_limits<migraphx::shape::int8_type, int8_t>;
template struct test_literal_limits<migraphx::shape::float8_type, migraphx_fp8::fp8e4m3fnuz>;
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