Unverified Commit e80bca30 authored by Ning Xie's avatar Ning Xie Committed by GitHub
Browse files

[Refactor] refactor freezing_value/cuda_event initialize outside try finally (#23758)


Signed-off-by: default avatarAndy Xie <andy.xning@gmail.com>
parent fb4983e1
...@@ -128,8 +128,8 @@ def _torch_cuda_wrapper(): ...@@ -128,8 +128,8 @@ def _torch_cuda_wrapper():
self.record = lambda: None self.record = lambda: None
self.synchronize = lambda: None self.synchronize = lambda: None
try:
cuda_event = torch.cuda.Event cuda_event = torch.cuda.Event
try:
torch.cuda.Event = _EventPlaceholder torch.cuda.Event = _EventPlaceholder
yield yield
finally: finally:
...@@ -141,9 +141,9 @@ def _set_global_compilation_settings(config: VllmConfig): ...@@ -141,9 +141,9 @@ def _set_global_compilation_settings(config: VllmConfig):
import torch._inductor.config import torch._inductor.config
inductor_config = config.compilation_config.inductor_compile_config inductor_config = config.compilation_config.inductor_compile_config
try:
# Note: The MKLDNN and CPPGEMM backend requires freezing parameters. # Note: The MKLDNN and CPPGEMM backend requires freezing parameters.
freezing_value = torch._inductor.config.freezing freezing_value = torch._inductor.config.freezing
try:
if inductor_config.get("max_autotune", False): if inductor_config.get("max_autotune", False):
torch._inductor.config.freezing = True torch._inductor.config.freezing = True
yield yield
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment