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
composable_kernel_ROCM
Commits
9cdd9165
"git@developer.sourcefind.cn:jerrrrry/dcu_megatron.git" did not exist on "4e867b3c37ca3ee38602c31011ced53e41f4071a"
Commit
9cdd9165
authored
Sep 24, 2024
by
Astha Rai
Browse files
fixed types file: bit-wise/memcpy issue
parent
76cf795a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
20 deletions
+6
-20
include/ck/utility/type.hpp
include/ck/utility/type.hpp
+6
-20
No files found.
include/ck/utility/type.hpp
View file @
9cdd9165
...
...
@@ -8,7 +8,7 @@
#include "ck/utility/integral_constant.hpp"
namespace
ck
{
#ifdef
__HIPCC
_RTC
__
#ifdef
CK_CODE_GEN
_RTC
// NOLINTNEXTLINE
#define CK_BUILTIN_TYPE_TRAIT1(name) \
template <class T> \
...
...
@@ -161,26 +161,12 @@ using remove_pointer_t = typename remove_pointer<T>::type;
template
<
typename
T
>
inline
constexpr
bool
is_pointer_v
=
is_pointer
<
T
>::
value
;
template
<
typename
Y
,
typename
X
,
typename
ck
::
enable_if
<
sizeof
(
X
)
==
sizeof
(
Y
),
bool
>
::
type
=
false
>
template
<
typename
Y
,
typename
X
,
typename
enable_if
<
sizeof
(
X
)
==
sizeof
(
Y
),
bool
>
::
type
=
false
>
__host__
__device__
constexpr
Y
bit_cast
(
const
X
&
x
)
{
#if CK_EXPERIMENTAL_USE_MEMCPY_FOR_BIT_CAST
Y
y
;
static_assert
(
__has_builtin
(
__builtin_bit_cast
),
""
);
static_assert
(
sizeof
(
X
)
==
sizeof
(
Y
),
"Do not support cast between different size of type"
)
;
__builtin_memcpy
(
&
y
,
&
x
,
sizeof
(
X
));
return
y
;
#else
union
AsType
{
X
x
;
Y
y
;
};
return
AsType
{
x
}.
y
;
#endif
return
__builtin_bit_cast
(
Y
,
x
);
}
}
// namespace ck
\ No newline at end of file
}
// namespace ck
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