-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[SOT] Add tracker for generator in Python 3.11+ #71777
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] Add tracker for generator in Python 3.11+ #71777
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 fixes a bug involving generator tracking for Python 3.11+ by adding a tracker on the call side of inline generator execution.
- Updates callable.py to retrieve the generator from the inline executor, verify its type, and assign it a tracker.
- Modifies opcode_inline_executor.py to remove the use of DummyTracker in favor of DanglingTracker.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
python/paddle/jit/sot/opcode_translator/executor/variables/callable.py | Adds type assertion for generator and assigns a tracker to the returned generator. |
python/paddle/jit/sot/opcode_translator/executor/opcode_inline_executor.py | Switches tracker initialization from DummyTracker to DanglingTracker in RETURN_GENERATOR. |
assert isinstance( | ||
gen, GeneratorVariable | ||
), f"GeneratorFunction calling result should be GeneratorVariable, but got {type(gen)}" | ||
gen.tracker = DummyTracker([self, *args, *kwargs.values()]) |
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.
The tracker's type is assigned using DummyTracker here, while in opcode_inline_executor.py, a DanglingTracker is used. This inconsistency may lead to unexpected behavior.
gen.tracker = DummyTracker([self, *args, *kwargs.values()]) | |
gen.tracker = DanglingTracker([self, *args, *kwargs.values()]) |
Copilot uses AI. Check for mistakes.
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 Category
Execute Infrastructure
PR Types
Bug fixes
Description
之前 #71644 的 TODO 忘记了,补一下,在调用侧添加 tracker