Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
13ea39bc
Unverified
Commit
13ea39bc
authored
Dec 02, 2025
by
Zhang Xiangze
Committed by
GitHub
Dec 02, 2025
Browse files
[CPU]Parallelize over tokens in int4 moe (#29600)
Signed-off-by:
Zhang Xiangze
<
Xiangze.Zhang@arm.com
>
parent
4b612664
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
csrc/moe/dynamic_4bit_int_moe_cpu.cpp
csrc/moe/dynamic_4bit_int_moe_cpu.cpp
+6
-6
No files found.
csrc/moe/dynamic_4bit_int_moe_cpu.cpp
View file @
13ea39bc
...
@@ -93,16 +93,16 @@ torch::Tensor dynamic_4bit_int_moe_cpu(
...
@@ -93,16 +93,16 @@ torch::Tensor dynamic_4bit_int_moe_cpu(
}
}
auto
Y_all
=
at
::
empty
({
offsets
[
E
],
H
},
x_c
.
options
());
auto
Y_all
=
at
::
empty
({
offsets
[
E
],
H
},
x_c
.
options
());
at
::
parallel_for
(
0
,
E
,
1
,
[
&
](
int64_t
e
_begin
,
int64_t
e
_end
)
{
at
::
parallel_for
(
0
,
offsets
[
E
]
,
0
,
[
&
](
int64_t
idx
_begin
,
int64_t
idx
_end
)
{
c10
::
InferenceMode
guard
;
c10
::
InferenceMode
guard
;
for
(
int64_t
e
=
e_begin
;
e
<
e_end
;
++
e
)
{
for
(
int64_t
e
=
0
;
e
<
E
;
++
e
)
{
const
int64_t
te
=
counts
[
e
];
int64_t
start
=
std
::
max
(
offsets
[
e
],
idx_begin
);
if
(
te
==
0
)
{
int64_t
end
=
std
::
min
(
offsets
[
e
+
1
],
idx_end
);
int64_t
te
=
end
-
start
;
if
(
te
<=
0
)
{
continue
;
continue
;
}
}
const
int64_t
start
=
offsets
[
e
];
auto
x_e
=
X_all
.
narrow
(
/*dim=*/
0
,
/*start=*/
start
,
/*length=*/
te
);
auto
x_e
=
X_all
.
narrow
(
/*dim=*/
0
,
/*start=*/
start
,
/*length=*/
te
);
auto
w13_e
=
w13_packed
.
select
(
/*dim=*/
0
,
e
);
auto
w13_e
=
w13_packed
.
select
(
/*dim=*/
0
,
e
);
...
...
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