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
jerrrrry
infinicore
Commits
75a9b69e
Commit
75a9b69e
authored
Mar 04, 2026
by
pengcheng888
Browse files
issue/1042 - fix address misaligned error of rearrange
parent
b2f915cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
src/utils/rearrange.cc
src/utils/rearrange.cc
+5
-2
No files found.
src/utils/rearrange.cc
View file @
75a9b69e
...
...
@@ -144,11 +144,14 @@ void rearrange(
utils
::
Result
<
RearrangeMeta
>
RearrangeMeta
::
distributeUnit
(
const
std
::
vector
<
size_t
>
&
candidates
)
const
{
// 获取当前的unit大小
size_t
current_unit
=
_meta
[
0
];
const
size_t
ndim
=
this
->
ndim
();
const
ptrdiff_t
dst_strides_0
=
_meta
[
2
+
ndim
];
const
ptrdiff_t
src_strides_0
=
_meta
[
2
+
ndim
+
ndim
];
// 寻找满足条件的unit值:当前unit能被其整除
size_t
new_unit
=
0
;
for
(
size_t
candidate
:
candidates
)
{
if
(
current_unit
%
candidate
==
0
)
{
for
(
const
size_t
&
candidate
:
candidates
)
{
if
(
(
current_unit
%
candidate
==
0
)
&&
0
==
(
dst_strides_0
&
(
candidate
-
1
))
&&
0
==
(
src_strides_0
&
(
candidate
-
1
)))
{
new_unit
=
candidate
;
break
;
}
...
...
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