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
738648fb
Unverified
Commit
738648fb
authored
Dec 15, 2025
by
Shanshan Shen
Committed by
GitHub
Dec 15, 2025
Browse files
[CustomOp] Support object-level enable for CustomOp (#30547)
Signed-off-by:
shen-shanshan
<
467638484@qq.com
>
parent
917fdae5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
vllm/model_executor/custom_op.py
vllm/model_executor/custom_op.py
+7
-2
No files found.
vllm/model_executor/custom_op.py
View file @
738648fb
...
...
@@ -38,8 +38,9 @@ class CustomOp(nn.Module):
)
return
super
().
__new__
(
op_cls_to_instantiate
)
def
__init__
(
self
):
def
__init__
(
self
,
enforce_enable
:
bool
=
False
):
super
().
__init__
()
self
.
_enforce_enable
=
enforce_enable
self
.
_forward_method
=
self
.
dispatch_forward
()
def
forward
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -84,7 +85,11 @@ class CustomOp(nn.Module):
# NOTE(woosuk): Here we assume that vLLM was built for only one
# specific backend. Currently, we do not support dynamic dispatching.
compilation_config
=
get_cached_compilation_config
()
enabled
=
self
.
enabled
()
# CustomOp object can be enforce enabled, e.g., enable device-specific
# kernels in ViT models when enabling graph mode. By default, it will
# follow the compilation_config to determine whether enable itself.
enabled
=
self
.
_enforce_enable
or
self
.
enabled
()
if
enabled
:
compilation_config
.
enabled_custom_ops
.
update
([
self
.
__class__
.
name
])
else
:
...
...
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