CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[SOT] Refactor RangeVariable
and setitem and add compilation count stats
#70851
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] Refactor RangeVariable
and setitem and add compilation count stats
#70851
Conversation
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 5 out of 11 changed files in this pull request and generated no comments.
Files not reviewed (6)
- python/paddle/jit/sot/utils/init.py: Evaluated as low risk
- python/paddle/jit/sot/opcode_translator/executor/variables/base.py: Evaluated as low risk
- python/paddle/jit/sot/translate.py: Evaluated as low risk
- python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py: Evaluated as low risk
- python/paddle/jit/sot/opcode_translator/executor/variables/basic.py: Evaluated as low risk
- python/paddle/jit/sot/opcode_translator/executor/function_graph.py: Evaluated as low risk
Comments suppressed due to low confidence (5)
python/paddle/jit/sot/utils/info_collector.py:118
- The use of @abstractclassmethod is incorrect. It should be replaced with @AbstractMethod.
@abstractclassmethod
python/paddle/jit/sot/utils/info_collector.py:30
- The import of the 'types' module is under the TYPE_CHECKING condition, which might cause a runtime error if TYPE_CHECKING is false. It should be imported outside the TYPE_CHECKING block.
import types
python/paddle/jit/sot/opcode_translator/executor/variable_dispatch.py:575
- Ensure that the TensorVariable type is correctly handled in the dispatch_list_ne method. Verify that RangeVariable initialization is correct.
"ConstantVariable | TensorVariable",
python/paddle/jit/sot/opcode_translator/executor/variable_dispatch.py:827
- Verify that add_guard is correctly applied in the setitem and delitem dispatchers and that the key and value are valid.
lambda var, key, value: var.setitem(add_guard(key).get_py_value(), value),
python/paddle/jit/sot/opcode_translator/executor/variables/container.py:715
- The line
self.graph.add_global_guarded_variable(self)
was removed. This may cause issues if theRangeVariable
itself needs to be guarded.
self.graph.add_global_guarded_variable(key)
RangeVariable
and setitem and add compilation count statsRangeVariable
and setitem and add compilation count stats
你的PR提交成功,感谢你对开源项目的贡献! |
PR Category
Execute Infrastructure
PR Types
Performance
Description
优化 RangeVariable,使其可以延迟
get_py_value
,比如:之前
range(tensor)
会提前打断,之后的range
对象里就真的是一个数了,导致 for 循环这里感知不到可能和 tensor 相关,如果 tensor 本身很大(比如 400),而且每次都很大,那么结果就是会组一个 unroll 400*foo 的网,而且这里 tensor 本身是组网输出,是会变的,那么必然每次都重新组网,导致编译时间非常长,无论是动转静还是编译器都跑不完因此延迟
get_py_value
,使range(tensor)
的打断延迟到 for 循环,使 for 循环感知打断,会按照 for 打断处理,避免重复构图优化统一
setitem
、getitem
、delitem
相关代码,统一使用 dispatch,使 Tensor setitem 可以组网添加端到端编译数量统计
PCard-66972