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
c62d7bf9
"src/targets/vscode:/vscode.git/clone" did not exist on "cced8ba3e150a7670fddb527e117e6dc40c4798f"
Commit
c62d7bf9
authored
Nov 09, 2023
by
Umang Yadav
Browse files
make numerical limits constexpr
parent
988fab58
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
14 deletions
+24
-14
src/include/migraphx/migraphx_float8.hpp
src/include/migraphx/migraphx_float8.hpp
+24
-12
test/float8.cpp
test/float8.cpp
+0
-2
No files found.
src/include/migraphx/migraphx_float8.hpp
View file @
c62d7bf9
...
...
@@ -474,34 +474,40 @@ template <>
class
NumericLimits
<
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>>
{
public:
static
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
epsilon
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
epsilon
()
{
return
static_cast
<
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>>
(
float
(
0.0625
));
}
static
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
quiet_NaN
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
quiet_NaN
()
{
return
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
(
MIGRAPHX_FP8_FNUZ
?
0x80
:
0x7F
,
migraphx_fp8
::
hip_f8
<>::
from_bits
());
}
static
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
max
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
max
()
{
return
migraphx_fp8
::
F8_Max
<
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
>
min
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
min
()
{
return
static_cast
<
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>>
(
-
1.0
f
)
*
migraphx_fp8
::
F8_Max
<
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
>
lowest
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
lowest
()
{
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
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
infinity
()
{
return
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
fp8
>
(
MIGRAPHX_FP8_FNUZ
?
0x80
:
0x7F
,
migraphx_fp8
::
hip_f8
<>::
from_bits
());
...
...
@@ -512,35 +518,41 @@ template <>
class
NumericLimits
<
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>>
{
public:
static
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
epsilon
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
epsilon
()
{
return
static_cast
<
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>>
(
float
(
0.125
));
}
static
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
quiet_NaN
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
quiet_NaN
()
{
return
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
(
MIGRAPHX_FP8_FNUZ
?
0x80
:
0x7d
,
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>::
from_bits
());
}
static
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
max
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
max
()
{
return
static_cast
<
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>>
(
migraphx_fp8
::
F8_Max
<
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
>
min
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
min
()
{
return
static_cast
<
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>>
(
float
(
-
1.0
f
))
*
migraphx_fp8
::
F8_Max
<
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
>
lowest
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
lowest
()
{
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
()
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
infinity
()
{
return
migraphx_fp8
::
hip_f8
<
migraphx_fp8
::
hip_f8_type
::
bf8
>
(
MIGRAPHX_FP8_FNUZ
?
0x80
:
0x7c
,
...
...
test/float8.cpp
View file @
c62d7bf9
...
...
@@ -167,9 +167,7 @@ TEST_CASE(test_nan_1)
TEST_CASE
(
test_nan_2
)
{
auto
fnan
=
std
::
numeric_limits
<
migraphx_fp8
::
fp8e4m3fnuz
>::
quiet_NaN
();
std
::
cout
<<
uint32_t
(
fnan
.
data
)
<<
std
::
endl
;
migraphx_fp8
::
fp8e4m3fnuz
fp8_nan
(
fnan
.
data
,
migraphx_fp8
::
fp8e4m3fnuz
::
from_bits
());
std
::
cout
<<
uint32_t
(
fp8_nan
.
data
)
<<
std
::
endl
;
EXPECT
(
fp8_nan
.
is_nan
());
EXPECT
(
std
::
isnan
(
fp8_nan
));
EXPECT
(
std
::
isnan
(
float
(
fp8_nan
)));
...
...
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