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
ccebca5e
Commit
ccebca5e
authored
May 18, 2023
by
Po-Yen, Chen
Browse files
Fix wrong boundar calculation logic
parent
8b7ea41d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
include/ck/utility/readfirstlane.hpp
include/ck/utility/readfirstlane.hpp
+7
-7
No files found.
include/ck/utility/readfirstlane.hpp
View file @
ccebca5e
...
@@ -58,24 +58,24 @@ __device__ auto readfirstlane(const Object& obj)
...
@@ -58,24 +58,24 @@ __device__ auto readfirstlane(const Object& obj)
alignas
(
Object
)
std
::
byte
to_obj
[
ObjectSize
];
alignas
(
Object
)
std
::
byte
to_obj
[
ObjectSize
];
auto
*
const
from_obj
=
reinterpret_cast
<
const
std
::
byte
*>
(
&
obj
);
auto
*
const
from_obj
=
reinterpret_cast
<
const
std
::
byte
*>
(
&
obj
);
static_for
<
0
,
ObjectSize
,
SgprSize
>
{}([
&
](
auto
offset
)
{
constexpr
std
::
size_t
RemainedSize
=
ObjectSize
%
SgprSize
;
constexpr
std
::
size_t
CompleteSgprCopyBoundary
=
ObjectSize
-
RemainedSize
;
static_for
<
0
,
CompleteSgprCopyBoundary
,
SgprSize
>
{}([
&
](
auto
offset
)
{
*
reinterpret_cast
<
Sgpr
*>
(
to_obj
+
offset
)
=
*
reinterpret_cast
<
Sgpr
*>
(
to_obj
+
offset
)
=
readfirstlane
(
*
reinterpret_cast
<
const
Sgpr
*>
(
from_obj
+
offset
));
readfirstlane
(
*
reinterpret_cast
<
const
Sgpr
*>
(
from_obj
+
offset
));
});
});
constexpr
std
::
size_t
RemainedSize
=
ObjectSize
%
SgprSize
;
if
constexpr
(
0
<
RemainedSize
)
if
constexpr
(
0
<
RemainedSize
)
{
{
using
Carrier
=
detail
::
get_signed_int_t
<
RemainedSize
>
;
using
Carrier
=
detail
::
get_signed_int_t
<
RemainedSize
>
;
constexpr
std
::
size_t
offset
=
SgprSize
*
math
::
integer_divide_floor
(
ObjectSize
,
SgprSize
);
*
reinterpret_cast
<
Carrier
>
(
to_obj
+
CompleteSgprCopyBoundary
)
=
readfirstlane
(
*
reinterpret_cast
<
const
Carrier
*>
(
from_obj
+
CompleteSgprCopyBoundary
));
*
reinterpret_cast
<
Carrier
>
(
to_obj
+
offset
)
=
readfirstlane
(
*
reinterpret_cast
<
const
Carrier
*>
(
from_obj
+
offset
));
}
}
/// NOTE: Implicitly start object lifetime. It's better to use
/// NOTE: Implicitly start object lifetime. It's better to use
// std::start_lifetime_at() in this scenario
//
/
std::start_lifetime_at() in this scenario
return
*
reinterpret_cast
<
Object
*>
(
to_obj
);
return
*
reinterpret_cast
<
Object
*>
(
to_obj
);
}
}
...
...
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