[dynamo, 3.14] fix segfault due to improper create_call_function_ex (#166678)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/166678
Approved by: https://github.com/malfet
This commit is contained in:
William Wen 2025-10-30 17:25:01 -07:00 committed by PyTorch MergeBot
parent 4a7bc1d522
commit e4043884c7
3 changed files with 5 additions and 8 deletions

View File

@ -4,10 +4,10 @@ import os
from unittest.mock import patch from unittest.mock import patch
import torch import torch
from functorch import make_fx
from torch._dynamo import debug_utils from torch._dynamo import debug_utils
from torch._dynamo.debug_utils import aot_graph_input_parser, generate_env_vars_string from torch._dynamo.debug_utils import aot_graph_input_parser, generate_env_vars_string
from torch._dynamo.test_case import TestCase from torch._dynamo.test_case import TestCase
from torch.fx.experimental.proxy_tensor import make_fx
from torch.testing._internal.common_device_type import instantiate_device_type_tests from torch.testing._internal.common_device_type import instantiate_device_type_tests

View File

@ -415,6 +415,7 @@ def create_call_function_ex(
and not ignore_314_kwargs_push and not ignore_314_kwargs_push
): ):
output.append(create_instruction("PUSH_NULL")) output.append(create_instruction("PUSH_NULL"))
has_kwargs = True
if push_null: if push_null:
output.append(create_instruction("PUSH_NULL")) output.append(create_instruction("PUSH_NULL"))
# 3.13 swapped NULL and callable # 3.13 swapped NULL and callable

View File

@ -3176,7 +3176,7 @@ class InstructionTranslatorBase(
] ]
) )
# TOS: resumes, frames (popped), frame 1 stack + locals # TOS: resume 1, remaining resumes, frames (popped), frame 1 stack + locals
cg.extend_output( cg.extend_output(
[ [
*create_rot_n(3), *create_rot_n(3),
@ -3187,12 +3187,8 @@ class InstructionTranslatorBase(
] ]
) )
# TOS: [resumes, frames, *(frame 1 stack + locals)] # TOS: resume 1, [remaining resumes, frames, *(frame 1 stack + locals)]
cg.extend_output( cg.extend_output(create_call_function_ex(False, True))
[
*create_call_function_ex(False, True),
]
)
def should_compile_partial_graph(self) -> bool: def should_compile_partial_graph(self) -> bool:
if sys.version_info >= (3, 11): if sys.version_info >= (3, 11):