[SOT] Refactor sot simulation to avoid hold real frame in graph and codegen #71275
+58
−43
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
Devs
Description
重构 SOT pycodegen 和 graph 对 frame 的引用,这些地方都不应该 hold 真实 frame
后续
OpCodeExecutor
同样不会 hold 真实 frame,作为替代,会 hold 一个VirtualFrame
,这个 vframe 会在OpCodeExecutor
外构造并传入,OpCodeExecutor
本身是无状态的,只用来执行(或弱状态,只持有 stack)后续会进一步改造,https://github.com/PaddleJitLab/deepdive-python-internals/blob/main/examples/generator.py 这种引用关系才是良好的结构,Frame 后续会作为轻量级的可 dump 和 load 的结构,确保实现生成器时能够实现正确的回退
PCard-66972