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
a921f34c
Commit
a921f34c
authored
Nov 27, 2025
by
laibao
Browse files
增加 VLLM_USE_FUSE_SILU_AND_MUL 环境变量,用来控制 fused MoE 里 silu+mul 的融合 kernel。
parent
be22412f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
vllm/envs.py
vllm/envs.py
+5
-0
vllm/model_executor/layers/fused_moe/fused_moe.py
vllm/model_executor/layers/fused_moe/fused_moe.py
+6
-2
No files found.
vllm/envs.py
View file @
a921f34c
...
...
@@ -184,6 +184,7 @@ if TYPE_CHECKING:
VLLM_USE_PP_BALANCE
:
bool
=
False
VLLM_USE_ZERO_MTP
:
bool
=
False
VLLM_USE_CUDA_GRAPH_SIZES
:
bool
=
False
VLLM_USE_FUSE_SILU_AND_MUL
:
bool
=
True
def
get_default_cache_root
():
return
os
.
getenv
(
...
...
@@ -1194,6 +1195,10 @@ environment_variables: dict[str, Callable[[], Any]] = {
"VLLM_USE_CUDA_GRAPH_SIZES"
:
lambda
:
(
os
.
getenv
(
'VLLM_USE_CUDA_GRAPH_SIZES'
,
'True'
).
lower
()
in
(
"true"
,
"1"
)),
# vLLM will use fused silu+mul kernel
"VLLM_USE_FUSE_SILU_AND_MUL"
:
lambda
:
(
os
.
environ
.
get
(
"VLLM_USE_FUSE_SILU_AND_MUL"
,
"True"
).
lower
()
in
(
"true"
,
"1"
)),
}
# --8<-- [end:env-vars-definition]
...
...
vllm/model_executor/layers/fused_moe/fused_moe.py
View file @
a921f34c
...
...
@@ -1859,8 +1859,12 @@ def fused_experts_impl(
use_nn_moe
=
use_nn_moe
)
if
activation
==
"silu"
:
torch
.
ops
.
_C
.
silu_and_mul
(
intermediate_cache2
,
intermediate_cache1
.
view
(
-
1
,
N
))
if
envs
.
VLLM_USE_FUSE_SILU_AND_MUL
:
from
lightop
import
fuse_silu_and_mul
fuse_silu_and_mul
(
intermediate_cache1
.
view
(
-
1
,
N
),
intermediate_cache2
)
else
:
torch
.
ops
.
_C
.
silu_and_mul
(
intermediate_cache2
,
intermediate_cache1
.
view
(
-
1
,
N
))
elif
activation
==
"gelu"
:
torch
.
ops
.
_C
.
gelu_and_mul
(
intermediate_cache2
,
intermediate_cache1
.
view
(
-
1
,
N
))
...
...
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