Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
ae17b19c
Commit
ae17b19c
authored
Nov 09, 2023
by
Umang Yadav
Browse files
add literals limit test
parent
27598fab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
src/include/migraphx/migraphx_float8.hpp
src/include/migraphx/migraphx_float8.hpp
+22
-0
src/include/migraphx/migraphx_hip_f8_impl.hpp
src/include/migraphx/migraphx_hip_f8_impl.hpp
+1
-1
test/verify/test_literal_limits.cpp
test/verify/test_literal_limits.cpp
+2
-0
No files found.
src/include/migraphx/migraphx_float8.hpp
View file @
ae17b19c
...
@@ -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__
...
...
src/include/migraphx/migraphx_hip_f8_impl.hpp
View file @
ae17b19c
...
@@ -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
);
...
...
test/verify/test_literal_limits.cpp
View file @
ae17b19c
...
@@ -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
>;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment