chore: disable enable_cpp_symbolic_shape_guards (#23048)

Signed-off-by: Xiao Liu <xiszishu@gmail.com>
This commit is contained in:
Xiao 2025-08-18 20:08:05 -07:00 committed by GitHub
parent 14006840ea
commit a4454e9401
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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