[SOT] Allow user specify a region to safe capture control flow#75548
Merged
SigureMo merged 6 commits intoPaddlePaddle:developfrom Oct 14, 2025
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #75548 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 4
Lines ? 33
Branches ? 0
===========================================
Hits ? 33
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
DrRyanHuang
reviewed
Oct 14, 2025
DrRyanHuang
reviewed
Oct 14, 2025
Comment on lines
+34
to
+36
| def fn_with_control_flow_explicit_capture(x): | ||
| x = inner_fn_with_control_flow_explicit_capture(x) | ||
| return x + 1 |
Contributor
There was a problem hiding this comment.
这里要不要加一个 @check_no_breakgraph
Member
Author
There was a problem hiding this comment.
translate_count 可以保证没有打断,或者说 translate_count 就是为了保证这一点的
Member
Author
There was a problem hiding this comment.
translate_count 有更强的约束,还能保证确实捕获成了控制流,不会加 x 的 guard
DrRyanHuang
approved these changes
Oct 14, 2025
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Bug fixes
Description
允许用户标记局部函数以捕获控制流
此时 fn 里的 Data Dependent Control Flow 不会再触发打断,因为整个函数已经通过 AST 转写,我们假定经过 AST 转写后的函数总是「动静统一」的
TODOs
with形式,避免用户手动提取函数,当然前提是支持 with 语法的模拟