[SOT][3.13] Support non-breakgraph for loop #69436
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Category
Execute Infrastructure
PR Types
New features
Description
SOT Python 3.13 支持基本的非打断场景 for-loop
Python 3.13 对
END_FOR
进行了改动,3.12END_FOR
等价于两个POP_TOP
,因此只需要一个END_FOR
即可,而 3.13 下END_FOR
只等价于一个POP_TOP
,因此需要额外一个POP_TOP
来维持栈平衡即
相关区域需要适配
Tip
3.13
dis.dis
默认显示如上所示的 Label 形式的跳转,而隐藏了 offset,但为了确认生成指令的问题,可以在dis.dis
传入show_offsets=True
来开启另外就是 3.13 下
JUMP_BACKWARD
有一个 inline cache,而JUMP_FORWARD
没有,我们是先reset_offset
后relocate_jump_target
的,relocate_jump_target
可能会将JUMP_FORWARD
改为JUMP_BACKWARD
(或反之),这就会导致 offset 异常,跳转计算出错因此需要确保
relocate_jump_target
里出现反转跳转方向时,需要重新reset_offset
,以确保计算的跳转方向是正确的打断场景待支持,目前会发生段错误
PCard-66972