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
Commits
8b7ea41d
Commit
8b7ea41d
authored
May 17, 2023
by
Po-Yen, Chen
Browse files
Add 'inline' specifier to funcion definition
parent
fb51f338
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
include/ck/utility/readfirstlane.hpp
include/ck/utility/readfirstlane.hpp
+10
-8
No files found.
include/ck/utility/readfirstlane.hpp
View file @
8b7ea41d
...
@@ -40,7 +40,7 @@ using get_signed_int_t = typename get_signed_int<Size>::type;
...
@@ -40,7 +40,7 @@ using get_signed_int_t = typename get_signed_int<Size>::type;
}
// namespace detail
}
// namespace detail
__device__
std
::
int32_t
readfirstlane
(
std
::
int32_t
value
)
__device__
inline
std
::
int32_t
readfirstlane
(
std
::
int32_t
value
)
{
{
return
__builtin_amdgcn_readfirstlane
(
value
);
return
__builtin_amdgcn_readfirstlane
(
value
);
}
}
...
@@ -55,12 +55,12 @@ __device__ auto readfirstlane(const Object& obj)
...
@@ -55,12 +55,12 @@ __device__ auto readfirstlane(const Object& obj)
using
Sgpr
=
detail
::
get_signed_int_t
<
SgprSize
>
;
using
Sgpr
=
detail
::
get_signed_int_t
<
SgprSize
>
;
alignas
(
Object
)
std
::
byte
memory
[
ObjectSize
];
alignas
(
Object
)
std
::
byte
to_obj
[
ObjectSize
];
auto
*
const
from
=
reinterpret_cast
<
const
std
::
byte
*>
(
&
obj
);
auto
*
const
from
_obj
=
reinterpret_cast
<
const
std
::
byte
*>
(
&
obj
);
static_for
<
0
,
ObjectSize
,
SgprSize
>
{}([
&
](
auto
offset
)
{
static_for
<
0
,
ObjectSize
,
SgprSize
>
{}([
&
](
auto
offset
)
{
*
reinterpret_cast
<
Sgpr
*>
(
memory
+
offset
)
=
*
reinterpret_cast
<
Sgpr
*>
(
to_obj
+
offset
)
=
readfirstlane
(
*
reinterpret_cast
<
const
Sgpr
*>
(
from
+
offset
));
readfirstlane
(
*
reinterpret_cast
<
const
Sgpr
*>
(
from
_obj
+
offset
));
});
});
constexpr
std
::
size_t
RemainedSize
=
ObjectSize
%
SgprSize
;
constexpr
std
::
size_t
RemainedSize
=
ObjectSize
%
SgprSize
;
...
@@ -70,11 +70,13 @@ __device__ auto readfirstlane(const Object& obj)
...
@@ -70,11 +70,13 @@ __device__ auto readfirstlane(const Object& obj)
constexpr
std
::
size_t
offset
=
SgprSize
*
math
::
integer_divide_floor
(
ObjectSize
,
SgprSize
);
constexpr
std
::
size_t
offset
=
SgprSize
*
math
::
integer_divide_floor
(
ObjectSize
,
SgprSize
);
*
reinterpret_cast
<
Carrier
>
(
memory
+
offset
)
=
*
reinterpret_cast
<
Carrier
>
(
to_obj
+
offset
)
=
readfirstlane
(
*
reinterpret_cast
<
const
Carrier
*>
(
from
+
offset
));
readfirstlane
(
*
reinterpret_cast
<
const
Carrier
*>
(
from
_obj
+
offset
));
}
}
return
*
reinterpret_cast
<
Object
*>
(
memory
);
/// NOTE: Implicitly start object lifetime. It's better to use
// std::start_lifetime_at() in this scenario
return
*
reinterpret_cast
<
Object
*>
(
to_obj
);
}
}
}
// namespace ck
}
// 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