Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2118,3 +2118,10 @@ def RETURN_VALUE(self, instr: Instruction):
self.new_code = self._graph.pycode_gen.gen_pycode()
self.guard_fn = self._graph.guard_fn
return Stop(state="Return")

def RETURN_CONST(self, instr: Instruction):
ret_const = self._co_consts[instr.arg]
self._graph.start_compile(ret_const)
self._graph.pycode_gen.gen_return()
self.new_code = self._graph.pycode_gen.gen_pycode()
return Stop(state="Return")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以考虑服用下 RETURN_VALUE 的代码,抽出来一个公共函数~

Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions test/sot/skip_files_py312
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,11 @@
./test_inplace_api.py
./test_min_graph_size.py
./test_numpy_var_if.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_tensor_dtype_in_guard.py
./test_dtype.py
./test_builtin_bool.py