Skip to content
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.13] Support non-breakgraph for loop #69436

Merged

Conversation

SigureMo
Copy link
Member

PR Category

Execute Infrastructure

PR Types

New features

Description

SOT Python 3.13 支持基本的非打断场景 for-loop

Python 3.13 对 END_FOR 进行了改动,3.12 END_FOR 等价于两个 POP_TOP,因此只需要一个 END_FOR 即可,而 3.13 下 END_FOR 只等价于一个 POP_TOP,因此需要额外一个 POP_TOP 来维持栈平衡

# 3.12
    FOR_ITER    to L1
    ...
L1: END_FOR

# 3.13
    FOR_ITER    to L1
    ...
L1: END_FOR
    POP_TOP

相关区域需要适配

Tip

3.13 dis.dis 默认显示如上所示的 Label 形式的跳转,而隐藏了 offset,但为了确认生成指令的问题,可以在 dis.dis 传入 show_offsets=True 来开启

另外就是 3.13 下 JUMP_BACKWARD 有一个 inline cache,而 JUMP_FORWARD 没有,我们是先 reset_offsetrelocate_jump_target 的,relocate_jump_target 可能会将 JUMP_FORWARD 改为 JUMP_BACKWARD(或反之),这就会导致 offset 异常,跳转计算出错

因此需要确保 relocate_jump_target 里出现反转跳转方向时,需要重新 reset_offset,以确保计算的跳转方向是正确的

打断场景待支持,目前会发生段错误

PCard-66972

Copy link

paddle-bot bot commented Nov 16, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@SigureMo SigureMo merged commit 7584a89 into PaddlePaddle:develop Nov 17, 2024
27 of 28 checks passed
@SigureMo SigureMo deleted the sot/support-non-breakgraph-for-loop branch November 17, 2024 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants