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
a5c38ebe
Commit
a5c38ebe
authored
Nov 16, 2023
by
Umang Yadav
Browse files
add note
parent
61e4e1d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
src/include/migraphx/float8_impl.hpp
src/include/migraphx/float8_impl.hpp
+3
-1
No files found.
src/include/migraphx/float8_impl.hpp
View file @
a5c38ebe
...
...
@@ -168,7 +168,9 @@ constexpr uint8_t cast_to_f8(T f_x, bool stoch = false, uint32_t rng = 0)
}
mantissa
+=
(
1u
<<
mfmt
);
// Add the implicit 1 into mantissa
}
// shifting by more than sizeof(T) is undefined behaviour, cap shift to 31
// need to know whether the number is right in the middle of two adjacent fp8 numbers. use max
// value of 31 to avoid undefined behaviour
bool
midpoint
=
(
mantissa
&
((
1u
<<
std
::
min
(
31u
,
mfmt
-
Wm
+
exponent_diff
))
-
1
))
==
(
1u
<<
std
::
min
(
31u
,
mfmt
-
Wm
+
exponent_diff
-
1
));
/* This part is a bit tricky. The judgment of whether it is a tie needs to be done before we
...
...
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