-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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] Collect BreakGraph Reason #71268
[SOT] Collect BreakGraph Reason #71268
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
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.
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
python/paddle/jit/sot/utils/exceptions.py:117
- The condition 'if reason_str is not None' forces an override of any provided reason_str in BuiltinFunctionBreak, which may not be intended. Consider changing the check to 'if reason_str is None' so that a custom message can be preserved.
if reason_str is not None:
python/paddle/jit/sot/opcode_translator/executor/variables/iter.py
Outdated
Show resolved
Hide resolved
python/paddle/jit/sot/opcode_translator/executor/function_graph.py
Outdated
Show resolved
Hide resolved
python/paddle/jit/sot/opcode_translator/executor/variables/basic.py
Outdated
Show resolved
Hide resolved
python/paddle/jit/sot/opcode_translator/executor/variables/callable.py
Outdated
Show resolved
Hide resolved
python/paddle/jit/sot/opcode_translator/executor/opcode_inline_executor.py
Outdated
Show resolved
Hide resolved
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.
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
python/paddle/jit/sot/opcode_translator/executor/variable_dispatch.py:157
- The error message for the operator registration using 'not in' still mentions 'variable in iterator', which can mislead users. Consider updating the message to reflect a 'not in' scenario (e.g., "Codes like:
variable not in iterator
.").
create_raise_break_graph_handler(UnsupportedIteratorBreak("Codes like: `variable in iterator`."))
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.
我是不是来早了,好像还没改完?
python/paddle/jit/sot/opcode_translator/executor/variables/basic.py
Outdated
Show resolved
Hide resolved
python/paddle/jit/sot/opcode_translator/executor/variables/basic.py
Outdated
Show resolved
Hide resolved
python/paddle/jit/sot/opcode_translator/executor/variables/basic.py
Outdated
Show resolved
Hide resolved
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 isinstance(reason, str): | ||
# if reason is a string, then create a UnspecifiedBreakReason object | ||
reason = UnspecifiedBreakReason(reason) |
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.
这里还有多少是 UnspecifiedBreakReason
?后面是不是不允许传入 str?
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.
目前代码里没有使用 UnspecifiedBreakReason
的部分,如果后续传入了str 做参数,则会被封装为 UnspecifiedBreakReason
,目前先这样? 后面修改为不允许传入 str ,咱们严格一些吧?
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.
那是不是可以直接禁掉?assert isinstance(reason, Reason)
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.
如果直接禁掉,那是否不再需要 UnspecifiedBreakReason
类了
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.
PR Overview
This PR refactors and improves the handling of graph break reasons by introducing a dedicated base class (BreakGraphReasonBase) and specialized derived classes. It also standardizes error messaging across various modules and enhances the info collection mechanism via BreakGraphReasonInfo.
- Introduces BreakGraphReasonBase and multiple specialized break reason classes to unify and enhance error reporting.
- Updates error-triggering calls in the SOT infrastructure to use structured break reason objects.
- Enhances the info collection/reporting mechanism via BreakGraphReasonInfo in the info collector.
Reviewed Changes
File | Description |
---|---|
python/paddle/jit/sot/utils/exceptions.py | Added BreakGraphReasonBase and its derived classes; refactored BreakGraphError to collect break reasons. |
python/paddle/jit/sot/utils/info_collector.py | Introduced BreakGraphReasonInfo to integrate with the info collection mechanism. |
python/paddle/jit/sot/infer_meta.py | Updated name generation logic for better clarity and efficiency. |
python/paddle/jit/sot/opcode_translator/executor/variable_dispatch.py | Changed error handling to use create_raise_break_graph_handler with specialized break reason classes. |
...others | Standardized exception wrapping and error messages across opcode translators and variable handling modules. |
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
python/paddle/jit/sot/opcode_translator/executor/variable_dispatch.py
Outdated
Show resolved
Hide resolved
…atch.py Co-authored-by: Copilot <[email protected]>
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.
--------- Co-authored-by: Copilot <[email protected]>
PR Category
Execute Infrastructure
PR Types
Improvements
Description
Key Features
BreakGraphReasonBase
as the base class for all graph break reasonsThe demo code:
Set
SOT_COLLECT_INFO=breakgraph_reason
:The collected break graph information:
PCard-66972