CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[SOT][Faster Guard] Implement SymbolicVariable.make_faster_guard
#72438
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][Faster Guard] Implement SymbolicVariable.make_faster_guard
#72438
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.
Pull Request Overview
This PR implements SymbolicVariable.make_faster_guard and refactors the Guard API across several modules for performance improvements. Key changes include:
- Introducing create_guard_node methods for ConstraintNodes (e.g. UnaryConstraintNode, BinaryConstraintNode, ConstantConstraintNode, and SymbolicConstraintNode) that mirror their corresponding create_guard_expr methods.
- Updating type annotations and return types in various executor modules to use paddle.framework.core.GuardNodeBase instead of the previous GuardNode.
- Propagating these changes consistently across files in the sot opcode translator and symbolic shape systems.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
File | Description |
---|---|
python/paddle/jit/sot/symbolic_shape/constraints.py | Added create_guard_node implementations for constraint nodes and refined error messages. |
python/paddle/jit/sot/opcode_translator/executor/variables/*.py | Updated type annotations and return types from GuardNode to GuardNodeBase for faster guard methods. |
python/paddle/jit/sot/opcode_translator/executor/guard.py and others | Modified decorator signatures and usages to match the new GuardNodeBase type. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #72438 +/- ##
==========================================
Coverage ? 96.22%
==========================================
Files ? 9
Lines ? 53
Branches ? 0
==========================================
Hits ? 51
Misses ? 2
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
enum class OpType { NUMBER, LOGICAL }; | ||
|
||
static constexpr std::array<std::pair<const char*, std::pair<OpType, int>>, 6> | ||
kOpMap = {{{"+", {OpType::NUMBER, 0}}, |
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.
我们现在支持 unary +
了么?虽然支持也没啥问题
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端还没实现
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 实现下
{"-", {OpType::NUMBER, 1}}, | ||
{"~", {OpType::NUMBER, 2}}, | ||
{"not", {OpType::LOGICAL, 0}}, | ||
{"!", {OpType::LOGICAL, 0}}, |
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.
顺便把!也当成not处理了
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 语法
} else { | ||
PyNumberMethods* nb = Py_TYPE(lhs)->tp_as_number; | ||
if (nb == nullptr) { | ||
PyErr_SetString(PyExc_TypeError, |
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.
话说我们异常信息这里后续会利用上吗,是说在返回 False
的情况下会检查是否包含异常吗?
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.
目前还没用上,最后都给 PyErr_Clear了,但是后面没准会用上
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.
…addlePaddle#72438) * add BinaryExprNode, UnaryExprNode,ExprGuardNode * impl make_faster_guard * update ConstraintNode
PR Category
Execute Infrastructure
PR Types
Performance
Description
实现了 SymbolicVariable.make_faster_guard,主要通过下面几个工作实现: