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
47790f3e
Unverified
Commit
47790f3e
authored
Sep 14, 2024
by
youkaichao
Committed by
GitHub
Sep 14, 2024
Browse files
[torch.compile] add a flag to disable custom op (#8488)
parent
a36e070d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
tests/compile/test_full_graph.py
tests/compile/test_full_graph.py
+2
-1
vllm/envs.py
vllm/envs.py
+5
-0
vllm/model_executor/custom_op.py
vllm/model_executor/custom_op.py
+5
-0
No files found.
tests/compile/test_full_graph.py
View file @
47790f3e
...
...
@@ -6,7 +6,8 @@ import pytest
@
pytest
.
mark
.
parametrize
(
"model"
,
[
"meta-llama/Meta-Llama-3-8B"
])
def
test_full_graph
(
model
):
# make sure these models can be captured in full graph mode
os
.
environ
[
"VLLM_TEST_DYNAMO_GRAPH_CAPTURE"
]
=
"1"
if
"VLLM_TEST_DYNAMO_GRAPH_CAPTURE"
not
in
os
.
environ
:
os
.
environ
[
"VLLM_TEST_DYNAMO_GRAPH_CAPTURE"
]
=
"1"
from
vllm
import
LLM
,
SamplingParams
prompts
=
[
...
...
vllm/envs.py
View file @
47790f3e
...
...
@@ -202,6 +202,11 @@ environment_variables: Dict[str, Callable[[], Any]] = {
(
os
.
environ
.
get
(
"VLLM_DYNAMO_USE_CUSTOM_DISPATCHER"
,
"True"
).
lower
()
in
(
"true"
,
"1"
)),
# Internal flag to control whether we use custom op,
# or use the native pytorch implementation
"VLLM_TEST_COMPILE_NO_CUSTOM_OPS"
:
lambda
:
int
(
os
.
environ
.
get
(
"VLLM_TEST_COMPILE_NO_CUSTOM_OPS"
,
"0"
)),
# Internal flag to enable Dynamo fullgraph capture
"VLLM_TEST_DYNAMO_FULLGRAPH_CAPTURE"
:
lambda
:
bool
(
...
...
vllm/model_executor/custom_op.py
View file @
47790f3e
import
torch.nn
as
nn
import
vllm.envs
as
envs
from
vllm.platforms
import
current_platform
from
vllm.utils
import
is_cpu
,
is_hip
,
is_xpu
...
...
@@ -53,6 +54,10 @@ class CustomOp(nn.Module):
def
dispatch_forward
(
self
):
# NOTE(woosuk): Here we assume that vLLM was built for only one
# specific backend. Currently, we do not support dynamic dispatching.
if
envs
.
VLLM_TEST_COMPILE_NO_CUSTOM_OPS
:
return
self
.
forward_native
if
is_hip
():
return
self
.
forward_hip
elif
is_cpu
():
...
...
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