From a4454e9401c9c76150dc3a4d23d10377926b2fb6 Mon Sep 17 00:00:00 2001 From: Xiao Date: Mon, 18 Aug 2025 20:08:05 -0700 Subject: [PATCH] chore: disable enable_cpp_symbolic_shape_guards (#23048) Signed-off-by: Xiao Liu --- vllm/compilation/decorators.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/vllm/compilation/decorators.py b/vllm/compilation/decorators.py index 1370862d5..58f70ef9e 100644 --- a/vllm/compilation/decorators.py +++ b/vllm/compilation/decorators.py @@ -267,8 +267,24 @@ def _support_torch_compile( code.co_filename) return inline_call(parent, func, args, kwargs) + # Disable the C++ compilation of symbolic shape guards. C++-fication + # of symbolic shape guards can improve guard overhead. But, since + # vllm skip guards anyways, setting this flag to False can improve + # compile time. + dynamo_config_patches = {} + try: + _ = torch._dynamo.config.enable_cpp_symbolic_shape_guards + dynamo_config_patches[ + "enable_cpp_symbolic_shape_guards"] = False + except AttributeError: + # Note: this config is not available in torch 2.6, we can skip + # if the config doesn't exist + logger.debug( + "enable_cpp_symbolic_shape_guards config not available") + with patch.object(InliningInstructionTranslator, 'inline_call', - patched_inline_call): + patched_inline_call), torch._dynamo.config.patch( + **dynamo_config_patches): output = self.compiled_callable(*args, **kwargs) return output