mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-11 09:25:29 +08:00
[torch.compile] disable logging when cache is disabled (#12043)
Signed-off-by: youkaichao <youkaichao@gmail.com>
This commit is contained in:
parent
b5b57e301e
commit
7b98a65ae6
@ -251,15 +251,27 @@ def wrap_inductor(graph: fx.GraphModule,
|
|||||||
def _get_shape_env() -> AlwaysHitShapeEnv:
|
def _get_shape_env() -> AlwaysHitShapeEnv:
|
||||||
return AlwaysHitShapeEnv()
|
return AlwaysHitShapeEnv()
|
||||||
|
|
||||||
with patch(# for hijacking the hash of the compiled graph
|
with ExitStack() as stack:
|
||||||
"torch._inductor.codecache.compiled_fx_graph_hash",
|
if not cache_data.disabled:
|
||||||
hijack_compiled_fx_graph_hash), \
|
# compilation cache is enabled, patch several functions
|
||||||
patch(# for providing a dummy shape environment
|
|
||||||
|
# for hijacking the hash of the compiled graph
|
||||||
|
stack.enter_context(
|
||||||
|
patch("torch._inductor.codecache.compiled_fx_graph_hash",
|
||||||
|
hijack_compiled_fx_graph_hash))
|
||||||
|
|
||||||
|
# for providing a dummy shape environment
|
||||||
|
stack.enter_context(
|
||||||
|
patch(
|
||||||
"torch._inductor.codecache.FxGraphCache._get_shape_env",
|
"torch._inductor.codecache.FxGraphCache._get_shape_env",
|
||||||
_get_shape_env), \
|
_get_shape_env))
|
||||||
patch(# for forcing the graph to be cached
|
|
||||||
|
# for forcing the graph to be cached
|
||||||
|
stack.enter_context(
|
||||||
|
patch(
|
||||||
"torch._inductor.codecache.FxGraphCache._check_can_cache",
|
"torch._inductor.codecache.FxGraphCache._check_can_cache",
|
||||||
_check_can_cache):
|
_check_can_cache))
|
||||||
|
|
||||||
compiled_graph = compile_fx(graph,
|
compiled_graph = compile_fx(graph,
|
||||||
example_inputs,
|
example_inputs,
|
||||||
config_patches=current_config)
|
config_patches=current_config)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user