diff --git a/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py b/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py index 5f193cebc085d8..ccfae0a888f024 100644 --- a/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py +++ b/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py @@ -2114,6 +2114,13 @@ def RETURN_VALUE(self, instr: Instruction): len(self.stack) == 1 ), f"Stack must have one element, but get {len(self.stack)} elements." ret_val = self.stack.pop() + return self.compile_return(ret_val) + + def RETURN_CONST(self, instr: Instruction): + ret_const = self._co_consts[instr.arg] + return self.compile_return(ret_const) + + def compile_return(self, ret_val): compile_fn = self._graph.get_compiled_fn(ret_val) if compile_fn.graph_size() < ENV_MIN_GRAPH_SIZE.get(): self.new_code = None diff --git a/python/paddle/jit/sot/opcode_translator/executor/opcode_inline_executor.py b/python/paddle/jit/sot/opcode_translator/executor/opcode_inline_executor.py index 4baa64e8841075..3832d05f044487 100644 --- a/python/paddle/jit/sot/opcode_translator/executor/opcode_inline_executor.py +++ b/python/paddle/jit/sot/opcode_translator/executor/opcode_inline_executor.py @@ -283,6 +283,10 @@ def RETURN_VALUE(self, instr: Instruction): self.return_value = self.stack.pop() return Stop(state="Return") + def RETURN_CONST(self, instr: Instruction): + self.return_value = self._co_consts[instr.arg] + return Stop(state="Return") + def _break_graph_when_if(self, result, instr: Instruction): """ Helper method to raise a BreakGraphError when breaking the graph in a jump operation. diff --git a/test/sot/skip_files_py312 b/test/sot/skip_files_py312 index 3cc5b8d4439e03..d79956533e2d3b 100644 --- a/test/sot/skip_files_py312 +++ b/test/sot/skip_files_py312 @@ -14,14 +14,7 @@ ./test_guard_user_defined_fn.py ./test_inplace_api.py ./test_min_graph_size.py -./test_output_restoration.py ./test_side_effects.py -./test_simulate_initialize.py -./test_sir_rollback.py ./test_sot_cost_model.py -./test_sot_export.py ./test_sot_resnet.py ./test_sot_resnet50_backward.py -./test_specialization.py -./test_str_format.py -./test_builtin_bool.py