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
16b5e050
"docker/Dockerfile.rocm" did not exist on "05d72dfcf473127cd866cb382929866d88b2a608"
Commit
16b5e050
authored
Oct 31, 2023
by
Umang Yadav
Browse files
Compiles all right now
parent
c2b41d9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
src/include/migraphx/fp8e4m3fnuz.hpp
src/include/migraphx/fp8e4m3fnuz.hpp
+9
-8
No files found.
src/include/migraphx/fp8e4m3fnuz.hpp
View file @
16b5e050
...
...
@@ -56,11 +56,12 @@
#include <string>
#include <utility>
#if defined
__HIP_PLATFORM_HCC__
// MI
Open
by default does not have device code in the regular compilation paths,
#if defined
(__HIP_PLATFORM_AMD__) || defined(
__HIP_PLATFORM_HCC__
)
// MI
GraphX
by default does not have device code in the regular compilation paths,
// therefore, when this file is used from the host side, compilation takes much
// longer. By guarding the __device__ directive we can control that such compilation
// only happens for kernels which include this file.
#include <hip/hip_runtime.h>
#define MIGRAPHX_HIP_HOST_DEVICE __host__ __device__
#else
#define MIGRAPHX_HIP_HOST_DEVICE
...
...
@@ -74,7 +75,7 @@ namespace migraphx {
namespace
detail
{
inline
float
MIGRAPHX_HIP_HOST_DEVICE
fp32_from_bits
(
uint32_t
w
)
inline
MIGRAPHX_HIP_HOST_DEVICE
float
fp32_from_bits
(
uint32_t
w
)
{
union
{
...
...
@@ -84,7 +85,7 @@ inline float MIGRAPHX_HIP_HOST_DEVICE fp32_from_bits(uint32_t w)
return
fp32
.
as_value
;
}
inline
uint32_t
MIGRAPHX_HIP_HOST_DEVICE
fp32_to_bits
(
float
f
)
inline
MIGRAPHX_HIP_HOST_DEVICE
uint32_t
fp32_to_bits
(
float
f
)
{
union
{
...
...
@@ -101,7 +102,7 @@ inline uint32_t MIGRAPHX_HIP_HOST_DEVICE fp32_to_bits(float f)
*
* @note The implementation doesn't use any floating-point operations.
*/
inline
float
MIGRAPHX_HIP_HOST_DEVICE
fp8e4m3fnuz_to_fp32_value
(
uint8_t
input
)
inline
MIGRAPHX_HIP_HOST_DEVICE
float
fp8e4m3fnuz_to_fp32_value
(
uint8_t
input
)
{
constexpr
float
e4m3fnuz_lut
[
256
]
=
{
0.0
f
,
0.0009765625
f
,
0.001953125
f
,
...
...
@@ -199,7 +200,7 @@ inline float MIGRAPHX_HIP_HOST_DEVICE fp8e4m3fnuz_to_fp32_value(uint8_t input)
* Convert a 32-bit floating-point number in IEEE single-precision format to a
* 8-bit floating-point number in fp8 E4M3FNUZ format, in bit representation.
*/
inline
uint8_t
MIGRAPHX_HIP_HOST_DEVICE
fp8e4m3fnuz_from_fp32_value
(
float
f
)
inline
MIGRAPHX_HIP_HOST_DEVICE
uint8_t
fp8e4m3fnuz_from_fp32_value
(
float
f
)
{
/*
* Binary representation of 256.0f, which is the first value not representable
...
...
@@ -283,9 +284,9 @@ struct alignas(1) fp8e4m3fnuz
struct
from_bits_t
{
};
__device__
__host__
static
constexpr
from_bits_t
from_bits
()
{
return
from_bits_t
();
}
static
constexpr
MIGRAPHX_HIP_HOST_DEVICE
from_bits_t
from_bits
()
{
return
from_bits_t
();
}
__device__
__host__
fp8e4m3fnuz
()
:
x
(
0
)
{}
MIGRAPHX_HIP_HOST_DEVICE
fp8e4m3fnuz
()
:
x
(
0
)
{}
MIGRAPHX_HIP_HOST_DEVICE
constexpr
fp8e4m3fnuz
(
uint8_t
bits
,
from_bits_t
)
:
x
(
bits
)
{}
...
...
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