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
aed1922b
Commit
aed1922b
authored
Nov 17, 2023
by
Umang Yadav
Browse files
Remove unnecessary pragmas
parent
85ba819b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
54 deletions
+6
-54
src/targets/gpu/kernels/include/migraphx/kernels/float8.hpp
src/targets/gpu/kernels/include/migraphx/kernels/float8.hpp
+6
-54
No files found.
src/targets/gpu/kernels/include/migraphx/kernels/float8.hpp
View file @
aed1922b
...
@@ -24,9 +24,6 @@
...
@@ -24,9 +24,6 @@
#define MIGRAPHX_GUARD_KERNELS_FLOAT8_HPP
#define MIGRAPHX_GUARD_KERNELS_FLOAT8_HPP
#if defined(__clang__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wfloat-equal"
#pragma clang diagnostic ignored "-Wmacro-redefined"
#pragma clang diagnostic ignored "-Wc++20-extensions"
#pragma clang diagnostic ignored "-Wc++20-extensions"
#endif // __clang__
#endif // __clang__
...
@@ -268,7 +265,7 @@ struct float8
...
@@ -268,7 +265,7 @@ struct float8
}
}
}
}
#define MIGRAPHX_FP8_UNARY_OP(unary_op, binary_op)
\
#define MIGRAPHX_FP8_
SHORT_
UNARY_OP(unary_op, binary_op) \
constexpr float8& MIGRAPHX_HIP_DEVICE operator unary_op(const float8& rhs) \
constexpr float8& MIGRAPHX_HIP_DEVICE operator unary_op(const float8& rhs) \
{ \
{ \
const auto tmp = static_cast<float>(*this) binary_op static_cast<float>(rhs); \
const auto tmp = static_cast<float>(*this) binary_op static_cast<float>(rhs); \
...
@@ -282,10 +279,10 @@ struct float8
...
@@ -282,10 +279,10 @@ struct float8
return *this; \
return *this; \
}
}
MIGRAPHX_FP8_UNARY_OP
(
*=
,
*
)
MIGRAPHX_FP8_
SHORT_
UNARY_OP
(
*=
,
*
)
MIGRAPHX_FP8_UNARY_OP
(
-=
,
-
)
MIGRAPHX_FP8_
SHORT_
UNARY_OP
(
-=
,
-
)
MIGRAPHX_FP8_UNARY_OP
(
+=
,
+
)
MIGRAPHX_FP8_
SHORT_
UNARY_OP
(
+=
,
+
)
MIGRAPHX_FP8_UNARY_OP
(
/=
,
/
)
MIGRAPHX_FP8_
SHORT_
UNARY_OP
(
/=
,
/
)
inline
MIGRAPHX_HIP_DEVICE
constexpr
float8
&
operator
=
(
const
float8
&
rhs
)
=
default
;
inline
MIGRAPHX_HIP_DEVICE
constexpr
float8
&
operator
=
(
const
float8
&
rhs
)
=
default
;
inline
MIGRAPHX_HIP_DEVICE
constexpr
float8
&
operator
=
(
float8
&&
rhs
)
=
default
;
inline
MIGRAPHX_HIP_DEVICE
constexpr
float8
&
operator
=
(
float8
&&
rhs
)
=
default
;
...
@@ -483,52 +480,7 @@ class numeric_limits<fp8e5m2>
...
@@ -483,52 +480,7 @@ class numeric_limits<fp8e5m2>
return
fp8e5m2
(
0x7C
,
fp8e5m2
::
from_bits
());
return
fp8e5m2
(
0x7C
,
fp8e5m2
::
from_bits
());
}
}
};
};
/*
// Use h/w intrinsic and optimized version when __gfx940__
template <typename T,
typename Ta,
bool stochastic_rounding,
typename std::enable_if<(!(migraphx::is_same<T, Ta>{}) &&
(migraphx::is_same<T, migraphx_f8>{} ||
migraphx::is_same<T, migraphx_bf8>{})),
int>::type = 0>
inline __host__ __device__ T explicit_downcast(Ta a, uint32_t rng)
{
#if defined(__gfx940__) || defined(__gfx941__) || defined(__gfx942__)
// NOTE: we are directly calling cast_to_f8_from_f32 instead of constructor to optimize
// away one runtime branch
T val;
if(migraphx::is_same<T, migraphx_f8>::value)
val.data = migraphx_f8::cast_to_f8_from_f32<stochastic_rounding>(float(a), rng);
else
val.data = migraphx_bf8::cast_to_bf8_from_f32<stochastic_rounding>(float(a), rng);
return val;
#else // non gfx940
return T(float(a),
stochastic_rounding ? migraphx::fp8::rounding_mode::stochastic
: migraphx::fp8::rounding_mode::standard,
rng);
#endif // __gfx940__
}
// NOTE NOTE: The above code is good if we don't consider HIP-GEMM code and only consider
// the quantization However, if we need HIP-GEMM for fall-back, we would need explicit_cast
// handles Tacc=f32 to To=f16/bf16 conversion
template <typename T,
typename Ta,
bool stochastic_rounding,
typename std::enable_if<(!(migraphx::is_same<T, Ta>{}) &&
!(migraphx::is_same<T, migraphx_f8>{} ||
migraphx::is_same<T, migraphx_bf8>{})),
int>::type = 0>
inline __host__ __device__ T explicit_downcast(Ta a, uint32_t rng)
{
// the return type is not a F8 types, no SR for those types
// not sure if we have direct conversion, so converting to float first
// no effect if the input type is float
return T(float(a));
}
*/
}
// namespace fp8
}
// namespace fp8
}
// namespace migraphx
}
// namespace migraphx
// =================================================================================================
// =================================================================================================
...
...
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