-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SOT][3.12] extract RETURN_VALUE
and RETURN_CONST
hard code
#62073
[SOT][3.12] extract RETURN_VALUE
and RETURN_CONST
hard code
#62073
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -1751,7 +1753,7 @@ def _break_graph_when_if(self, result: TensorVariable, instr: Instruction): | |||
|
|||
# 2. create true_fn and false_fn | |||
def create_if_branch_fn(start_idx, input_var_names): | |||
if self._instructions[start_idx].opname == "RETURN_VALUE": | |||
if self._instructions[start_idx].opname in RETURN: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里之前是不是考虑过,如果包含 "RETURN_CONST"
是不对的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件下面两处应该有同样的问题~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方,我试了一下如果走到 if x_tensor>0: return 1
确实会触发assert true_fn is not None
出错;原因应该是如果是3.12以前返回const的字节码是LOAD_CONST
和RETURN_VALUE
,所以这里应该不能返回NULL;3.12字节码变成只有RETURN_CONST
,所以包含"RETURN_CONST"
会返回NULL确实不对。
后两处应该也是同样原因,虽然没想到会报错的例子,那我这三处都改回来,保持对齐以前的逻辑
@@ -1751,7 +1753,7 @@ def _break_graph_when_if(self, result: TensorVariable, instr: Instruction): | |||
|
|||
# 2. create true_fn and false_fn | |||
def create_if_branch_fn(start_idx, input_var_names): | |||
if self._instructions[start_idx].opname == "RETURN_VALUE": | |||
if self._instructions[start_idx].opname == "RETURE_VALUE": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
拼写错了哦
@@ -26,6 +26,7 @@ | |||
HAS_FREE = {opcode.opname[x] for x in opcode.hasfree} | |||
ALL_JUMP = REL_JUMP | ABS_JUMP | |||
UNCONDITIONAL_JUMP = {"JUMP_ABSOLUTE", "JUMP_FORWARD"} | |||
RETURN = {"RETURN_VALUE", "RETURN_CONST"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不要把 UNCONDITIONAL_JUMP
给分离开呀
另外这里的 RETURN
也可以和 UNCONDITIONAL_JUMP
处理方式一样 3.12 才 add RETURN_CONST
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RETURN_VALUE
and RETURN_CONST
hard code
PR types
Others
PR changes
Others
Description
extract
RETURN_VALUE
andRETURN_CONST
hard code