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
26bc4bbc
Unverified
Commit
26bc4bbc
authored
May 01, 2025
by
Keyun Tong
Committed by
GitHub
May 01, 2025
Browse files
Avoid overwriting vllm_compile_cache.py (#17418)
Signed-off-by:
Keyun Tong
<
tongkeyun@gmail.com
>
parent
3c3d7672
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
vllm/compilation/backends.py
vllm/compilation/backends.py
+5
-3
No files found.
vllm/compilation/backends.py
View file @
26bc4bbc
...
@@ -45,6 +45,7 @@ class CompilerManager:
...
@@ -45,6 +45,7 @@ class CompilerManager:
self
.
cache
:
Dict
[
Tuple
[
Optional
[
int
],
int
,
str
],
Any
]
=
dict
()
self
.
cache
:
Dict
[
Tuple
[
Optional
[
int
],
int
,
str
],
Any
]
=
dict
()
cls
=
InductorAdaptor
if
use_inductor
else
EagerAdaptor
cls
=
InductorAdaptor
if
use_inductor
else
EagerAdaptor
self
.
compiler
=
cls
()
self
.
compiler
=
cls
()
self
.
is_cache_updated
=
False
def
compute_hash
(
self
,
vllm_config
:
VllmConfig
)
->
str
:
def
compute_hash
(
self
,
vllm_config
:
VllmConfig
)
->
str
:
return
self
.
compiler
.
compute_hash
(
vllm_config
)
return
self
.
compiler
.
compute_hash
(
vllm_config
)
...
@@ -66,11 +67,11 @@ class CompilerManager:
...
@@ -66,11 +67,11 @@ class CompilerManager:
disable_cache
=
disable_cache
)
disable_cache
=
disable_cache
)
def
save_to_file
(
self
):
def
save_to_file
(
self
):
if
self
.
disable_cache
:
if
self
.
disable_cache
or
not
self
.
is_cache_updated
:
return
return
with
open
(
self
.
cache_file_path
,
"w"
)
as
f
:
printer
=
pprint
.
PrettyPrinter
(
indent
=
4
)
printer
=
pprint
.
PrettyPrinter
(
indent
=
4
)
data
=
printer
.
pformat
(
self
.
cache
)
data
=
printer
.
pformat
(
self
.
cache
)
with
open
(
self
.
cache_file_path
,
"w"
)
as
f
:
f
.
write
(
data
)
f
.
write
(
data
)
def
load
(
self
,
def
load
(
self
,
...
@@ -131,6 +132,7 @@ class CompilerManager:
...
@@ -131,6 +132,7 @@ class CompilerManager:
if
handle
is
not
None
:
if
handle
is
not
None
:
self
.
cache
[(
runtime_shape
,
graph_index
,
self
.
cache
[(
runtime_shape
,
graph_index
,
self
.
compiler
.
name
)]
=
handle
self
.
compiler
.
name
)]
=
handle
self
.
is_cache_updated
=
True
if
graph_index
==
0
:
if
graph_index
==
0
:
# adds some info logging for the first graph
# adds some info logging for the first graph
logger
.
info
(
"Cache the graph of shape %s for later use"
,
logger
.
info
(
"Cache the graph of shape %s for later use"
,
...
...
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