Skip to content

Conversation

@SigureMo
Copy link
Member

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

之前 #71644 的 TODO 忘记了,补一下,在调用侧添加 tracker

@paddle-bot
Copy link

paddle-bot bot commented Mar 19, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@SigureMo SigureMo changed the title [SOT] Add tracker for generator in Python 3.11+ [SOT][3.13] Add tracker for generator in Python 3.11+ Mar 19, 2025
Copy link
Contributor

Copilot AI left a 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()])
Copy link

Copilot AI Mar 19, 2025

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.

Suggested change
gen.tracker = DummyTracker([self, *args, *kwargs.values()])
gen.tracker = DanglingTracker([self, *args, *kwargs.values()])
Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

给你一拳

@SigureMo SigureMo changed the title [SOT][3.13] Add tracker for generator in Python 3.11+ [SOT] Add tracker for generator in Python 3.11+ Mar 20, 2025
@SigureMo SigureMo merged commit da36481 into PaddlePaddle:develop Mar 20, 2025
34 of 35 checks passed
@SigureMo SigureMo deleted the sot/add-tracker-for-generator-in-py311-plus branch March 20, 2025 03:50
YqGe585 pushed a commit to YqGe585/Paddle that referenced this pull request May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants